diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 000000000..137cf18a2 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,321 @@ +# LARA Framework - Copilot Instructions + +## Project Overview + +The LARA Framework is a sophisticated **source-to-source compiler framework** designed for building domain-specific language (DSL) compilers and weavers. It provides tools and APIs to develop custom source-to-source transformations for programming languages, with a particular focus on C/C++ and other systems programming languages. + +### Key Capabilities +- **Source-to-source compilation**: Transform code from one representation to another while preserving semantics +- **Metaprogramming support**: Enable automated code generation and transformation +- **Language-agnostic architecture**: Define custom AST specifications for any target language +- **DSL development**: Build domain-specific languages with integrated tooling + +### Target Audience +- Compiler developers +- Research teams working on code optimization and transformation +- Tool developers building code analysis and transformation systems +- Academic researchers in programming languages and compilers + +## Development Environment & Setup + +- **Java Version:** 17+ (required for all Java components) +- **Node.js Version:** 20 or 22 (minimum 20.0.0 for JavaScript components) +- **Build System:** Gradle for Java modules, npm for TypeScript/JavaScript +- **IDE:** VSCode is recommended for development + +## Architecture Overview + +The LARA framework follows a modular architecture with clear separation of concerns: + +``` +lara-framework/ +├── Lara-JS/ # JavaScript/TypeScript driver/entrypoint and API collection for transformations and analyses +├── LanguageSpecification/ # XML-based AST specification system +├── WeaverGenerator/ # Automatic weaver code generation +├── LARAI/ # LARA Interpreter +├── DefaultWeaver/ # Reference weaver implementation +├── WeaverInterface/ # Core weaver interfaces +├── WeaverOptionsManager/ # Configuration management +└── LaraUtils/ # Shared utilities +``` + +### Technology Stack +- **Backend**: Java 17+ with Gradle build system +- **Frontend**: TypeScript/JavaScript with Node.js 20 or 22 +- **Specification**: XML with XSD schema validation +- **Testing**: Jest (JS), JUnit (Java) +- **Interoperability**: Java-JavaScript bridge via `java` npm package + +### Related Projects +- **clava**: C/C++ source-to-source compiler built on LARA framework +- **kadabra**: Java source-to-source compiler built on LARA framework +- **specs-java-libs**: Core Java utility libraries (SpecsUtils, jOptions, etc.) + +## Core Concepts + +### 1. Join Point Model +Join points represent nodes in an Abstract Syntax Tree (AST) with associated attributes and actions: + +```typescript +// Example: A function join point with attributes and actions +class FunctionJoinPoint extends LaraJoinPoint { + // Attributes (read-only properties) + get name(): string { /* function name */ } + get params(): VariableJoinPoint[] { /* parameters */ } + get body(): StatementJoinPoint { /* function body */ } + + // Actions (methods that transform the AST) + replaceWith(newFunction: FunctionJoinPoint): void { /* replace implementation */ } + insertBefore(statement: StatementJoinPoint): void { /* insert before this function */ } +} +``` + +These are defined in the `joinPointModel.xml` file, which specifies the hierarchy and relationships between different join point types. +You can then run the following command to generate the TypeScript interfaces for the join points: + +```bash +# Generate TypeScript interfaces from XML specifications +cd Lara-JS +npm run build-interfaces +``` + +### 2. Weaver Pattern +Weavers are the core transformation engines that implement source-to-source compilation: + +```java +public class CustomWeaver extends AWeaverEngine { + @Override + public List> getJoinPointClasses() { + // Return available join point types + } + + @Override + public boolean handlesApplication(File source) { + // Determine if this weaver can process the source + } +} +``` + +A lot of their code is automatically generated by the `WeaverGenerator` module, which creates boilerplate code based on the XML specifications of the joinpoints. +It is run automatically during the build process. + +### 3. Language Specification System +The framework uses XML-based specifications to define: + +- **joinPointModel.xml**: AST node hierarchy and relationships +- **actionModel.xml**: Available methods/actions on join points +- **artifacts.xml**: Attributes and properties of join points + +```xml + + + + +``` + +### 4. Java-JavaScript Interoperability +The Lara-JS module provides seamless integration between Java weavers and JavaScript transformation scripts: + +```typescript +// Access Java weaver functionality from JavaScript +const weaverEngine = Weaver.getWeaverEngine(); +const rootJoinPoint = weaverEngine.getRootJoinPoint(); + +// Transform AST using JavaScript +for (const func of Query.search('function')) { + if (func.name.startsWith('old_')) { + func.replaceWith(modernizeFunction(func)); + } +} +``` + +## Module Details + +### Lara-JS (`@specs-feup/lara`) +**Purpose**: TypeScript/JavaScript implementation providing modern API and better compatibility + +**Key Components**: +- `src-api/`: Public API for weaver development +- `src-code/`: Core weaver functionality and launchers +- `scripts/`: Build and interface generation tools + +**Entry Points**: +- `core.ts`: Global imports and initialization +- `weaver/Weaver.ts`: Main weaver utilities +- `LaraJoinPoint.ts`: Base join point implementation + +### LanguageSpecification +**Purpose**: Formal XML-based specification system for defining AST structures + +**Key Files**: +- `language/*.xml`: Core language specifications +- `resources/schemas/*.xsd`: XML Schema definitions for validation +- `DOCUMENTATION.md`: Comprehensive specification guide + +**Usage**: Define custom AST nodes, attributes, and actions for new target languages + +### WeaverGenerator +**Purpose**: Automatically generate Java weaver implementations from language specifications + +**Capabilities**: +- Generate join point classes from XML specifications +- Create weaver boilerplate code +- Validate specification consistency + +### LARAI +**Purpose**: LARA Interpreter for executing transformation scripts + +**Key Class**: `LaraI.java` - Main interpreter entry point with thread-local weaver management + +## Development Guidelines + +### Code Organization Patterns + +1. **Join Point Hierarchy**: Follow inheritance patterns defined in `joinPointModel.xml` +2. **Attribute Naming**: Use camelCase for JavaScript, snake_case for internal representations +3. **Action Methods**: Prefix with verb (e.g., `replace`, `insert`, `remove`) +4. **Type Safety**: Leverage TypeScript for API definitions, Java generics for backend + +### Common Development Scenarios + +#### Adding a New Join Point Type +1. Update `LanguageSpecification/language/joinPointModel.xml` +2. Define attributes in `artifacts.xml` +3. Add actions in `actionModel.xml` +4. Regenerate interfaces using WeaverGenerator (gradle should handle this automatically) +5. Implement concrete classes in target weaver + +#### Creating a Custom Weaver +1. Extend `AWeaverEngine` in Java backend +2. Implement required abstract methods +3. Define language-specific join points +4. Create JavaScript API wrapper in Lara-JS +5. Add configuration options via WeaverOptionsManager + +### Build System + +The project uses Gradle multi-project build: + +```bash +# Build all modules +./gradle build + +# Build specific module +./gradle :Lara-JS:build + +# Run tests +./gradle test +``` + +### Testing Approach + +- **Unit Tests**: Jest for TypeScript, JUnit for Java +- **Integration Tests**: End-to-end weaver execution tests +- **Specification Tests**: XML schema validation and parsing tests + +## API Reference Summary + +### Core Classes (Java) +- `WeaverEngine`: Main weaver execution engine +- `AJoinPoint`: Base class for all join points +- `LaraI`: Interpreter and execution context +- `LanguageSpecification`: XML specification parser + +### Core Classes (TypeScript) +- `LaraJoinPoint`: Base join point with JavaScript API +- `Weaver`: Utility methods for weaver interaction +- `Query`: AST querying and selection +- `DataStore`: Configuration and state management + +### Common Usage Patterns + +```typescript +// 1. Querying AST +const functions = Query.searchFrom($root, 'function'); +const loops = Query.searchFrom($function, 'loop'); + +// 2. Accessing attributes +console.log($function.name, $function.numParams); + +// 3. Applying transformations +$loop.setKind('unroll'); +$statement.insertBefore(newStatement); + +// 4. Weaver utilities +const isJP = Weaver.isJoinPoint($node); +const defaultAttr = Weaver.getDefaultAttribute('function'); +``` + +## Integration Points + +### For Weaver Developers +- Implement `WeaverEngine` interface +- Define join point specifications in XML +- Create transformation APIs + +### For Language Researchers +- Extend language specifications +- Add new join point types and attributes +- Implement domain-specific transformations + +### For Tool Builders +- Use Lara-JS APIs for tool integration +- Leverage parallel execution capabilities +- Build on weaver launcher infrastructure + +## Dependencies and Requirements + +### Runtime Requirements +- **Java**: JDK 17 or higher +- **Node.js**: Version 20 or 22 (minimum 20.0.0) +- **Build**: Gradle 6.0+ for Java modules + +### Key Dependencies +- `java`: Node.js-Java bridge +- `cytoscape`: Graph visualization +- `yargs`: Command-line argument parsing +- `chokidar`: File system watching + +## Common Troubleshooting + +### Java-JavaScript Interop Issues +- Ensure compatible Java and Node.js versions +- Check `java` npm package installation +- Verify JAVA_HOME environment variable + +### Specification Validation Errors +- Validate XML against XSD schemas +- Check join point inheritance consistency +- Verify action parameter types + +### Build Issues +- Clean and rebuild with `./gradle clean build` +- Check Gradle wrapper compatibility +- Ensure all subprojects build independently + +## References + +- **Main Repository**: https://github.com/specs-feup/lara-framework +- **Language Specification Guide**: `LanguageSpecification/DOCUMENTATION.md` + +## Contributing + +When working with this codebase: + +1. **Follow established patterns** for join point definitions and weaver implementations +2. **Update specifications** when adding new AST node types +3. **Maintain compatibility** between Java and JavaScript APIs +4. **Add comprehensive tests** for new functionality +5. **Document new join point types** and transformation capabilities + +The LARA framework is designed for extensibility - most common development tasks involve extending existing patterns rather than creating entirely new architectures. + +--- + +**For LLMs:** +- Follow established patterns for join point definitions and weaver implementations +- Update specifications when adding new AST node types +- Maintain compatibility between Java and JavaScript APIs +- Add comprehensive tests for new functionality +- Document new join point types and transformation capabilities diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml new file mode 100644 index 000000000..4b3da327d --- /dev/null +++ b/.github/workflows/copilot-setup-steps.yml @@ -0,0 +1,95 @@ +name: "Copilot Setup Steps" + +# Automatically run the setup steps when they are changed +# Allows for streamlined validation, +# and allow manual testing through the repository's "Actions" tab + +on: + workflow_dispatch: + push: + paths: + - .github/workflows/copilot-setup-steps.yml + pull_request: + paths: + - .github/workflows/copilot-setup-steps.yml + +env: + LARA_FRAMEWORK_BRANCH: ${{ github.head_ref || github.ref_name }} + +jobs: + # The job MUST be called `copilot-setup-steps` + # otherwise it will not be picked up by Copilot. + copilot-setup-steps: + runs-on: ubuntu-latest + + # Permissions set just for the setup steps + # Copilot has permissions to its branch + + permissions: + # To allow us to clone the repo for setup + contents: read + + # The setup steps - install our dependencies + steps: + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + with: + gradle-version: current + dependency-graph: generate-and-submit + + - name: Checkout lara-framework + uses: actions/checkout@v4 + with: + path: lara-framework + + - name: Determine repository refs + id: repo-refs + shell: bash + env: + BRANCH_NAME: ${{ env.LARA_FRAMEWORK_BRANCH }} + run: | + set -euo pipefail + + determine_ref() { + local prefix=$1 + local repo=$2 + local url="https://github.com/${repo}.git" + + local default_branch + default_branch=$(git ls-remote --symref "$url" HEAD | awk '/^ref:/ {print $2}' | sed 's@refs/heads/@@') + echo "${prefix}_default=${default_branch}" >> "$GITHUB_OUTPUT" + echo "Default branch for ${repo} is '${default_branch}'" + + if git ls-remote --heads "$url" "refs/heads/${BRANCH_NAME}" >/dev/null; then + echo "${prefix}_match=true" >> "$GITHUB_OUTPUT" + echo "${prefix}_ref=${BRANCH_NAME}" >> "$GITHUB_OUTPUT" + echo "Branch '${BRANCH_NAME}' exists in ${repo}" + else + echo "${prefix}_match=false" >> "$GITHUB_OUTPUT" + echo "${prefix}_ref=${default_branch}" >> "$GITHUB_OUTPUT" + echo "Branch '${BRANCH_NAME}' not found in ${repo}. Falling back to '${default_branch}'." + fi + } + + determine_ref "specs" "specs-feup/specs-java-libs" + + - name: Echo checks + run: | + echo "Lara-Framework branch: ${{ env.LARA_FRAMEWORK_BRANCH }}" + echo "Matching branch found (specs-java-libs): ${{ steps.repo-refs.outputs.specs_match }}" + echo "Specs-java-libs ref: ${{ steps.repo-refs.outputs.specs_ref }}" + echo "Specs-java-libs default fallback: ${{ steps.repo-refs.outputs.specs_default }}" + echo "Pull request base_ref (if any): ${{ github.base_ref }}" + + - name: Checkout specs-java-libs + uses: actions/checkout@v4 + with: + repository: specs-feup/specs-java-libs + path: specs-java-libs + ref: ${{ steps.repo-refs.outputs.specs_ref }} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 7a781d2a6..631d4093c 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -7,7 +7,6 @@ name: nightly on: push: - pull_request: # Daily at midnight schedule: @@ -32,7 +31,6 @@ jobs: runs-on: ubuntu-latest outputs: - branch-exists-lara-framework: ${{ steps.Branch-lara-framework.outputs.value }} branch-exists-specs-java-libs: ${{ steps.Branch-specs-java-libs.outputs.value }} steps: @@ -69,8 +67,7 @@ jobs: with: repository: specs-feup/specs-java-libs path: specs-java-libs - # This is causing problems in PRs, for now it will always be the default branch - #ref: ${{ steps.Branch-specs-java-libs.outputs.value == '1' && env.BRANCH_NAME || env.DEFAULT_BRANCH }} + ref: ${{ steps.Branch-specs-java-libs.outputs.value == '1' && env.BRANCH_NAME || env.DEFAULT_BRANCH }} # Setting up gradle multi-project would be helpful - name: Build and test LanguageSpecification @@ -78,18 +75,18 @@ jobs: run: gradle build test env: GITHUB_DEPENDENCY_GRAPH_ENABLED: false - - name: Build and test LaraCommonLanguage - working-directory: lara-framework/LaraCommonLanguage - run: gradle build test + - name: Build and test LARAI + working-directory: lara-framework/LARAI + run: gradle build test env: GITHUB_DEPENDENCY_GRAPH_ENABLED: false - - name: Build and test LaraDoc - working-directory: lara-framework/LaraDoc - run: gradle build test + - name: Build and test LaraUtils + working-directory: lara-framework/LaraUtils + run: gradle build test env: GITHUB_DEPENDENCY_GRAPH_ENABLED: false - - name: Build and test LARAI - working-directory: lara-framework/LARAI + - name: Build and test WeaverInterface + working-directory: lara-framework/WeaverInterface run: gradle build test env: GITHUB_DEPENDENCY_GRAPH_ENABLED: false @@ -98,8 +95,13 @@ jobs: run: gradle build test env: GITHUB_DEPENDENCY_GRAPH_ENABLED: false - - name: Build and test WeaverInterface - working-directory: lara-framework/WeaverInterface + - name: Build and test DefaultWeaver + working-directory: lara-framework/DefaultWeaver + run: gradle installDist + env: + GITHUB_DEPENDENCY_GRAPH_ENABLED: false + - name: Build and test WeaverOptionsManager + working-directory: lara-framework/WeaverOptionsManager run: gradle build test env: GITHUB_DEPENDENCY_GRAPH_ENABLED: false @@ -111,11 +113,11 @@ jobs: report_paths: './**/build/test-results/test/TEST-*.xml' summary: true - #- name: Upload lara-framework artifacts - # uses: actions/upload-artifact@v4 - # with: - # name: java-binaries - # path: lara-framework/LaraFramework/build/install/LaraFramework + - name: Upload java binary artifacts + uses: actions/upload-artifact@v4 + with: + name: java-binaries + path: lara-framework/DefaultWeaver/build/install/DefaultWeaver build-js: @@ -124,7 +126,7 @@ jobs: strategy: fail-fast: false matrix: - #node-version: ['latest', '20.x', '18.x'] + #node-version: ['latest', '22.x', '20.x'] node-version: ['22.x', '20.x'] os: [ubuntu-latest, windows-latest, macos-latest] @@ -158,17 +160,16 @@ jobs: cd lara-framework/Lara-JS npm run build - #- name: Pull java-binaries - # uses: actions/download-artifact@v4 - # with: - # name: java-binaries - # path: lara-framework/Lara-JS/java-binaries - - # Not working yet, missing connection to Java classes - #- name: Test JS - # run: | - # cd lara-framework/Lara-JS - # npm run test + - name: Pull java binary artifacts from previous job + uses: actions/download-artifact@v4 + with: + name: java-binaries + path: lara-framework/DefaultWeaver/build/install/DefaultWeaver + + - name: Test JS + run: | + cd lara-framework/Lara-JS + npm run test # Only on ubuntu-latest - name: Publish JS diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000..80e963be2 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "orta.vscode-jest" + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 492c67dfe..0235544be 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,4 +2,7 @@ "cmake.ignoreCMakeListsMissing": true, "java.compile.nullAnalysis.mode": "automatic", "java.configuration.updateBuildConfiguration": "automatic", -} \ No newline at end of file + "jest.runMode": { + "type": "on-demand" + }, +} diff --git a/DefaultWeaver/.gitignore b/DefaultWeaver/.gitignore new file mode 100644 index 000000000..72206ef7c --- /dev/null +++ b/DefaultWeaver/.gitignore @@ -0,0 +1,9 @@ +*.svg +*.png +*.dotty + +src/**/abstracts +src/**/exceptions/DefaultWeaverException.java +DefaultWeaver.json + + diff --git a/DefaultWeaver/README.md b/DefaultWeaver/README.md new file mode 100644 index 000000000..6601f4eae --- /dev/null +++ b/DefaultWeaver/README.md @@ -0,0 +1,5 @@ +# Default Weaver + +A auto-generated weaver used only for testing purposes. +It serves as an example but **should not be used as a base for any other code**. +If you are looking to build your own weaver, look at the `WeaverGenerator` project. \ No newline at end of file diff --git a/DefaultWeaver/build.gradle b/DefaultWeaver/build.gradle new file mode 100644 index 000000000..73159917f --- /dev/null +++ b/DefaultWeaver/build.gradle @@ -0,0 +1,65 @@ +plugins { + id 'distribution' + id 'application' // Executable + id 'java' // Java project +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + + withSourcesJar() +} + +// Repositories providers +repositories { + mavenCentral() +} + +configurations { + weaverGeneratorRuntime +} + +dependencies { + implementation ":CommonsLangPlus" // Required for APIs only. Needs to be in the classpath. + implementation ":jOptions" + implementation ":SpecsUtils" + + implementation ":LanguageSpecification" + implementation ":LARAI" + implementation ":LaraUtils" + implementation ":WeaverInterface" + + weaverGeneratorRuntime ':WeaverGenerator' +} + +// Project sources +sourceSets { + main { + java { + srcDir 'src' + } + + resources { + srcDir 'resources' + } + } +} + +// Re-run the weaver generator +tasks.register('generateWeaver', JavaExec) { + group = "Execution" + description = "Generates the Weaver Abstracts" + classpath = configurations.weaverGeneratorRuntime + mainClass = 'org.lara.interpreter.weaver.generator.commandline.WeaverGenerator' + args = [ + "-w", "DefaultWeaver", + "-x", "${rootProject.projectDir}/resources/specification", + "-o", "${rootProject.projectDir}/src/", + "-p", "org.lara.interpreter.weaver.defaultweaver", + "-e", + "-j" + ] +} + +compileJava.dependsOn generateWeaver diff --git a/LARAI/resources/org/lara/interpreter/weaver/defaultweaver/specification/actionModel.xml b/DefaultWeaver/resources/specification/actionModel.xml similarity index 100% rename from LARAI/resources/org/lara/interpreter/weaver/defaultweaver/specification/actionModel.xml rename to DefaultWeaver/resources/specification/actionModel.xml diff --git a/LARAI/resources/org/lara/interpreter/weaver/defaultweaver/specification/artifacts.xml b/DefaultWeaver/resources/specification/artifacts.xml similarity index 100% rename from LARAI/resources/org/lara/interpreter/weaver/defaultweaver/specification/artifacts.xml rename to DefaultWeaver/resources/specification/artifacts.xml diff --git a/LARAI/resources/org/lara/interpreter/weaver/defaultweaver/specification/joinPointModel.xml b/DefaultWeaver/resources/specification/joinPointModel.xml similarity index 100% rename from LARAI/resources/org/lara/interpreter/weaver/defaultweaver/specification/joinPointModel.xml rename to DefaultWeaver/resources/specification/joinPointModel.xml diff --git a/DefaultWeaver/settings.gradle b/DefaultWeaver/settings.gradle new file mode 100644 index 000000000..7c755571c --- /dev/null +++ b/DefaultWeaver/settings.gradle @@ -0,0 +1,13 @@ +rootProject.name = 'DefaultWeaver' + +def specsJavaLibsRoot = System.getenv('SPECS_JAVA_LIBS_HOME') ?: '../../specs-java-libs' + +includeBuild("${specsJavaLibsRoot}/CommonsLangPlus") +includeBuild("${specsJavaLibsRoot}/jOptions") +includeBuild("${specsJavaLibsRoot}/SpecsUtils") + +includeBuild("../LanguageSpecification") +includeBuild("../LARAI") +includeBuild("../LaraUtils") +includeBuild("../WeaverGenerator") +includeBuild("../WeaverInterface") diff --git a/LARAI/src/org/lara/interpreter/weaver/defaultweaver/DefaultWeaver.java b/DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/DefaultWeaver.java similarity index 83% rename from LARAI/src/org/lara/interpreter/weaver/defaultweaver/DefaultWeaver.java rename to DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/DefaultWeaver.java index 3e9258460..6d423a371 100644 --- a/LARAI/src/org/lara/interpreter/weaver/defaultweaver/DefaultWeaver.java +++ b/DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/DefaultWeaver.java @@ -12,7 +12,14 @@ */ package org.lara.interpreter.weaver.defaultweaver; -import org.lara.interpreter.utils.LaraIUtils; +import static org.lara.interpreter.weaver.defaultweaver.specification.DefaultWeaverResource.ACTIONS; +import static org.lara.interpreter.weaver.defaultweaver.specification.DefaultWeaverResource.ARTIFACTS; +import static org.lara.interpreter.weaver.defaultweaver.specification.DefaultWeaverResource.JOINPOINTS; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + import org.lara.interpreter.weaver.defaultweaver.abstracts.weaver.ADefaultWeaver; import org.lara.interpreter.weaver.defaultweaver.gears.TestGear; import org.lara.interpreter.weaver.defaultweaver.joinpoints.DWorkspace; @@ -23,9 +30,7 @@ import org.lara.language.specification.dsl.LanguageSpecification; import org.suikasoft.jOptions.Interfaces.DataStore; -import java.io.File; -import java.util.ArrayList; -import java.util.List; +import pt.up.fe.specs.lara.langspec.LangSpecsXmlParser; /** * Abstract Weaver Implementation for DefaultWeaver. The implementation of the abstract methods is mandatory! @@ -75,13 +80,8 @@ public boolean close() { return true; } - /** - * Returns the program root to be used by the weaver for the selects - * - * @return interface implementation for the join point root/program - */ @Override - public JoinPoint select() { + public JoinPoint getRootJp() { return root; } @@ -116,9 +116,19 @@ public List getOptions() { return options; } + /** + * Creates the default language specification + * + * @return + */ + public static LanguageSpecification createDefaultLanguageSpecification() { + // TODO: Why validate is false? + return LangSpecsXmlParser.parse(JOINPOINTS, ARTIFACTS, ACTIONS, false); + } + @Override protected LanguageSpecification buildLangSpecs() { - return LaraIUtils.createDefaultLanguageSpecification(); + return DefaultWeaver.createDefaultLanguageSpecification(); } public void ensureThatContains(File appFolder) { @@ -127,8 +137,6 @@ public void ensureThatContains(File appFolder) { @Override public String getName() { - - // return Optional.of("Lara Interpreter User Interface"); return "LaraI"; } diff --git a/DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/gears/TestGear.java b/DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/gears/TestGear.java new file mode 100644 index 000000000..230d56b1a --- /dev/null +++ b/DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/gears/TestGear.java @@ -0,0 +1,61 @@ +/** + * Copyright 2014 SPeCS Research Group. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. under the License. + */ + +package org.lara.interpreter.weaver.defaultweaver.gears; + +import org.lara.interpreter.weaver.interf.AGear; +import org.lara.interpreter.weaver.interf.events.data.ActionEvent; + +/** + * @author Tiago + * + */ +public class TestGear extends AGear { + + private boolean debug; + + public TestGear() { + setDebug(false); + } + + /* + * (non-Javadoc) + * + * @see + * org.lara.interpreter.weaver.interf.AGear#onAction(org.lara.interpreter. + * weaver.interf.events.data.ActionEvent) + */ + @Override + public void onAction(ActionEvent data) { + if (debug) { + System.out.println("On Action - " + data.toString()); + } + + } + + /** + * @return the debug + */ + public boolean isDebug() { + return debug; + } + + /** + * @param debug + * the debug to set + */ + public void setDebug(boolean debug) { + this.debug = debug; + } + +} diff --git a/DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWFile.java b/DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWFile.java new file mode 100644 index 000000000..0418960a0 --- /dev/null +++ b/DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWFile.java @@ -0,0 +1,40 @@ +/* + * Copyright 2013 SPeCS. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. under the License. + */ +package org.lara.interpreter.weaver.defaultweaver.joinpoints; + +import java.io.File; +import org.lara.interpreter.weaver.defaultweaver.abstracts.joinpoints.AFile; + +public class DWFile extends AFile { + + private final File file; + + public DWFile(File f) { + file = f; + } + + @Override + public String getNameImpl() { + return file.getName(); + } + + @Override + public String getAbsolutePathImpl() { + return file.getAbsolutePath(); + } + + @Override + public Object getNode() { + return getName(); + } +} diff --git a/LARAI/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWFolder.java b/DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWFolder.java similarity index 77% rename from LARAI/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWFolder.java rename to DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWFolder.java index ab777a0af..d0dd20b6d 100644 --- a/LARAI/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWFolder.java +++ b/DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWFolder.java @@ -16,7 +16,6 @@ import java.util.ArrayList; import java.util.List; -import org.lara.interpreter.weaver.defaultweaver.abstracts.joinpoints.AFile; import org.lara.interpreter.weaver.defaultweaver.abstracts.joinpoints.AFolder; public class DWFolder extends AFolder { @@ -31,11 +30,6 @@ public DWFolder(File source) { createFiles(source); } - @Override - public List selectFile() { - return files; - } - public void createFiles(File folder) { for (final File f : folder.listFiles()) { @@ -49,20 +43,11 @@ public void createFiles(File folder) { @Override public Object getNode() { - // TODO Auto-generated method stub return path; } - // @Override - // public boolean same(JoinPoint iJoinPoint) { - // if (!(iJoinPoint instanceof DWFolder)) - // return false; - // return this.path.equals(((DWFolder) iJoinPoint).path); - // } - @Override public String getPathImpl() { - // TODO Auto-generated method stub return path; } } diff --git a/LARAI/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWFunction.java b/DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWFunction.java similarity index 100% rename from LARAI/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWFunction.java rename to DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWFunction.java diff --git a/LARAI/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWorkspace.java b/DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWorkspace.java similarity index 82% rename from LARAI/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWorkspace.java rename to DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWorkspace.java index c910e7c42..7960185bb 100644 --- a/LARAI/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWorkspace.java +++ b/DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/joinpoints/DWorkspace.java @@ -16,13 +16,10 @@ package org.lara.interpreter.weaver.defaultweaver.joinpoints; import java.io.File; -import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; -import java.util.List; import java.util.Map; -import org.lara.interpreter.weaver.defaultweaver.abstracts.joinpoints.AFolder; import org.lara.interpreter.weaver.defaultweaver.abstracts.joinpoints.AWorkspace; import pt.up.fe.specs.util.SpecsIo; @@ -39,16 +36,6 @@ public DWorkspace() { folders = new HashMap<>(); } - /* - * (non-Javadoc) - * - * @see defaultweaver.joinpoints.abstracts.AProgramRoot#selectFolder() - */ - @Override - public List selectFolder() { - return new ArrayList(folders.values()); - } - public void addFolder(File dir) { File canonicalFile = SpecsIo.getCanonicalFile(dir.getAbsoluteFile()); if (!folders.containsKey(canonicalFile)) { diff --git a/LARAI/src/org/lara/interpreter/weaver/defaultweaver/options/DefaulWeaverKeys.java b/DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/options/DefaulWeaverKeys.java similarity index 100% rename from LARAI/src/org/lara/interpreter/weaver/defaultweaver/options/DefaulWeaverKeys.java rename to DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/options/DefaulWeaverKeys.java diff --git a/LARAI/src/org/lara/interpreter/weaver/defaultweaver/options/DefaultWeaverOption.java b/DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/options/DefaultWeaverOption.java similarity index 100% rename from LARAI/src/org/lara/interpreter/weaver/defaultweaver/options/DefaultWeaverOption.java rename to DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/options/DefaultWeaverOption.java diff --git a/LARAI/src/org/lara/interpreter/weaver/defaultweaver/report/Report.java b/DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/report/Report.java similarity index 100% rename from LARAI/src/org/lara/interpreter/weaver/defaultweaver/report/Report.java rename to DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/report/Report.java diff --git a/LARAI/src/org/lara/interpreter/weaver/defaultweaver/specification/DefaultWeaverResource.java b/DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/specification/DefaultWeaverResource.java similarity index 100% rename from LARAI/src/org/lara/interpreter/weaver/defaultweaver/specification/DefaultWeaverResource.java rename to DefaultWeaver/src/org/lara/interpreter/weaver/defaultweaver/specification/DefaultWeaverResource.java diff --git a/LARAC/.classpath b/LARAC/.classpath deleted file mode 100644 index 78381cc78..000000000 --- a/LARAC/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/LARAC/.project b/LARAC/.project deleted file mode 100644 index 26995935b..000000000 --- a/LARAC/.project +++ /dev/null @@ -1,41 +0,0 @@ - - - LARAC - JavaCC Nature - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - sf.eclipse.javacc.core.javaccbuilder - - - - - - org.eclipse.jdt.core.javanature - sf.eclipse.javacc.core.javaccnature - org.apache.ivyde.eclipse.ivynature - org.eclipse.buildship.core.gradleprojectnature - - - - 1665246567161 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/LARAC/.settings/sf.eclipse.javacc.prefs~ b/LARAC/.settings/sf.eclipse.javacc.prefs~ deleted file mode 100644 index 103017c84..000000000 --- a/LARAC/.settings/sf.eclipse.javacc.prefs~ +++ /dev/null @@ -1,16 +0,0 @@ -CLEAR_CONSOLE=true -JAVACC_OPTIONS= -JJDOC_OPTIONS= -JJTREE_OPTIONS= -JJ_NATURE=true -JTB_OPTIONS=-ia -jd -tk -MARK_GEN_FILES_AS_DERIVED=true -<<<<<<< HEAD -RUNTIME_JJJAR=/usr/share/java/javacc.jar -RUNTIME_JTBJAR=${eclipse_home}/plugins/sf.eclipse.javacc_1.5.27/jtb-1.4.7.jar -======= -RUNTIME_JJJAR=${project_loc\:/Support}/libs/javacc/sf.eclipse.javacc_1.5.27/javacc.jar -RUNTIME_JTBJAR=${project_loc\:/Support}/libs/javacc/sf.eclipse.javacc_1.5.27/jtb-1.4.7.jar ->>>>>>> 1e903401174c0cbbed49174a0df044b8954d4179 -SUPPRESS_WARNINGS=true -eclipse.preferences.version=1 diff --git a/LARAC/ant/WeaverGenerator_cetus.xml b/LARAC/ant/WeaverGenerator_cetus.xml deleted file mode 100644 index a64b40c37..000000000 --- a/LARAC/ant/WeaverGenerator_cetus.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/LARAC/ant/lara_Weaver.xml b/LARAC/ant/lara_Weaver.xml deleted file mode 100644 index e602f7c0c..000000000 --- a/LARAC/ant/lara_Weaver.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/LARAC/build.gradle b/LARAC/build.gradle deleted file mode 100644 index 25101b125..000000000 --- a/LARAC/build.gradle +++ /dev/null @@ -1,65 +0,0 @@ -plugins { - id 'distribution' -} - -// Java project -apply plugin: 'java' - -java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 -} - - -// Repositories providers -repositories { - mavenCentral() -} - -dependencies { - testImplementation "junit:junit:4.13.1" - - implementation ":CommonsCompressPlus" - implementation ":CommonsLangPlus" - implementation ":SpecsUtils" - implementation ":tdrcLibrary" - - implementation ":LaraUtils" - implementation ":LanguageSpecification" - implementation ":WeaverInterface" - - - implementation group: 'commons-cli', name: 'commons-cli', version: '1.3.1' - implementation group: 'commons-io', name: 'commons-io', version: '2.4' - implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.5' - implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1' -} - -java { - withSourcesJar() -} - -// Project sources -sourceSets { - main { - java { - srcDir 'src' - } - - resources { - srcDir 'resources' - } - } - - - test { - java { - srcDir 'test' - } - - resources { - srcDir 'resources' - } - } - -} diff --git a/LARAC/commands.build b/LARAC/commands.build deleted file mode 100644 index 87192cf1b..000000000 --- a/LARAC/commands.build +++ /dev/null @@ -1,9 +0,0 @@ -# System commands to be executed before compiling this project - -# Create .jj from .jjt -# Could not set output directory of jjtree, setting working directory instead -[dir=src/org/dojo/jsl/parser/] java -cp ../../../../../../Support/javacc/javacc-5.jar jjtree LARAEcmaScript.jjt - -# Create grammar from .jj -[dir=src/org/dojo/jsl/parser/ast] java -cp ../../../../../../../Support/javacc/javacc-5.jar javacc LARAEcmaScript.jj - diff --git a/LARAC/deploy/LaraC-deploy.launch b/LARAC/deploy/LaraC-deploy.launch deleted file mode 100644 index 4ce8a21a8..000000000 --- a/LARAC/deploy/LaraC-deploy.launch +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/LARAC/deploy/LaraC.deploy b/LARAC/deploy/LaraC.deploy deleted file mode 100644 index 6150c8ad6..000000000 --- a/LARAC/deploy/LaraC.deploy +++ /dev/null @@ -1,110 +0,0 @@ - - - - NameOfOutputJar - - larac.jar - string - - - - ClassWithMain - - larac.LARACLauncher - string - - - - Tasks - - - - - - - OutputJarFilename - - larac.jar - string - - - - Port - - 22 - string - - - - UserPass - - SpecS#12345 - string - - - - Host - - specs.fe.up.pt - string - - - - DestinationFolder - - /var/www/html/tools - string - - - - UserLogin - - root - string - - - - CommandsFile - - - string - - - - SFTP Task - - - - - SFTP Task - - - - - setupList - - - - ProjectName - - LARAC - string - - - - OutputJarType - - RepackJar - multipleChoice - - - - WorkspaceFolder - - - string - - - - EclipseDeployment - \ No newline at end of file diff --git a/LARAC/diagrams/CD.cld b/LARAC/diagrams/CD.cld deleted file mode 100644 index 855800fef..000000000 --- a/LARAC/diagrams/CD.cld +++ /dev/null @@ -1,1564 +0,0 @@ - - - - 255 - 255 - 206 - - - 0 - 0 - 0 - - true - - - - - 2 - - - - - - - - - - 255 - 255 - 206 - - - 0 - 0 - 0 - - true - - - - true - - - - - 2 - - - - - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 178 - 308 - - - - true - - - - - 2 - - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 173 - 130 - - - - true - - - - - 2 - - - - - - - - - - - - - true - - - - - 2 - - - - - - - - - - - - - - - - - - - - true - - - - - - 2 - - - - - - compile - Document - - false - false - - - - - true - - - - - - 2 - - - - - - parse - void - - false - false - - - - - true - - - - - - 2 - - - - - - toAspectIR - void - - false - false - - - - - true - - - - - - 2 - - - - - - createXML - void - - false - false - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - LaraC - false - - - - - - - - - - true - - - - - 2 - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 211 - 452 - - - - - true - - - - - 2 - - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 453 - 269 - - - - - true - - - - - 2 - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 571 - 450 - - - - - true - - - - - 2 - - - - - - - - - - - - true - - - - - 2 - - - - - - - 255 - 255 - 206 - - - 0 - 0 - 0 - - true - - - - true - - - - - 2 - - - - - - - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 907 - 452 - - - - true - - - - - 2 - - - - - - - - - - - - true - - - - - 2 - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 734 - 452 - - - - - true - - - - - 2 - - - - - - - - - - - - - true - - - - - 2 - - - - - - - - - - - - - true - - - - - 2 - - - - - - - - - - - - - true - - - - - 2 - - - - - - - - - - - - - true - - - - - 2 - - - - - - - - - - - - - true - - - - - 2 - - - - - - - - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - ASTSelect - false - - - - - - - - - - - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - ASTApply - false - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 381 - 452 - - - - true - - - - - 2 - - - - - - - - - - - - true - - - - - 2 - - - - - - - - - - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - ASTPointcut - false - - - - - - - - - - - - - 2 - - - - - - -1 - -1 - 528 - 587 - - - - - - - - true - - - - - 2 - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 402 - 719 - - - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - JoinPointModel - false - - - - - - - - - true - - - - - 2 - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 552 - 719 - - - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - ArtifactsModel - false - - - - - - - - - true - - - - - 2 - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 700 - 719 - - - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - ActionModel - false - - - - - - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - LanguageSpecification - false - - - - - - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - ASTInsert - false - - - - - - - - - - - - - - - true - - - - - - 2 - - - - - - organize - Object - - - obj - Object - - - false - false - - - - - true - - - - - - 2 - - - - - - toXML - void - - - doc - Document - - - parent - Element - - - false - false - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - SimpleNode - false - - - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - ASTStart - false - - - - - - - - - - - - - - true - - - - - - 2 - - - - - - organize - void - - false - false - - - - - true - - - - - - 2 - - - - - - toXML - Document - - false - false - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - AspectIR - false - - - - - - - - - - - - - - - - 2 - - - - - - -1 - -1 - 1 - 28 - - - - - - - - - - true - - - - - - 2 - - - - - - exec - int - - - args - String[] - - - langSpec - LanguageSpecification - - - output - Output - - - false - true - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - LARACLauncher - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/LARAC/diagrams/Class.atxa b/LARAC/diagrams/Class.atxa deleted file mode 100644 index 0577f00bd..000000000 --- a/LARAC/diagrams/Class.atxa +++ /dev/null @@ -1,282 +0,0 @@ -@prefix rdf: . -@prefix atxa-jdt: . -@prefix atxa-rse-eclipse: . -@prefix atxa-core: . -@prefix atxa: . -@prefix atxa-jdt-wkspc: . - - a atxa-core:reloFile . - -atxa:DetailNode atxa-core:detailLevel "1" . - -atxa-core:docRoot atxa-core:browseModel "com.architexa.diagrams.relo.jdt/com.architexa.diagrams.relo.jdt.browse.ClassStrucBrowseModel" ; - atxa-core:contains _:node1abjppsp1x1 . - -_:node1abjppsp1x1 a atxa-core:node ; - atxa-core:model atxa-jdt-wkspc:larac ; - atxa-core:posX "-33" ; - atxa-core:posY "-111" . - -atxa-jdt-wkspc:larac atxa-core:contains , . - -_:node1abjppsp1x1 atxa-core:contains _:node1abjppsp1x2 . - -_:node1abjppsp1x2 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "-27" ; - atxa-core:posY "-56" . - - atxa-core:contains . - -_:node1abjppsp1x3 a atxa-core:link ; - atxa-core:model atxa-jdt:refType ; - rdf:subject _:node1abjppsp1x2 ; - rdf:object _:node1abjppsp1x4 . - -_:node1abjppsp1x2 atxa-core:contains _:node1abjppsp1x5 . - -_:node1abjppsp1x5 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "-26" ; - atxa-core:posY "-37" . - -_:node1abjppsp1x1 atxa-core:contains _:node1abjppsp1x4 . - -_:node1abjppsp1x4 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "425" ; - atxa-core:posY "-85" . - - atxa-core:contains , , , . - -_:node1abjppsp1x6 a atxa-core:link ; - atxa-core:model atxa-jdt:refType ; - rdf:subject _:node1abjppsp1x4 ; - rdf:object _:node1abjppsp1x7 . - -_:node1abjppsp1x4 atxa-core:contains _:node1abjppsp1x8 . - -_:node1abjppsp1x8 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "426" ; - atxa-core:posY "-66" . - -_:node1abjppsp1x4 atxa-core:contains _:node1abjppsp1x9 . - -_:node1abjppsp1x9 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "426" ; - atxa-core:posY "-49" . - -_:node1abjppsp1x4 atxa-core:contains _:node1abjppsp1x10 . - -_:node1abjppsp1x10 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "426" ; - atxa-core:posY "-32" . - -_:node1abjppsp1x4 atxa-core:contains _:node1abjppsp1x11 . - -_:node1abjppsp1x11 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "426" ; - atxa-core:posY "-15" . - -atxa-core:docRoot atxa-core:contains _:node1abjppsp1x12 . - -_:node1abjppsp1x12 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "-41" ; - atxa-core:posY "149" . - - atxa-core:contains , , , , , . - -_:node1abjppsp1x12 atxa-core:contains _:node1abjppsp1x13 . - -_:node1abjppsp1x13 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "-35" ; - atxa-core:posY "273" . - -_:node1abjppsp1x14 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjppsp1x13 ; - rdf:object _:node1abjppsp1x15 ; - atxa-core:bendpoint _:node1abjpmri8x2954 . - -_:node1abjpmri8x2954 atxa-core:bpLocation "22,232" ; - atxa-core:bpIndex "0" . - -_:node1abjppsp1x14 atxa-core:bendpoint _:node1abjpmri8x2955 . - -_:node1abjpmri8x2955 atxa-core:bpLocation "278,232" ; - atxa-core:bpIndex "1" . - -_:node1abjppsp1x12 atxa-core:contains _:node1abjppsp1x18 . - -_:node1abjppsp1x18 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "335" ; - atxa-core:posY "271" . - -_:node1abjppsp1x19 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjppsp1x18 ; - rdf:object _:node1abjppsp1x15 ; - atxa-core:bendpoint _:node1abjpmri8x2956 . - -_:node1abjpmri8x2956 atxa-core:bpLocation "390,232" ; - atxa-core:bpIndex "0" . - -_:node1abjppsp1x19 atxa-core:bendpoint _:node1abjpmri8x2957 . - -_:node1abjpmri8x2957 atxa-core:bpLocation "278,232" ; - atxa-core:bpIndex "1" . - -_:node1abjppsp1x12 atxa-core:contains _:node1abjppsp1x22 . - -_:node1abjppsp1x22 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "222" ; - atxa-core:posY "270" . - -_:node1abjppsp1x23 a atxa-core:link ; - atxa-core:model atxa-jdt:refType ; - rdf:subject _:node1abjppsp1x22 ; - rdf:object _:node1abjppsp1x24 . - -_:node1abjppsp1x25 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjppsp1x22 ; - rdf:object _:node1abjppsp1x15 ; - atxa-core:bendpoint _:node1abjpmri8x2958 . - -_:node1abjpmri8x2958 atxa-core:bpLocation "278,232" ; - atxa-core:bpIndex "0" . - -_:node1abjppsp1x12 atxa-core:contains _:node1abjppsp1x27 . - -_:node1abjppsp1x27 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "450" ; - atxa-core:posY "272" . - -_:node1abjppsp1x28 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjppsp1x27 ; - rdf:object _:node1abjppsp1x15 ; - atxa-core:bendpoint _:node1abjpmri8x2959 . - -_:node1abjpmri8x2959 atxa-core:bpLocation "503,232" ; - atxa-core:bpIndex "0" . - -_:node1abjppsp1x28 atxa-core:bendpoint _:node1abjpmri8x2960 . - -_:node1abjpmri8x2960 atxa-core:bpLocation "278,232" ; - atxa-core:bpIndex "1" . - -_:node1abjppsp1x12 atxa-core:contains _:node1abjppsp1x15 . - -_:node1abjppsp1x15 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "172" ; - atxa-core:posY "175" . - - atxa-core:contains . - -_:node1abjppsp1x15 atxa-core:contains _:node1abjppsp1x31 . - -_:node1abjppsp1x31 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "173" ; - atxa-core:posY "194" . - -_:node1abjppsp1x12 atxa-core:contains _:node1abjppsp1x32 . - -_:node1abjppsp1x32 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "83" ; - atxa-core:posY "271" . - -_:node1abjppsp1x33 a atxa-core:link ; - atxa-core:model atxa-jdt:refType ; - rdf:subject _:node1abjppsp1x32 ; - rdf:object _:node1abjppsp1x24 . - -_:node1abjppsp1x34 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjppsp1x32 ; - rdf:object _:node1abjppsp1x15 ; - atxa-core:bendpoint _:node1abjpmri8x2961 . - -_:node1abjpmri8x2961 atxa-core:bpLocation "148,232" ; - atxa-core:bpIndex "0" . - -_:node1abjppsp1x34 atxa-core:bendpoint _:node1abjpmri8x2962 . - -_:node1abjpmri8x2962 atxa-core:bpLocation "278,232" ; - atxa-core:bpIndex "1" . - -atxa-core:docRoot atxa-core:contains _:node1abjppsp1x37 . - -_:node1abjppsp1x37 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "424" ; - atxa-core:posY "40" . - - atxa-core:contains . - -_:node1abjppsp1x37 atxa-core:contains _:node1abjppsp1x7 . - -_:node1abjppsp1x7 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "430" ; - atxa-core:posY "66" . - - atxa-core:contains , . - -_:node1abjppsp1x38 a atxa-core:link ; - atxa-core:model atxa-jdt:refType ; - rdf:subject _:node1abjppsp1x7 ; - rdf:object _:node1abjppsp1x27 . - -_:node1abjppsp1x7 atxa-core:contains _:node1abjppsp1x39 . - -_:node1abjppsp1x39 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "431" ; - atxa-core:posY "85" . - -_:node1abjppsp1x7 atxa-core:contains _:node1abjppsp1x40 . - -_:node1abjppsp1x40 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "431" ; - atxa-core:posY "102" . - -atxa-core:docRoot atxa-core:contains _:node1abjppsp1x41 . - -_:node1abjppsp1x41 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "123" ; - atxa-core:posY "357" . - - atxa-core:contains . - -_:node1abjppsp1x41 atxa-core:contains _:node1abjppsp1x24 . - -_:node1abjppsp1x24 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "129" ; - atxa-core:posY "383" . - -@prefix rdf: . -@prefix atxa-jdt: . -@prefix atxa-rse-eclipse: . -@prefix atxa-core: . -@prefix atxa: . -@prefix atxa-jdt-wkspc: . - - a atxa-core:reloFile ; - atxa-core:contains _:node1abjppsp1x5 , _:node1abjppsp1x2 , _:node1abjppsp1x8 , _:node1abjppsp1x9 , _:node1abjppsp1x10 , _:node1abjppsp1x11 , _:node1abjppsp1x4 , _:node1abjppsp1x1 , _:node1abjppsp1x13 , _:node1abjppsp1x18 , _:node1abjppsp1x22 , _:node1abjppsp1x27 , _:node1abjppsp1x31 , _:node1abjppsp1x15 , _:node1abjppsp1x32 , _:node1abjppsp1x12 , _:node1abjppsp1x39 , _:node1abjppsp1x40 , _:node1abjppsp1x7 , _:node1abjppsp1x37 , _:node1abjppsp1x24 , _:node1abjppsp1x41 , atxa-core:docRoot , _:node1abjppsp1x5 , _:node1abjppsp1x2 , _:node1abjppsp1x8 , _:node1abjppsp1x9 , _:node1abjppsp1x10 , _:node1abjppsp1x11 , _:node1abjppsp1x4 , _:node1abjppsp1x1 , _:node1abjppsp1x13 , _:node1abjppsp1x18 , _:node1abjppsp1x22 , _:node1abjppsp1x27 , _:node1abjppsp1x31 , _:node1abjppsp1x15 , _:node1abjppsp1x32 , _:node1abjppsp1x12 , _:node1abjppsp1x39 , _:node1abjppsp1x40 , _:node1abjppsp1x7 , _:node1abjppsp1x37 , _:node1abjppsp1x24 , _:node1abjppsp1x41 , atxa-core:docRoot , _:node1abjppsp1x3 , _:node1abjppsp1x6 , _:node1abjppsp1x14 , _:node1abjppsp1x19 , _:node1abjppsp1x23 , _:node1abjppsp1x25 , _:node1abjppsp1x28 , _:node1abjppsp1x33 , _:node1abjppsp1x34 , _:node1abjppsp1x38 , _:node1abjppsp1x3 , _:node1abjppsp1x6 , _:node1abjppsp1x14 , _:node1abjppsp1x19 , _:node1abjppsp1x23 , _:node1abjppsp1x25 , _:node1abjppsp1x28 , _:node1abjppsp1x33 , _:node1abjppsp1x34 , _:node1abjppsp1x38 . - diff --git a/LARAC/diagrams/Layered.atxa b/LARAC/diagrams/Layered.atxa deleted file mode 100644 index 06497c678..000000000 --- a/LARAC/diagrams/Layered.atxa +++ /dev/null @@ -1,138 +0,0 @@ -@prefix rdf: . -@prefix atxa-rse-eclipse: . -@prefix atxa-strata: . -@prefix atxa-core: . -@prefix atxa: . -@prefix atxa-jdt-wkspc: . - - a atxa-core:strataFile . - -atxa:DetailNode atxa-core:detailLevel "0" . - -atxa-core:docRoot atxa-core:browseModel "com.architexa.diagrams.relo.jdt/com.architexa.diagrams.relo.jdt.browse.ClassStrucBrowseModel" ; - atxa-core:contains _:node1abirdjcqx41414 . - -_:node1abirdjcqx41414 a atxa-core:node ; - atxa-core:model ; - atxa-strata:nestedLayerIndexes ":0,false,false,true:0,false,false,true" ; - atxa-strata:layerIndex "0" ; - atxa-strata:indexWithinLayer "0" ; - atxa-core:containerState "true" , "true" , "false" . - - atxa-core:contains atxa-jdt-wkspc:larac , . - -_:node1abirdjcqx41414 atxa-core:contains _:node1abirdjcqx41415 . - -_:node1abirdjcqx41415 a atxa-core:node ; - atxa-core:model atxa-jdt-wkspc:larac ; - atxa-strata:nestedLayerIndexes ":0,false,false,true:0,false,false,true" ; - atxa-strata:layerIndex "0" ; - atxa-strata:indexWithinLayer "0" ; - atxa-core:containerState "true" , "false" , "false" . - -atxa-jdt-wkspc:larac atxa-core:contains , . - -_:node1abirdjcqx41415 atxa-core:contains _:node1abirdjcqx41416 . - -_:node1abirdjcqx41416 a atxa-core:node ; - atxa-core:model ; - atxa-strata:nestedLayerIndexes ":0,false,false,false:1,false,false,false:0,false,true,true" ; - atxa-strata:layerIndex "0" ; - atxa-strata:indexWithinLayer "-1" ; - atxa-core:containerState "false" , "true" , "false" . - -_:node1abirdjcqx41415 atxa-core:contains _:node1abirdjcqx41417 . - -_:node1abirdjcqx41417 a atxa-core:node ; - atxa-core:model ; - atxa-strata:nestedLayerIndexes ":0,false,false,true:0,false,false,true:0,false,true,true" ; - atxa-strata:layerIndex "0" ; - atxa-strata:indexWithinLayer "-1" ; - atxa-core:containerState "false" , "false" , "false" . - -_:node1abirdjcqx41414 atxa-core:contains _:node1abirdjcqx41418 . - -_:node1abirdjcqx41418 a atxa-core:node ; - atxa-core:model ; - atxa-strata:nestedLayerIndexes ":0,false,false,true:1,false,false,true" ; - atxa-strata:layerIndex "1" ; - atxa-strata:indexWithinLayer "0" ; - atxa-core:containerState "true" , "false" , "false" . - - atxa-core:contains . - -_:node1abirdjcqx41418 atxa-core:contains _:node1abirdjcqx41419 . - -_:node1abirdjcqx41419 a atxa-core:node ; - atxa-core:model ; - atxa-strata:nestedLayerIndexes ":0,false,false,true:0,false,false,true" ; - atxa-strata:layerIndex "0" ; - atxa-strata:indexWithinLayer "0" ; - atxa-core:containerState "false" , "false" , "false" . - -atxa-core:docRoot atxa-core:contains _:node1abirdjcqx41428 . - -_:node1abirdjcqx41428 a atxa-core:node ; - atxa-core:model ; - atxa-strata:nestedLayerIndexes ":1,false,false,true:0,false,false,true" ; - atxa-strata:layerIndex "0" ; - atxa-strata:indexWithinLayer "1" ; - atxa-core:containerState "true" , "false" , "false" . - - atxa-core:contains , , , , . - -_:node1abirdjcqx41428 atxa-core:contains _:node1abirdjcqx41429 . - -_:node1abirdjcqx41429 a atxa-core:node ; - atxa-core:model ; - atxa-strata:nestedLayerIndexes ":0,false,false,true:1,false,false,true" ; - atxa-strata:layerIndex "1" ; - atxa-strata:indexWithinLayer "0" ; - atxa-core:containerState "false" , "false" , "false" . - -_:node1abirdjcqx41428 atxa-core:contains _:node1abirdjcqx41550 . - -_:node1abirdjcqx41550 a atxa-core:node ; - atxa-core:model ; - atxa-strata:nestedLayerIndexes ":0,false,false,true:0,false,false,true" ; - atxa-strata:layerIndex "0" ; - atxa-strata:indexWithinLayer "0" ; - atxa-core:containerState "false" , "true" , "false" . - -_:node1abirdjcqx41428 atxa-core:contains _:node1abirdjcqx41551 . - -_:node1abirdjcqx41551 a atxa-core:node ; - atxa-core:model ; - atxa-strata:nestedLayerIndexes ":1,false,false,true:1,false,false,true" ; - atxa-strata:layerIndex "1" ; - atxa-strata:indexWithinLayer "1" ; - atxa-core:containerState "false" , "true" , "false" . - -_:node1abirdjcqx41428 atxa-core:contains _:node1abirdjcqx41552 . - -_:node1abirdjcqx41552 a atxa-core:node ; - atxa-core:model ; - atxa-strata:nestedLayerIndexes ":0,false,false,true:2,false,false,true" ; - atxa-strata:layerIndex "2" ; - atxa-strata:indexWithinLayer "0" ; - atxa-core:containerState "false" , "true" , "false" . - -_:node1abirdjcqx41428 atxa-core:contains _:node1abirdjcqx41553 . - -_:node1abirdjcqx41553 a atxa-core:node ; - atxa-core:model ; - atxa-strata:nestedLayerIndexes ":1,false,false,true:2,false,false,true" ; - atxa-strata:layerIndex "2" ; - atxa-strata:indexWithinLayer "1" ; - atxa-core:containerState "false" , "true" , "false" . - -@prefix rdf: . -@prefix atxa-rse-eclipse: . -@prefix atxa-strata: . -@prefix atxa-core: . -@prefix atxa: . -@prefix atxa-jdt-wkspc: . - - a atxa-core:strataFile ; - atxa-core:contains _:node1abirdjcqx41416 , _:node1abirdjcqx41417 , _:node1abirdjcqx41415 , _:node1abirdjcqx41419 , _:node1abirdjcqx41418 , _:node1abirdjcqx41414 , _:node1abirdjcqx41429 , _:node1abirdjcqx41550 , _:node1abirdjcqx41551 , _:node1abirdjcqx41552 , _:node1abirdjcqx41553 , _:node1abirdjcqx41428 , atxa-core:docRoot , _:node1abirdjcqx41416 , _:node1abirdjcqx41417 , _:node1abirdjcqx41415 , _:node1abirdjcqx41419 , _:node1abirdjcqx41418 , _:node1abirdjcqx41414 , _:node1abirdjcqx41429 , _:node1abirdjcqx41550 , _:node1abirdjcqx41551 , _:node1abirdjcqx41552 , _:node1abirdjcqx41553 , _:node1abirdjcqx41428 , atxa-core:docRoot . - diff --git a/LARAC/ivy.xml b/LARAC/ivy.xml deleted file mode 100644 index 9b9263643..000000000 --- a/LARAC/ivy.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/LARAC/launchers/[LARAC]Test.launch b/LARAC/launchers/[LARAC]Test.launch deleted file mode 100644 index 09bdcc535..000000000 --- a/LARAC/launchers/[LARAC]Test.launch +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/LARAC/settings.gradle b/LARAC/settings.gradle deleted file mode 100644 index 6039c042d..000000000 --- a/LARAC/settings.gradle +++ /dev/null @@ -1,10 +0,0 @@ -rootProject.name = 'LARAC' - -includeBuild("../../specs-java-libs/CommonsCompressPlus") -includeBuild("../../specs-java-libs/CommonsLangPlus") -includeBuild("../../specs-java-libs/SpecsUtils") -includeBuild("../../specs-java-libs/tdrcLibrary") - -includeBuild("../../lara-framework/LanguageSpecification") -includeBuild("../../lara-framework/LaraUtils") -includeBuild("../../lara-framework/WeaverInterface") diff --git a/LARAC/src/applet/GUI.java b/LARAC/src/applet/GUI.java deleted file mode 100644 index 7c64cd49d..000000000 --- a/LARAC/src/applet/GUI.java +++ /dev/null @@ -1,813 +0,0 @@ -package applet; - -import java.applet.Applet; -import java.awt.Button; -import java.awt.Checkbox; -import java.awt.Choice; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Event; -import java.awt.Frame; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.Label; -import java.awt.Panel; -import java.awt.TextArea; -import java.awt.TextField; -import java.awt.Toolkit; -import java.awt.event.ComponentEvent; -import java.awt.event.ComponentListener; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.PrintStream; -import java.security.Permission; -import java.util.HashMap; - -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; - -import org.dojo.jsl.parser.ast.LARAEcmaScript; -import org.dojo.jsl.parser.ast.SimpleNode; - -import larac.exceptions.LARACompilerException; -import larac.utils.FileUtils; -import larac.utils.FileUtils.Commands; - -/** - * - * @deprecated Bispo: It seems is not been used, nor there are plans to use it - * - */ -@Deprecated -class errorReport extends Frame { - - /** - * - */ - private static final long serialVersionUID = 1L; - int factor = 50; - - public errorReport(String error) { - final GridBagLayout gbl = new GridBagLayout(); - final GridBagConstraints gbcon = new GridBagConstraints(); - final int width = GUI.window_Width * 2 / 3; - int height = error.split("\n").length * this.factor; - int lines = height / this.factor; - if (height > GUI.window_Height) { - lines = lines * GUI.window_Height / (height * 1 / 2); - height = GUI.window_Height; - } - setSize(width, height); - final Toolkit tk = Toolkit.getDefaultToolkit(); - final Dimension screenSize = tk.getScreenSize(); - final int screenHeight = screenSize.height; - final int screenWidth = screenSize.width; - // setSize(screenWidth / 2, screenHeight / 2); - setLocation(screenWidth / 2 - width / 2, screenHeight / 2 - height / 2); - final Label l = new Label("AspectIR"); - final TextArea ta = new TextArea(error, lines, (int) Math.round(GUI.areaWidth * 2.5 / 4), - TextArea.SCROLLBARS_VERTICAL_ONLY); - - // ta.setSize(width,height); - gbcon.anchor = GridBagConstraints.NORTH; - gbcon.gridx = 0; - gbcon.gridy = 0; - gbl.setConstraints(l, gbcon); - add(l); - gbcon.gridy = 1; - gbl.setConstraints(ta, gbcon); - add(ta); - setLayout(gbl); - addWindowListener(new WindowListener() { - - @Override - public void windowOpened(WindowEvent e) { - } - - @Override - public void windowIconified(WindowEvent e) { - } - - @Override - public void windowDeiconified(WindowEvent e) { - } - - @Override - public void windowDeactivated(WindowEvent e) { - setVisible(false); - } - - @Override - public void windowClosing(WindowEvent e) { - setVisible(false); - } - - @Override - public void windowClosed(WindowEvent e) { - } - - @Override - public void windowActivated(WindowEvent e) { - } - }); - } -} - -class AspectIRPopup extends Frame { - /** - * - */ - private static final long serialVersionUID = 1L; - int factor = 50; - - public AspectIRPopup(String aspectIR) { - final GridBagLayout gbl = new GridBagLayout(); - final GridBagConstraints gbcon = new GridBagConstraints(); - final int width = GUI.window_Width * 2 / 3; - int height = aspectIR.split("\n").length * this.factor; - int lines = height / this.factor; - if (height > GUI.window_Height) { - lines = lines * GUI.window_Height / (height * 1 / 2); - height = GUI.window_Height; - } - setSize(width, height); - final Toolkit tk = Toolkit.getDefaultToolkit(); - final Dimension screenSize = tk.getScreenSize(); - final int screenHeight = screenSize.height; - final int screenWidth = screenSize.width; - // setSize(screenWidth / 2, screenHeight / 2); - setLocation(screenWidth / 2 - width / 2, screenHeight / 2 - height / 2); - final Label l = new Label("AspectIR"); - final TextArea ta = new TextArea(aspectIR, lines, (int) Math.round(GUI.areaWidth * 2.5 / 4), - TextArea.SCROLLBARS_VERTICAL_ONLY); - // ta.setSize(width,height); - gbcon.anchor = GridBagConstraints.NORTH; - gbcon.gridx = 0; - gbcon.gridy = 0; - gbl.setConstraints(l, gbcon); - add(l); - gbcon.gridy = 1; - gbl.setConstraints(ta, gbcon); - add(ta); - setLayout(gbl); - addWindowListener(new WindowListener() { - - @Override - public void windowOpened(WindowEvent e) { - } - - @Override - public void windowIconified(WindowEvent e) { - } - - @Override - public void windowDeiconified(WindowEvent e) { - } - - @Override - public void windowDeactivated(WindowEvent e) { - } - - @Override - public void windowClosing(WindowEvent e) { - setVisible(false); - } - - @Override - public void windowClosed(WindowEvent e) { - } - - @Override - public void windowActivated(WindowEvent e) { - } - }); - } -} - -class RunLara { - - private final String code; - private final boolean showAspectIR; - private final boolean interpret; - private final boolean showTree; - - private static class ExitTrappedException extends SecurityException { - - /** - * - */ - private static final long serialVersionUID = 1L; - } - - public RunLara(String code, boolean showAspectIR, boolean showIntepreter, boolean showTree, GUI app) { - this.code = code; - this.showAspectIR = showAspectIR; - this.interpret = showIntepreter; - this.showTree = showTree; - } - - public void run() { - - try { - - System.out.println("EcmaScript Parser: Reading from console"); - final InputStream is = new ByteArrayInputStream(this.code.getBytes("UTF-8")); - final LARAEcmaScript parser = new LARAEcmaScript(is); - final SimpleNode n = parser.Start(); - - System.out.println("LARAEcmaScript parser: EcmaScript program parsed successfully."); - if (this.interpret) { - - } - if (this.showAspectIR) { - final AspectIRPopup popup = new AspectIRPopup(n.dumpToString("")); - popup.setVisible(true); - } - if (this.showTree) { - - } - - // } catch (final ExitTrappedException e) { - } catch (final Exception e) { - throw new LARACompilerException("during GUI execution", e); - } - } -} - -class LowPanel extends Panel { - /** - * - */ - private static final long serialVersionUID = 1L; - Button save, saveAs, open, clear; - GUI app; - JFileChooser fc = new JFileChooser() { - /** - * - */ - private static final long serialVersionUID = 1L; - - @Override - public void approveSelection() { - final File f = getSelectedFile(); - if (f.exists() && getDialogType() == JFileChooser.SAVE_DIALOG) { - final int result = JOptionPane.showConfirmDialog(this, "The file exists, overwrite?", "Existing file", - JOptionPane.YES_NO_CANCEL_OPTION); - switch (result) { - case JOptionPane.YES_OPTION: - super.approveSelection(); - return; - case JOptionPane.NO_OPTION: - return; - case JOptionPane.CANCEL_OPTION: - cancelSelection(); - return; - default: - break; - } - } - super.approveSelection(); - } - }; - String filePathSave = ""; - - public LowPanel(GUI parent) { - this.app = parent; - final GridBagLayout gbl = new GridBagLayout(); - final GridBagConstraints gbcon = new GridBagConstraints(); - - initBottomBoxs(gbl, gbcon); - setLayout(gbl); - } - - private void initBottomBoxs(GridBagLayout gbl, GridBagConstraints gbcon) { - this.open = new Button("Open"); - this.open.setActionCommand(Commands.OPEN.toString()); - this.save = new Button("Save"); - this.save.setActionCommand(Commands.SAVE.toString()); - this.saveAs = new Button("SaveAs"); - this.saveAs.setActionCommand(Commands.SAVEAS.toString()); - this.clear = new Button("Clear"); - this.clear.setActionCommand(Commands.CLEAR.toString()); - gbcon.anchor = GridBagConstraints.WEST; - gbcon.gridx = 0; - gbcon.gridy = 0; - gbl.setConstraints(this.open, gbcon); - add(this.open); - gbcon.gridx = 1; - gbl.setConstraints(this.save, gbcon); - add(this.save); - gbcon.gridx = 2; - gbl.setConstraints(this.saveAs, gbcon); - add(this.saveAs); - gbcon.gridx = 3; - gbl.setConstraints(this.clear, gbcon); - add(this.clear); - } - - @Override - public boolean action(Event evt, Object arg) { - // new StringBuffer(50); - if (evt.target instanceof Button) { - final Button bt = (Button) evt.target; - final String command = bt.getActionCommand(); - this.fc.setCurrentDirectory(new File(".")); - switch (Commands.valueOf(command)) { - case SAVE: - if (!this.filePathSave.isEmpty()) { - FileUtils.toFile(this.filePathSave, "", this.app.console.code.getText(), new File(".")); - break; - } - //$FALL-THROUGH$ - case SAVEAS: - this.filePathSave = FileUtils.processSaveFileChooser(this.app, this.fc, FileUtils.aspectFilter, "Save", - JFileChooser.FILES_ONLY); - if (!this.filePathSave.isEmpty()) { - this.filePathSave += this.filePathSave.endsWith(".lara") ? "" : ".lara"; - FileUtils.toFile(this.filePathSave, "", this.app.console.code.getText(), new File(".")); - } - break; - case CLEAR: - this.filePathSave = ""; - this.app.console.code.setText(""); - break; - case OPEN: - final File f = FileUtils.processOpenFileChooser(this.app, this.fc, FileUtils.aspectFilter, "Open", - JFileChooser.FILES_ONLY); - this.filePathSave = f.getPath(); - this.app.console.code.setText(FileUtils.fromFile(f)); - break; - case ASPECT: - break; - case GENERATE: - break; - case LANGUAGE: - break; - case LOAD: - break; - case OUTPUT: - break; - case RESOURCE: - break; - case WORKSPACE: - break; - case XML: - break; - default: - break; - } - return true; - } - return false; - } -} - -class Console extends Panel { - - /** - * - */ - private static final long serialVersionUID = 1L; - - TextArea code; - - Button generate; - TextArea output; - GUI app; - PrintStream SystemOut = System.out; - - public Console(GUI parent) { - - this.app = parent; - final GridBagLayout gbl = new GridBagLayout(); - final GridBagConstraints gbcon = new GridBagConstraints(); - - initTxtBoxs(gbl, gbcon); - final OutputStream outStream = new OutputStream() { - - @Override - public void write(int b) throws IOException { - Console.this.output.append("" + (char) b); - } - }; - try (PrintStream printStream = new PrintStream(outStream);) { - System.setOut(printStream); - } - setLayout(gbl); - - } - - private void initTxtBoxs(GridBagLayout gbl, GridBagConstraints gbcon) { - this.code = new TextArea("aspectdef example\n\nend", GUI.areaHeight, (int) Math.round(GUI.areaWidth * 2.5 / 4), - TextArea.SCROLLBARS_VERTICAL_ONLY); - - this.generate = new Button("Generate"); - this.output = new TextArea("", GUI.areaHeight, (int) Math.round(GUI.areaWidth * 1.5 / 4), - TextArea.SCROLLBARS_VERTICAL_ONLY); - this.output.setEditable(false); - gbcon.gridx = 0; - gbcon.gridy = 0; - gbl.setConstraints(this.code, gbcon); - add(this.code); - gbcon.gridx = 1; - gbl.setConstraints(this.generate, gbcon); - add(this.generate); - gbcon.gridx = 2; - gbl.setConstraints(this.output, gbcon); - add(this.output); - } - - @Override - public boolean action(Event evt, Object arg) { - - if (evt.target instanceof Button) { - this.output.setText(""); - runProgram(); - return true; - } - return false; - } - - public void runProgram() { - - final TopPanel tp = this.app.topPanel; - runLara(this.app, this.code.getText(), tp.languageTxt.getText(), tp.resourcesTxt.getText(), tp.xmlTxt.getText(), - tp.outputTxt.getText(), tp.workingTxt.getText(), tp.showAspectIR.getState(), tp.interpreter.getState(), - tp.showTreeDefinition.getState()); - final String out = this.output.getText(); - if (out.contains("at line ")) { - - final int pos = out.indexOf("at line ") + "at line ".length(); - final int line = Integer.parseInt(out.substring(pos, out.indexOf(",", pos))); - final int colPos = out.indexOf(" column ", pos) + " column ".length(); - final int column = Integer.parseInt(out.substring(colPos, out.indexOf(".", colPos))); - System.out.println("select: " + line); - this.code.select(line, line + 10); - System.getProperty("line.separator"); - - final String[] lines = this.code.getText().split("\n"); - System.out.println("totalLines: " + lines.length); - if (line - 1 < lines.length) { - int posInit = 0; - for (int i = 0; i < line - 1; i++) { - posInit += (lines[i] + "\n").length(); - } - - final int finalSel = posInit + (lines[line - 1] + "\n").length(); - this.code.select(posInit + column, finalSel); - this.code.requestFocus(); - } - } - - } - - private static void runLara(GUI app, String code, String language, String resource, String xmlDir, String outputDir, - String workDir, boolean showAspectIR, boolean interpret, boolean showTree) { - final RunLara runner = new RunLara(code, showAspectIR, interpret, showTree, app); - runner.run(); - } -} - -class TopPanel extends Panel { - - /** - * - */ - private static final long serialVersionUID = 1L; - HashMap examples; - Checkbox showAspectIR; - Checkbox interpreter; - Checkbox showTreeDefinition; - Label aspectLabel, languageLabel, resourcesLabel, xmlLabel, outputLabel, workingLabel; - Button aspectDial, languageDial, resourcesDial, xmlDial, outputDial, workingDial; - Choice loader; - Button load; - TextField aspectTxt, languageTxt, resourcesTxt, xmlTxt, outputTxt, workingTxt; - GUI app; - - public TopPanel(GUI parent) { - this.app = parent; - final GridBagLayout gbl = new GridBagLayout(); - final GridBagConstraints gbcon = new GridBagConstraints(); - - initLabels(gbl, gbcon); - initDialogs(gbl, gbcon); - initTxtBoxs(gbl, gbcon); - initExamplesChoice(gbl, gbcon); - setLayout(gbl); - } - - private void initExamplesChoice(GridBagLayout gbl, GridBagConstraints gbcon) { - this.load = new Button("Load"); - this.showAspectIR = new Checkbox("Show Aspect-IR", true); - this.interpreter = new Checkbox("Interpret (not working)", false); - this.showTreeDefinition = new Checkbox("Tree of Definitions", false); - this.load.setActionCommand(Commands.LOAD.toString()); - this.loader = new Choice(); - this.examples = new HashMap<>(); - if (FileUtils.getExamplesFromDir("examples", this.examples)) { - for (final String example : this.examples.keySet()) { - this.loader.addItem(example); - } - } - gbcon.gridx = 1; - gbcon.gridy = 3; - gbcon.anchor = GridBagConstraints.WEST; - gbl.setConstraints(this.loader, gbcon); - add(this.loader); - - gbcon.gridx = 0; - gbcon.gridy = 3; - gbcon.anchor = GridBagConstraints.EAST; - gbl.setConstraints(this.load, gbcon); - add(this.load); - gbcon.anchor = GridBagConstraints.WEST; - gbcon.gridx = 4; - gbcon.gridy = 2; - gbl.setConstraints(this.showAspectIR, gbcon); - add(this.showAspectIR); - gbcon.anchor = GridBagConstraints.WEST; - gbcon.gridy = 3; - gbcon.gridx = 4; - gbl.setConstraints(this.interpreter, gbcon); - add(this.interpreter); - gbcon.gridy = 4; - gbl.setConstraints(this.showTreeDefinition, gbcon); - add(this.showTreeDefinition); - } - - private void initTxtBoxs(GridBagLayout gbl, GridBagConstraints gbcon) { - - this.aspectTxt = new TextField(20); - this.languageTxt = new TextField(20); - this.languageTxt.setText("C"); - this.resourcesTxt = new TextField(20); - this.xmlTxt = new TextField(20); - this.xmlTxt.setText("." + File.separator); - this.outputTxt = new TextField(20); - this.outputTxt.setText("." + File.separator); - this.workingTxt = new TextField(20); - this.workingTxt.setText("." + File.separator); - - gbcon.gridx = 1; - gbcon.gridy = 0; - - // gbcon.gridx = 4; - gbl.setConstraints(this.languageTxt, gbcon); - add(this.languageTxt); - - gbcon.gridx = 1; - gbcon.gridy = 1; - gbl.setConstraints(this.resourcesTxt, gbcon); - add(this.resourcesTxt); - - gbcon.gridx = 4; - gbcon.gridy = 0; - gbl.setConstraints(this.xmlTxt, gbcon); - add(this.xmlTxt); - - gbcon.gridx = 1; - gbcon.gridy = 2; - gbl.setConstraints(this.outputTxt, gbcon); - add(this.outputTxt); - - gbcon.gridx = 4; - gbcon.gridy = 1; - gbl.setConstraints(this.workingTxt, gbcon); - add(this.workingTxt); - } - - private void initDialogs(GridBagLayout gbl, GridBagConstraints gbcon) { - - this.aspectDial = new Button(".."); - this.aspectDial.setActionCommand(Commands.ASPECT.toString()); - this.languageDial = new Button(".."); - this.languageDial.setActionCommand(Commands.LANGUAGE.toString()); - this.resourcesDial = new Button(".."); - this.resourcesDial.setActionCommand(Commands.RESOURCE.toString()); - this.xmlDial = new Button(".."); - this.xmlDial.setActionCommand(Commands.XML.toString()); - this.outputDial = new Button(".."); - this.outputDial.setActionCommand(Commands.OUTPUT.toString()); - this.workingDial = new Button(".."); - this.workingDial.setActionCommand(Commands.WORKSPACE.toString()); - - // gbcon.gridx = 2; gbcon.gridy = 0; - // gbl.setConstraints(aspectDial, gbcon); - // add(aspectDial); - gbcon.gridx = 2; - gbcon.gridy = 1; - gbl.setConstraints(this.resourcesDial, gbcon); - add(this.resourcesDial); - gbcon.gridx = 5; - gbcon.gridy = 0; - gbl.setConstraints(this.xmlDial, gbcon); - add(this.xmlDial); - gbcon.gridx = 2; - gbcon.gridy = 2; - gbl.setConstraints(this.outputDial, gbcon); - add(this.outputDial); - gbcon.gridx = 5; - gbcon.gridy = 1; - gbl.setConstraints(this.workingDial, gbcon); - add(this.workingDial); - } - - private void initLabels(GridBagLayout gbl, GridBagConstraints gbcon) { - this.aspectLabel = new Label("Aspect File:"); - this.languageLabel = new Label("Language:"); - this.resourcesLabel = new Label("Resources:"); - this.xmlLabel = new Label("XML dir:"); - this.outputLabel = new Label("Output dir:"); - this.workingLabel = new Label("Working dir:"); - gbcon.gridx = 0; - gbcon.gridy = 0; - // gbcon.gridwidth = 2; - gbcon.anchor = GridBagConstraints.EAST; - // gbcon.weighty = 0.1; - // gbl.setConstraints(aspectLabel, gbcon); - // add(aspectLabel); - - // gbcon.gridx = 3; - gbl.setConstraints(this.languageLabel, gbcon); - add(this.languageLabel); - - gbcon.gridx = 0; - gbcon.gridy = 0; - gbl.setConstraints(this.resourcesLabel, gbcon); - add(this.resourcesLabel); - - gbcon.gridx = 3; - gbl.setConstraints(this.xmlLabel, gbcon); - add(this.xmlLabel); - - gbcon.gridx = 0; - gbcon.gridy = 1; - gbl.setConstraints(this.outputLabel, gbcon); - add(this.outputLabel); - - gbcon.gridx = 3; - gbl.setConstraints(this.workingLabel, gbcon); - add(this.workingLabel); - } - - JFileChooser fc = new JFileChooser("File selection"); - - @Override - public boolean action(Event evt, Object arg) { - // new StringBuffer(50); - - if (evt.target instanceof Button) { - final Button bt = (Button) evt.target; - final String command = bt.getActionCommand(); - this.fc.setCurrentDirectory(new File(".")); - switch (Commands.valueOf(command)) { - case ASPECT: - FileUtils.processJFileChooser(this.app, this.fc, FileUtils.aspectFilter, this.aspectTxt, - JFileChooser.FILES_ONLY); - break; - case RESOURCE: - FileUtils.processJFileChooser(this.app, this.fc, FileUtils.txtFilter, this.resourcesTxt, - JFileChooser.FILES_ONLY); - break; - case XML: - FileUtils.processJFileChooser(this.app, this.fc, FileUtils.dirXMLFilter, this.xmlTxt, - JFileChooser.DIRECTORIES_ONLY); - break; - case OUTPUT: - FileUtils.processJFileChooser(this.app, this.fc, FileUtils.dirFilter, this.outputTxt, - JFileChooser.DIRECTORIES_ONLY); - break; - case WORKSPACE: - FileUtils.processJFileChooser(this.app, this.fc, FileUtils.dirFilter, this.workingTxt, - JFileChooser.DIRECTORIES_ONLY); - break; - case LOAD: - final String key = this.loader.getSelectedItem(); - final String example = this.examples.get(key); - this.app.console.code.setText(example); - break; - case CLEAR: - break; - case GENERATE: - break; - case LANGUAGE: - break; - case OPEN: - break; - case SAVE: - break; - case SAVEAS: - break; - default: - break; - } - return true; - } - return false; - } -} - -public class GUI extends Applet { - /** - * - */ - private static final long serialVersionUID = 1L; - static final Color BGCOLOR = new Color(192, 192, 192); - static final int window_Width = 1000; - static final int window_Height = 650; - static final int areaHeight = (int) (GUI.window_Height / 10 * 0.40); - static final int areaWidth = (int) (GUI.window_Width / 10 * 1.2); - - Label title = new Label("Meta-Aspect Language"); - TopPanel topPanel; - Console console; - LowPanel lowPanel; - - @Override - public void init() { - - setBackground(GUI.BGCOLOR); - - this.topPanel = new TopPanel(this); - this.console = new Console(this); - this.lowPanel = new LowPanel(this); - final GridBagLayout gbl = new GridBagLayout(); - - final GridBagConstraints gbcon = new GridBagConstraints(); - setLayout(gbl); - gbcon.gridx = 0; - gbcon.gridy = 0; - // gbcon.gridwidth = 2; - gbcon.fill = GridBagConstraints.BOTH; - - gbcon.weighty = 0.2; - gbcon.anchor = GridBagConstraints.WEST; - gbl.setConstraints(this.topPanel, gbcon); - add(this.topPanel); - this.topPanel.validate(); - gbcon.gridy = 1; - gbcon.weighty = 0.1; - gbcon.anchor = GridBagConstraints.WEST; - gbl.setConstraints(this.console, gbcon); - add(this.console); - this.console.validate(); - gbcon.gridy = 2; - gbcon.weighty = 0.1; - gbcon.gridx = 0; - gbcon.anchor = GridBagConstraints.WEST; - gbcon.insets = new Insets(0, 0, 0, GUI.window_Width / 2); - gbl.setConstraints(this.lowPanel, gbcon); - add(this.lowPanel); - this.lowPanel.validate(); - - setSize(GUI.window_Width, GUI.window_Height); - setMinimumSize(new Dimension(GUI.window_Width, GUI.window_Height)); - addComponentListener(new ComponentListener() { - - @Override - public void componentShown(ComponentEvent e) { - // TODO Auto-generated method stub - - } - - @Override - public void componentResized(ComponentEvent e) { - // determine the size of the new JFrame - final GUI gui = (GUI) e.getComponent(); - final Dimension oldDim = gui.getSize(); - - /* - * resize the JScrollPane to be 20 pixels less in width and 70 - * pixels less in height that new size - */ - final int width = (int) oldDim.getWidth(); - final int height = (int) oldDim.getHeight(); - - // new Dimension(width, height); - - gui.setSize(new Dimension(width, height)); - - } - - @Override - public void componentMoved(ComponentEvent e) { - // TODO Auto-generated method stub - - } - - @Override - public void componentHidden(ComponentEvent e) { - // TODO Auto-generated method stub - - } - }); - - } -} diff --git a/LARAC/src/larac/LARACLauncher.java b/LARAC/src/larac/LARACLauncher.java deleted file mode 100644 index 72e56ea1c..000000000 --- a/LARAC/src/larac/LARACLauncher.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright 2015 SPeCS. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac; - -import larac.utils.output.Output; -import org.lara.language.specification.dsl.LanguageSpecification; -import pt.up.fe.specs.tools.lara.exception.BaseException; - -public class LARACLauncher { - - /** - * The main function where the aspect file is parsed and the output files are created - * - * @param args - * The input arguments of the program - */ - public static void main(String args[]) { - - LARACLauncher.exec(args); - } - - /** - * Execute LaraC with the input arguments - * - * @param args - * array containing the input arguments - */ - public static int exec(String args[]) { - - return LARACLauncher.exec(args, new Output()); - } - - /** - * Execute LaraC with the input arguments and a user-defined output (typically used when calling LaraC recursively) - * - * @param args - * array containing the input arguments - * @param output - * user-defined output, containing a user-defined verbose level - */ - public static int exec(String args[], Output output) { - // Create a new instance of lara with the standard output and generate - // the AST - try { - final LaraC lara = new LaraC(args, output); - if (lara.isReadyToParse()) { - return lara.compileAndSave(); - } - return 1; - } catch (BaseException e) { - throw e.generateRuntimeException(); - } - } - - /** - * Execute LaraC with the input arguments and a user-defined output (typically used when calling LaraC recursively) - * - * @param args - * array containing the input arguments - * @param output - * user-defined output, containing a user-defined verbose level - */ - public static int exec(String args[], LanguageSpecification langSpec, Output output) { - // Create a new instance of lara with the standard output and generate - // the AST - try { - final LaraC lara = new LaraC(args, langSpec, output); - if (lara.isReadyToParse()) { - return lara.compileAndSave(); - } - return 1; - } catch (BaseException e) { - throw e.generateRuntimeException(); - } - } - -} diff --git a/LARAC/src/larac/LaraC.java b/LARAC/src/larac/LaraC.java deleted file mode 100644 index 638111eaf..000000000 --- a/LARAC/src/larac/LaraC.java +++ /dev/null @@ -1,915 +0,0 @@ -/* - * Copyright 2013 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ -package larac; - -import larac.exceptions.LARACompilerException; -import larac.exceptions.StopParseException; -import larac.exceptions.SyntaxException; -import larac.options.LaraCOptions; -import larac.options.resources.InputStreamProvider; -import larac.structure.AspectIR; -import larac.utils.FileUtils; -import larac.utils.Organizer; -import larac.utils.output.MessageConstants; -import larac.utils.output.Output; -import org.apache.commons.io.input.BOMInputStream; -import org.dojo.jsl.parser.ast.*; -import org.dojo.jsl.parser.ast.utils.ASTScriptImport; -import org.lara.language.specification.dsl.LanguageSpecification; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; -import pt.up.fe.specs.lara.aspectir.Aspects; -import pt.up.fe.specs.tools.lara.exception.BaseException; -import pt.up.fe.specs.util.SpecsCollections; -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.SpecsLogs; -import pt.up.fe.specs.util.providers.ResourceProvider; -import tdrc.utils.StringUtils; - -import javax.management.modelmbean.XMLParseException; -import javax.xml.bind.JAXBException; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactoryConfigurationError; -import java.io.*; -import java.util.*; -import java.util.stream.Collectors; - -/** - * Main class of the LARA compiler. The process involves parsing the input file given by the user, organize the AST, - * according to the target language specification, and the create the Aspect Intermediate Representation (Aspect-IR) - * - * @author Tiago - */ -public class LaraC { - /** - * The current version of the Lara compiler - */ - public static final String FRONT_END_VERSION = "Lara compiler version: 2.51"; - - public static final String PROPERTY_JAR_PATH = "lara.jarpath"; - - private static final Collection SUPPORTED_LARA_EXT = new LinkedHashSet<>(Arrays.asList("lara")); - // private static final Collection SUPPORTED_SCRIPT_EXT = new LinkedHashSet<>(Arrays.asList("js", "mjs")); - // Disabled .mjs since it is not properly working for imports - private static final Collection SUPPORTED_SCRIPT_EXT = new LinkedHashSet<>(Arrays.asList("js", "mjs")); - private static final Collection SUPPORTED_EXT = new LinkedHashSet<>(); - - static { - SUPPORTED_EXT.addAll(SUPPORTED_LARA_EXT); - SUPPORTED_EXT.addAll(SUPPORTED_SCRIPT_EXT); - } - - private Output print; - private String jarPath; - private String laraName; // simple name of the lara file/resource - private String laraPath; // complete path to the lara file/resource - private File laraFile; - private InputStreamProvider laraStreamProvider; - private String prefix = ""; - - private LanguageSpecification languageSpec; - - private AspectIR aspectIR; - - private boolean parsed; - private LaraCOptions options; - - private Document aspectIRXmlRepresentation; - private Map importedLARA; - private List previouslyImportedLARA = new ArrayList<>(); - - private boolean readyToParse = false; - private boolean toJsMode = false; - - /** - * Create a LaraC instance with the input arguments and the default output stream - * - * @param args input arguments - * @throws IOException - * @throws SAXException - * @throws ParserConfigurationException - * @throws XMLParseException - * @throws JAXBException - */ - public LaraC(String args[]) - // throws IOException, ParserConfigurationException, SAXException, JAXBException, XMLParseException { - throws IOException, ParserConfigurationException, SAXException, JAXBException { - this(args, new Output()); - } - - /** - * Create a LaraC instance with the input arguments and a user-defined output stream - * - * @param args input arguments - * @param out user-defined output, containing a user-defined verbose level - */ - public LaraC(String args[], Output out) { - - setReadyToParse(laraConstructor(args, out)); - } - - /** - * Create a LaraC instance with the input arguments and a user-defined output stream - * - * @param args input arguments - * @param out user-defined output, containing a user-defined verbose level - */ - public LaraC(String args[], LanguageSpecification langSpec, Output out) { - setReadyToParse(laraConstructor(args, langSpec, out)); - } - - /** - * Generate a LaraC instance with a previous information of a (parent) LaraC instance and the target language - * specification.
- * NOTE: This constructor should only be called when an import is made in a LARA file - * - * @param laraFile input lara file - * @param options input arguments previously parsed by other LaraC instance - * @param langSpec language specification previously parsed by other LaraC instance - * @param output the output stream used on the parent LaraC instance - */ - public static LaraC newImporter(File laraFile, LaraCOptions options, LanguageSpecification langSpec, - Output output, Map importedFiles) { - - LaraC laraC = new LaraC(options, langSpec, output); - laraC.getOptions().setLaraFile(laraC, laraFile); - laraC.parseForImport(importedFiles); - return laraC; - } - - /** - * Generate a LaraC instance with a previous information of a (parent) LaraC instance and the target language - * specification.
- * NOTE: This constructor should only be called when an import is made in a LARA file - *

- * * @param laraResource input lara resource - * - * @param options input arguments previously parsed by other LaraC instance - * @param langSpec language specification previously parsed by other LaraC instance - * @param output the output stream used on the parent LaraC instance - */ - public static LaraC newImporter(ResourceProvider laraResource, LaraCOptions options, - LanguageSpecification langSpec, - Output output, Map importedFiles) { - LaraC laraC = new LaraC(options, langSpec, output); - laraC.getOptions().setLaraResource(laraC, laraResource); - laraC.parseForImport(importedFiles); - - return laraC; - } - - private LaraC(LaraCOptions options, LanguageSpecification langSpec, Output output) { - setParsed(false); - this.options = options; - print = output; - languageSpec = langSpec; - } - - public void setToJsMode(boolean toJsMode, String laraFilename, String laraCode) { - this.toJsMode = toJsMode; - setLaraPath(laraFilename); - setLaraStreamProvider(() -> SpecsIo.toInputStream(laraCode)); - } - - public boolean isToJsMode() { - return toJsMode; - } - - public static Collection getSupportedScriptExtensions() { - return SUPPORTED_SCRIPT_EXT; - } - - public static Collection getSupportedExtensions() { - return SUPPORTED_EXT; - } - - private void parseForImport(Map importedFiles) { - importedLARA = importedFiles; - aspectIR = new AspectIR(this); - - final boolean isParsed = execParse(); - if (!isParsed) { - return; - } - setParsed(true); - // parse(); - println("Importing: Parse Successful!"); - } - - /** - * Constructs the LaraC instance with the given arguments and an output stream - * - * @param args - */ - private boolean laraConstructor(String[] args, Output out) { - - // initialize lara - boolean ready = initialize(args, out); - - // Parse the language specification - if (ready) { - final File xmlSourceDir = options.getXmlSpecDir(); - setLanguageSpec(LanguageSpecification.newInstance(xmlSourceDir)); - } - return ready; - // parse(); - } - - /** - * Constructs the LaraC instance with the given arguments, the output stream and a {@link LanguageSpecification} - * instance - * - * @param args - * @param langSpec - * @param out - */ - private boolean laraConstructor(String[] args, LanguageSpecification langSpec, Output out) { - - // initialize lara - boolean ready = initialize(args, out); - - // Parsing the language specification - setLanguageSpec(langSpec); - return ready; - // parse(); - } - - /** - * This is the last part of the constructor, after the language specification, in which we parse the lara file with - * the given input and the language specification - */ - private void parse() { - final boolean isFileParsed = execParse(); - if (!isFileParsed) { - return; - } - setParsed(true); - } - - /** - * Initialize LaraC with the input arguments and the output stream - * - * @param args - * @return true if all options were successfully managed, false otherwise - */ - private boolean initialize(String[] args, Output out) { - - setPrint(out); - printTopic("Setting up LARA"); - setImportedLARA(SpecsCollections.newHashMap()); - setAspectIR(new AspectIR(this)); - setParsed(false); - setOptions(new LaraCOptions()); - - final boolean optionsSetted = options.setOptions(this, args); - if (optionsSetted) { - options.printInformation(print); - } - return optionsSetted; - } - - /** - * Parse the input LARA file - * - * @return true if parsed successful, false otherwise - */ - private boolean execParse() { - - // Create a new Parser - // final LARAEcmaScript parser = new LARAEcmaScript(); - // laraFile = new File(laraPath + laraSimpleName); - - // And then parse the input LARA file, if exists - println(MessageConstants.FILE_READ + laraPath); - // if (laraFile == null) { - // LoggingUtils.msgInfo("!Terminating program"); - // return false; - // } - - var extension = SpecsIo.getExtension(laraPath).toLowerCase(); - - // System.out.println("EXTENSION: " + extension); - - if (extension.equals("lara")) { - parseLara(); - } else if (SUPPORTED_SCRIPT_EXT.contains(extension)) { - parseScript(); - } else { - throw new RuntimeException("Tried to import unsupported file type: " + extension - + ". Supported types: lara, " + SUPPORTED_SCRIPT_EXT.stream().collect(Collectors.joining(", "))); - } - - println("Parse Successful!"); - aspectIR.getAst().setLara(this); - return true; - } - - private void parseLara() { - // try (BOMInputStream bis = new BOMInputStream(new FileInputStream(laraFile)); - try (BOMInputStream bis = new BOMInputStream(getLaraStream()); - BufferedReader br = new BufferedReader(new InputStreamReader(bis));) { - ASTStart ast = javaCCParser(br); - aspectIR.setAst(ast); - } catch (Exception e) { - throw new LARACompilerException("when parsing: " + laraPath, e); - } - } - - private void parseScript() { - var ast = new ASTStart(LARAEcmaScriptTreeConstants.JJTSTART); - ast.jjtAddChild(new ASTScriptImport(getLaraStream(), getLaraPath()), 0); - aspectIR.setAst(ast); - } - - public static ASTStart javaCCParser(BufferedReader br) { - LARAEcmaScript parser = new LARAEcmaScript(br); - Throwable possibleException = null; - ASTStart abstractTree = null; - try { - abstractTree = parser.parse(); - if (!parser.exceptions.isEmpty()) { - throw new StopParseException(); - // System.out.println("Exceptions:"); - // parser.exceptions.forEach(System.out::println); - } - return abstractTree; - } catch (StopParseException e) { - // Just go to the finally statement and throw syntax exception with exceptions - } catch (ParseException e) { - parser.exceptions.add(e); - } catch (TokenMgrError e) { - parser.exceptions.add(e); - } catch (Throwable e) { - possibleException = e; - } finally { - - if (!parser.exceptions.isEmpty()) { - if (parser.exceptions.size() == 1) { - throw new RuntimeException("Problems while parsing LARA", parser.exceptions.get(0)); - } else { - throw new SyntaxException(parser.exceptions, possibleException); - } - - } else if (possibleException != null) { - parser.exceptions.add(possibleException); - possibleException.printStackTrace(); - throw new SyntaxException(parser.exceptions); - } - } - return abstractTree; - - } - - public static int getNumTokens(ASTStart abstractTree) { - Token token = abstractTree.jjtGetFirstToken(); - int count = 0; - while (token != null) { - count++; - token = token.next; - } - return count; - } - - public int getNumTokens() { - return getNumTokens(this.aspectIR.getAst()); - } - - /** - * Organize the AST containing the aspects, according to the target language specification, to agree with the - * Aspect-IR structure specification - */ - public void toAspectIR() { - aspectIR.organize(); - } - - /** - * Generate the Aspect-IR and save it into an xml file with the same name as the input lara file - */ - public void createXML() { - - aspectIRXmlRepresentation = aspectIR.toXML(); - - } - - private void saveXML() { - try { - String fileName = laraName; - - fileName = fileName.replace(".lara", ""); - fileName = fileName.replace(".js", ""); - - if (fileName.lastIndexOf(File.separator) > -1) { - fileName = fileName.substring(fileName.lastIndexOf(File.separator) + 1); - } - - saveXML(aspectIRXmlRepresentation, fileName); - } catch (final TransformerException e) { - throw new LARACompilerException("When saving Aspect-IR's XML", e); - } - } - - /** - * Write an XML (org.w3c.dom.Document instance) into a file - * - * @param doc the Document to be written - * @param fileName output file name - * @throws TransformerException if doc is not correctly transformed to XML - */ - private void saveXML(Document doc, String fileName) throws TransformerException { - final StringBuffer xmlStringBuffer = StringUtils.xmlToStringBuffer(doc, MessageConstants.INDENT); - aspectIR.setXml(xmlStringBuffer); - FileUtils.toFile(print, fileName, ".xml", xmlStringBuffer.toString(), options.getOutputDir()); - } - - /** - * Kill the execution. The method is deprecated, please use {@link LaraC} .kill(error). - * - * @param error - */ - @Deprecated - public void die(String error) { - // errorln(error); - throw new RuntimeException(error);// System.exit(-1); - } - - /** - * Kill the execution, throwing a RuntimeException - * - * @param error - * an error message - */ - /* - * public static void kill(String error) { // ErrorMsg.say(error); throw new - * RuntimeException(error);// System.exit(-1); } - */ - - // ////////////////////////////////////////// - // Methods to ease the use of the printer // - // ////////////////////////////////////////// - - /** - * Method used to print the section where the front-end currently is - * - * @param topic the current topic - * @param larac the current instance of LaraC - */ - public void printTopic(String topic) { - final StringBuffer buf = new StringBuffer(MessageConstants.UNDERLINE); - buf.append("\n "); - buf.append(MessageConstants.order++); - buf.append(". "); - buf.append(topic); - buf.append("\n"); - buf.append(MessageConstants.OVERLINE); - println(buf.toString()); - } - - /** - * Method used to print the section where the front-end currently is - * - * @param topic the current topic - * @param larac the current instance of LaraC - */ - public void printSubTopic(String topic) { - final StringBuffer buf = new StringBuffer(MessageConstants.UNDERLINE); - buf.append("\n"); - buf.append(topic); - buf.append("\n"); - buf.append(MessageConstants.OVERLINE); - println(buf.toString()); - } - - public void error(Object message) { - print.error(message); - } - - public void errorln(Object message) { - print.errorln(message); - } - - public void warn(Object message) { - print.warn(message); - } - - public void warnln(Object message) { - print.warnln(message); - } - - public void print(Object message) { - print.print(message); - } - - public void println(Object message) { - print.println(message); - } - - // ////////////////////////////////////////// - // ///////// Getters & Setters ////////////// - // ////////////////////////////////////////// - - /** - * @param printer the printer to set - */ - public void setPrint(Output printer) { - print = printer; - } - - /** - * @param the printer - */ - public Output getPrint() { - return print; - } - - /** - * @return the options - */ - public LaraCOptions getOptions() { - return options; - } - - /** - * @param options the options to set - */ - public void setOptions(LaraCOptions options) { - this.options = options; - } - - /** - * @return the laraName - */ - public String getLaraName() { - return laraName; - } - - /** - * @param laraName the laraName to set - */ - public void setLaraName(String laraName) { - this.laraName = laraName; - } - - /** - * @return the laraFile - */ - public File getLaraFile() { - return laraFile; - } - - // public String getLaraLocation() { - // if (laraFile != null) { - // return IoUtils.getCanonicalPath(laraFile); - // } - // - // return getLaraPath() - // } - - /** - * @param laraFile the laraFile to set - */ - public void setLaraFile(File laraFile) { - this.laraFile = laraFile; - } - - /** - * @return the jarPath - */ - public String getJarPath() { - return jarPath; - } - - /** - * @param jarPath the jarPath to set - */ - public void setJarPath(String jarPath) { - this.jarPath = jarPath; - } - - /** - * @return the prefix - */ - public String getPrefix() { - return prefix; - } - - /** - * @param prefix the prefix to set - */ - public void setPrefix(String prefix) { - this.prefix = prefix; - } - - /** - * @return the languageSpec - */ - public LanguageSpecification languageSpec() { - return languageSpec; - } - - /** - * @param languageSpec the languageSpec to set - */ - public void setLanguageSpec(LanguageSpecification languageSpec) { - this.languageSpec = languageSpec; - } - - /** - * @return the aspectIR - */ - public AspectIR aspectIR() { - return aspectIR; - } - - /** - * @param aspectIR the aspectIR to set - */ - public void setAspectIR(AspectIR aspectIR) { - this.aspectIR = aspectIR; - } - - /** - * @return the initialized - */ - public boolean isParsed() { - return parsed; - } - - /** - * @param initialized the initialized to set - */ - public void setParsed(boolean initialized) { - parsed = initialized; - } - - public LanguageSpecification getLanguageSpec() { - return languageSpec; - } - - - public Organizer getOrganizer() { - return new Organizer(getLanguageSpec()); - } - - public AspectIR getAspectIR() { - return aspectIR; - } - - /** - * Compiling a LARA file consist on four phases:
- *

    - *
  1. Parse - parse the input file based on the LARA grammar to obtain the AST
  2. - *
  3. AST to Aspect-IR - validation and organization of the AST based on the Aspect-IR Specification
  4. - *
  5. Generate XML - generate the XML representation of the Aspect-IR
  6. - *
  7. Save the XML in a file, within the output folder: /.xml - *
- * - * @return - */ - public int compileAndSave() { - - compile(); - - printTopic("Saving Aspect-IR"); - saveXML(); - println("Saved!"); - - return 0; - } - - /** - * Compiling a LARA file consist on four phases:
- *
    - *
  1. Parse - parse the input file based on the LARA grammar to obtain the AST
  2. - *
  3. AST to Aspect-IR - validation and organization of the AST based on the Aspect-IR Specification
  4. - *
  5. Generate XML - generate the XML representation of the Aspect-IR
  6. - *
- *
- * NOTE:Use this method if you intend to access immediately the Aspect-IR xml representation and do not want - * to create the xml file - * - * @return an xml representation of the Aspect-IR - */ - public Document compile() { - parse(); - /*if (!isParsed()) { - return n; - }*/ - // On debug mode, dump the AST - if (getOptions().isDebug()) { - printTopic("Dumping AST"); - getAspectIR().getAst().dump(" "); - } - - if (laraFile != null) { - importedLARA.put(SpecsIo.getCanonicalPath(laraFile), this); - } - - // Organize Aspects in AST according to the language specification - printTopic("Organizing Aspects"); - toAspectIR(); - println("Organized!"); - // lara.println("\nFinal Structure"); - // lara.printIR(); - - // Generate the Aspect-Intermediate Representation as an XML - printTopic("Creating Aspect-IR"); - createXML(); - println("Created!"); - // On debug or When the user wants to see the Aspect-IR - if (getOptions().isShowAspectIR() || getOptions().isDebug()) { - printTopic("Dumping Aspect-IR"); - printAspectIR(); - } - return getAspectIRXmlRepresentation(); - } - - public void printAspectIR() { - try { - println(StringUtils.xmlToStringBuffer(aspectIRXmlRepresentation, MessageConstants.INDENT).toString()); - } catch (TransformerFactoryConfigurationError | TransformerException e) { - throw new LARACompilerException("When dumping Aspect-IR", e); - } - } - - public Document getAspectIRXmlRepresentation() { - return aspectIRXmlRepresentation; - } - - public String getLaraPath() { - - return laraPath; - } - - public void setLaraPath(String laraPath) { - this.laraPath = laraPath; - } - - public InputStream getLaraStream() { - return laraStreamProvider.getInputStream(); - } - - public void setLaraStreamProvider(InputStreamProvider laraStream) { - laraStreamProvider = laraStream; - } - - public Map getImportedLARA() { - return importedLARA; - } - - public void setImportedLARA(Map importedLARA) { - this.importedLARA = importedLARA; - } - - public void addImportedLARA(String name, LaraC laraC) { - - importedLARA.put(name, laraC); - } - - public void addImportedLARA(Map laras) { - importedLARA.putAll(laras); - } - - public boolean wasImported(String name) { - return importedLARA.containsKey(name); - } - - public LaraC getImportedLARA(String name) { - return importedLARA.get(name); - } - - public boolean isReadyToParse() { - return readyToParse; - } - - public void setReadyToParse(boolean readyToParse) { - this.readyToParse = readyToParse; - } - - public List getPreviouslyImportedLARA() { - return previouslyImportedLARA; - } - - public void setPreviouslyImportedLARA(List previouslyImportedLARA) { - this.previouslyImportedLARA = previouslyImportedLARA; - } - - public void addPreviouslyImportedLARA(LaraC previouslyImportedLARA) { - // LaraLog.debug("PREVIOUSLY IMPORTED: " + previouslyImportedLARA.getLaraPath() + " @ " + getLaraPath()); - this.previouslyImportedLARA.add(previouslyImportedLARA); - } - - public static Optional parseLara(File laraFile, LanguageSpecification languageSpecification) { - // Pass through LaraC - List args = new ArrayList<>(); - - args.add(laraFile.getAbsolutePath()); - args.add("--doc"); - args.add("--verbose"); - args.add("0"); - - LaraC larac = new LaraC(args.toArray(new String[0]), languageSpecification, - new Output(0)); - Document aspectIr = null; - - try { - aspectIr = larac.compile(); - } catch (BaseException e) { - // If LARA exception, generate exception - SpecsLogs.msgInfo("Could not compile file '" + laraFile + "': " - + e.generateExceptionBuilder().getRuntimeException()); - return Optional.empty(); - } catch (Exception e) { - SpecsLogs.warn("Could not compile file '" + laraFile + "'", e); - return Optional.empty(); - } - - try { - return Optional.of(new Aspects(aspectIr, "")); - } catch (Exception e) { - SpecsLogs.msgInfo("Could not create aspects: " + e.getMessage()); - return Optional.empty(); - } - - } - - public static boolean isSupportedExtension(String filenameExtension) { - return SUPPORTED_EXT.contains(filenameExtension.toLowerCase()); - } - - /** - * Generates a XML document with the AspectIR corresponding to the JS code that needs to be executed in order to - * import the given name, using the same format as the imports in LARA files (e.g. weaver.Query). - * - * @param importName - */ - public Document importLara(String importName) { - // Create LaraC based on current LaraC, to keep imports - - LaraC laraC = new LaraC(options, languageSpec, print); - // laraC.getOptions().setLaraResource(laraC, laraResource); - laraC.setLaraPath("dummy.lara"); - laraC.setLaraStreamProvider(() -> SpecsIo.toInputStream("import " + importName + ";")); - laraC.parseForImport(getImportedLARA()); - - // laraC.compile(); - // laraC.parse(); - - // var previouslyImported = new HashSet<>(getImportedLARA().keySet()); - - // System.out.println("IMPORTED LARA BEFORE: " + previouslyImported); - - if (importName.endsWith(".")) { - throw new RuntimeException("Invalid import, cannot end with '.': " + importName); - } - - // Split into fileName and filePath - int dotIndex = importName.lastIndexOf('.'); - - var fileName = dotIndex == -1 ? importName : importName.substring(dotIndex + 1); - var filePath = dotIndex == -1 ? "" : importName.substring(0, dotIndex + 1); - filePath = filePath.replace('.', '/'); - - // Get LARA imports - var laraImports = getOptions().getLaraImports(fileName, filePath); - - laraImports.stream().forEach(laraImport -> laraImport.resolveImport(laraC)); - - // var currentlyImported = getImportedLARA(); - // System.out.println("IMPORTED LARA AFTER: " + currentlyImported); - - // var newKeys = new HashSet<>(currentlyImported.keySet()); - // System.out.println("NEW KEYS BEFORE: " + newKeys); - // newKeys.removeAll(previouslyImported); - - // System.out.println("NEW KEYS AFTER: " + newKeys); - - var aspectIr = laraC.getAspectIR(); - var doc = aspectIr.toXML(); - - return doc; - - // for (var key : newKeys) { - // System.out.println("KEY: " + key); - // var larac = currentlyImported.get(key); - // var aspectIr = larac.getAspectIR(); - // - // System.out.println("IS PARSED? " + larac.isParsed()); - // // Alternatively, we could call larac.createXML();, but this is more explicit - // var doc = aspectIr.toXML(); - // - // System.out.println("DOC: " + doc); - // } - - } -} diff --git a/LARAC/src/larac/code/AspectIrToLara.java b/LARAC/src/larac/code/AspectIrToLara.java deleted file mode 100644 index fe69d7463..000000000 --- a/LARAC/src/larac/code/AspectIrToLara.java +++ /dev/null @@ -1,143 +0,0 @@ -package larac.code; - -import java.util.stream.Collectors; - -import larac.objects.Enums; -import larac.objects.Enums.BinaryOperator; -import larac.objects.Enums.UnaryOperator; -import pt.up.fe.specs.lara.aspectir.Argument; -import pt.up.fe.specs.lara.aspectir.CodeElem; -import pt.up.fe.specs.lara.aspectir.ExprCall; -import pt.up.fe.specs.lara.aspectir.ExprId; -import pt.up.fe.specs.lara.aspectir.ExprLiteral; -import pt.up.fe.specs.lara.aspectir.ExprOp; -import pt.up.fe.specs.lara.aspectir.Expression; -import pt.up.fe.specs.lara.aspectir.Parameter; -import pt.up.fe.specs.util.SpecsCheck; -import pt.up.fe.specs.util.classmap.FunctionClassMap; - -public class AspectIrToLara { - - private final FunctionClassMap codeGenerators; - - public AspectIrToLara() { - this.codeGenerators = new FunctionClassMap<>(); - buildCodeGenerators(); - } - - private void buildCodeGenerators() { - codeGenerators.put(Argument.class, this::getArgumentCode); - codeGenerators.put(ExprId.class, this::getExprIdCode); - codeGenerators.put(ExprLiteral.class, this::getExprLiteralCode); - codeGenerators.put(ExprOp.class, this::getExprOpCode); - codeGenerators.put(ExprCall.class, this::getExprCallCode); - codeGenerators.put(Expression.class, this::getExpressionCode); - } - - public String getCode(CodeElem codeElem) { - return codeGenerators.apply(codeElem); - } - - public String getExpressionCode(Expression expression) { - // If Expression, xmltag should be defined? Implement as normal call - if (expression.xmltag == null) { - throw new RuntimeException("Generator not implemented for class " + expression.getClass() + ".\nXML IR: " - + CodeElems.toXml(expression)); - } - - switch (expression.xmltag) { - case "property": - return getPropertyCode(expression); - default: - throw new RuntimeException("Expression code not implement for xml tag '" + expression.xmltag + "'"); - } - - } - - private String getPropertyCode(Expression expression) { - // SpecsCheck.checkArgument(expression.exprs.size() == 2, - // () -> "Expected expression property to have two expressions, has " + expression.exprs.size()); - SpecsCheck.checkSize(expression.exprs, 2); - - return codeGenerators.apply(expression.exprs.get(0)) + "." + codeGenerators.apply(expression.exprs.get(1)); - } - - public String getExprIdCode(ExprId exprId) { - return exprId.name; - } - - public String getExprLiteralCode(ExprLiteral exprLiteral) { - // if ("Integer.parseInt(System.getProperty(".equals(exprLiteral.value) || "stringify".equals(exprLiteral.value) - // || "weaver.kadabra.concurrent".equals(exprLiteral.value)) { - // System.out.println("EXPR LITERAL: " + CodeElems.toXml(exprLiteral)); - // System.out.println("PARENT:" + exprLiteral.parent); - // } - - String value = exprLiteral.value; - - // HACK: Is there a better way? - if ((exprLiteral.parent instanceof ExprOp || exprLiteral.parent instanceof Parameter) - && "string".equals(exprLiteral.type)) { - return "\"" + value + "\""; - } - - return value; - } - - public String getExprOpCode(ExprOp exprOp) { - String op = exprOp.name; - - // Get operator - if (exprOp.exprs.size() == 1) { - // Special case: suffix ops - if (op.equals("INCS")) { - return getCode(exprOp.exprs.get(0)) + "++"; - } - - if (op.equals("DECS")) { - return getCode(exprOp.exprs.get(0)) + "++"; - } - - UnaryOperator unaryOp = Enums.UnaryOperator.getHelper().fromValue(op); - - return unaryOp.getOp() + getCode(exprOp.exprs.get(0)); - // return getUnaryOpCode(exprOp, unaryOp); - } - - if (exprOp.exprs.size() == 2) { - BinaryOperator binaryOp = Enums.BinaryOperator.getHelper().fromValue(op); - return getCode(exprOp.exprs.get(0)) + " " + binaryOp.getOp() + " " + getCode(exprOp.exprs.get(1)); - } - - throw new RuntimeException( - "Expected operator two have one or two parameters, it has '" + exprOp.exprs.size() + "'"); - - } - - public String getExprCallCode(ExprCall exprCall) { - String args = exprCall.arguments.stream().map(this::getCode).collect(Collectors.joining(", ")); - - SpecsCheck.checkSize(exprCall.method.exprs, 1); - Expression methodExpr = exprCall.method.exprs.get(0); - - SpecsCheck.checkSize(methodExpr.exprs, 2); - - Expression instance = methodExpr.exprs.get(0); - Expression memberName = methodExpr.exprs.get(1); - - String exprCode = getCode(instance) + "." + getCode(memberName) + "(" + args + ")"; - // System.out.println("EXPR CALL CODE: " + exprCode); - - return exprCode; - - // throw new RuntimeException("Generator not implemented for class " + exprCall.getClass() + ".\nXML IR: " - // + CodeElems.toXml(exprCall)); - } - - public String getArgumentCode(Argument argument) { - SpecsCheck.checkSize(argument.exprs, 1); - - return getCode(argument.exprs.get(0)); - } - -} diff --git a/LARAC/src/larac/code/CodeElems.java b/LARAC/src/larac/code/CodeElems.java deleted file mode 100644 index 8d1734690..000000000 --- a/LARAC/src/larac/code/CodeElems.java +++ /dev/null @@ -1,201 +0,0 @@ -package larac.code; - -import java.util.List; -import java.util.Optional; -import java.util.stream.Stream; - -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactoryConfigurationError; - -import pt.up.fe.specs.lara.aspectir.Code; -import pt.up.fe.specs.lara.aspectir.CodeElem; -import pt.up.fe.specs.lara.aspectir.ExprBody; -import pt.up.fe.specs.lara.aspectir.ExprCall; -import pt.up.fe.specs.lara.aspectir.ExprLiteral; -import pt.up.fe.specs.lara.aspectir.ExprOp; -import pt.up.fe.specs.lara.aspectir.Expression; -import pt.up.fe.specs.lara.aspectir.Statement; -import pt.up.fe.specs.util.SpecsCheck; -import pt.up.fe.specs.util.classmap.FunctionClassMap; -import pt.up.fe.specs.util.lazy.Lazy; -import tdrc.utils.StringUtils; - -public class CodeElems { - - private final static Lazy CODE_GENERATOR = Lazy.newInstance(() -> new AspectIrToLara()); - - private final static FunctionClassMap> CODE_ELEM_TO_STREAM; - static { - CODE_ELEM_TO_STREAM = new FunctionClassMap<>(); - - CODE_ELEM_TO_STREAM.put(ExprCall.class, CodeElems::toElemStream); - CODE_ELEM_TO_STREAM.put(ExprBody.class, exprBody -> CodeElems.toElemStream(exprBody, exprBody.code)); - CODE_ELEM_TO_STREAM.put(Expression.class, CodeElems::getDescendantsAndSelf); - CODE_ELEM_TO_STREAM.put(Code.class, CodeElems::toElemStream); - } - - /** - * @deprecated Replaced by BaseNodes.toStream() - * @param codeElem - * @return - */ - @Deprecated - public static Stream toElemStream(CodeElem codeElem) { - return CODE_ELEM_TO_STREAM.apply(codeElem); - } - - private static Stream toElemStream(Code code) { - if (code.statements == null) { - return Stream.empty(); - } - - return code.statements.stream().flatMap(CodeElems::toElemStream); - } - - /** - * @deprecated Replaced by BaseNodes.toStream() - * @param statement - * @return - */ - @Deprecated - public static Stream toElemStream(Statement statement) { - if (statement.components == null) { - return Stream.empty(); - } - - return statement.components.stream().flatMap(CODE_ELEM_TO_STREAM::apply); - } - - private static Stream getDescendantsAndSelf(Expression expression) { - Stream descendants = getDescendants(expression); - - return Stream.concat(Stream.of(expression), descendants); - } - - private static Stream getDescendants(Expression expression) { - return expression.exprs != null ? expression.exprs.stream().flatMap(CODE_ELEM_TO_STREAM::apply) - : Stream.empty(); - } - - // private static Stream toElemStream(ExprBody exprBody) { - private static Stream toElemStream(Expression expression, Code code) { - Stream descendants = getDescendants(expression); - - return Stream.concat(descendants, toElemStream(code)); - } - - private static Stream toElemStream(ExprCall exprCall) { - Stream arguments = exprCall.arguments.stream().flatMap(CodeElems::getDescendants); - Stream method = CodeElems.getDescendants(exprCall.method); - - return Stream.concat(arguments, method); - } - - public static String parseStringLiteralExpr(Expression stringLiteral) { - // System.out.println("CLASS:" + stringLiteralExpr.getClass()); - // Preconditions.checkArgument(stringLiteralExpr instanceof - // Expression.class, "Expected a code element of type Expression, got - // "+stringLiteralExpr.); - // Preconditions.checkArgument(stringLiteral.exprs.size() == 1, - // "Expected to have one expression, has " + stringLiteral.exprs.size()); - SpecsCheck.checkSize(stringLiteral.exprs, 1); - Expression expression = stringLiteral.exprs.get(0); - - SpecsCheck.checkArgument(expression instanceof ExprLiteral, - () -> "Expected first expression to be a literal, is a " + expression.getClass().getSimpleName()); - - ExprLiteral exprLiteral = (ExprLiteral) expression; - - SpecsCheck.checkArgument(exprLiteral.type.equals("string"), - () -> "Expected type to be string, is " + exprLiteral.type); - - return exprLiteral.value; - - } - - public static String getLaraCode(CodeElem codeElem) { - return CODE_GENERATOR.get().getCode(codeElem); - } - - public static String toXml(CodeElem codeElem) { - try { - return StringUtils.xmlToStringBuffer(codeElem.getXmlDocument(), 3).toString(); - } catch (TransformerFactoryConfigurationError | TransformerException e) { - throw new RuntimeException("Could not convert aspect IR node to XML: ", e); - } - } - - public static T get(int index, List elements, Class elemClass) { - CodeElem element = elements.get(index); - - SpecsCheck.checkArgument(elemClass.isInstance(element), - () -> "Expected code element at index " + index + " to be a " + elemClass.getSimpleName()); - - return elemClass.cast(element); - } - - public static Optional getOp(Expression expression, String opName) { - // Expect one child - if (expression.exprs.size() != 1) { - return Optional.empty(); - } - - Expression maybeOp = expression.exprs.get(0); - if (!(maybeOp instanceof ExprOp)) { - return Optional.empty(); - } - - ExprOp op = (ExprOp) maybeOp; - - return op.name.equals(opName) ? Optional.of(op) : Optional.empty(); - } - - public static ExprBody getBody(ExprOp function) { - return function.exprs.stream() - .filter(ExprBody.class::isInstance) - .map(ExprBody.class::cast) - .findFirst() - .orElseThrow(() -> new RuntimeException("Expected function to have a body: " + function)); - } - - // public static Stream getElemsStream(CodeElem elem) { - // - // } - - /* - public static Stream getExpressionStream(Expression expression) { - // Get expressions - Stream expressions = expression.exprs != null ? expression.exprs.stream() : Stream.empty(); - - // Get code / statements - Optional code = getCode(expression); - // if (expression instanceof ExprBody) { - // Code code = ((ExprBody) expression).code; - // if (code == null) { - // return Stream.empty(); - // } - // - // // Return the expressions inside the statements - // } - - return expression.exprs.stream(); - } - - public static Optional getCode(Expression expression) { - if (expression instanceof ExprBody) { - return Optional.of(((ExprBody) expression).code); - } - - return Optional.empty(); - } - - public static Stream getDescendantsAndSelfStream(Expression expression) { - return Stream.concat(Stream.of(expression), CodeElems.getDescendantsStream(expression)); - } - - public static Stream getDescendantsStream(Expression expression) { - return CodeElems.getExpressionStream(expression).flatMap(expr -> CodeElems.getDescendantsAndSelfStream(expr)); - } - */ - -} diff --git a/LARAC/src/larac/exceptions/AspectIRException.java b/LARAC/src/larac/exceptions/AspectIRException.java deleted file mode 100644 index e9895a209..000000000 --- a/LARAC/src/larac/exceptions/AspectIRException.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright 2015 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.exceptions; - -import pt.up.fe.specs.tools.lara.exception.BaseException; - -public class AspectIRException extends BaseException { - - /** - * - */ - private static final long serialVersionUID = 1L; - - public AspectIRException(Throwable e) { - super(e); - } - - @Override - protected String generateMessage() { - return "Problem " + generateSimpleMessage(); - } - - @Override - protected String generateSimpleMessage() { - return "when converting the AST to an Aspect-IR"; - } - -} diff --git a/LARAC/src/larac/exceptions/LARACompilerException.java b/LARAC/src/larac/exceptions/LARACompilerException.java deleted file mode 100644 index a8a419a8e..000000000 --- a/LARAC/src/larac/exceptions/LARACompilerException.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright 2015 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.exceptions; - -import pt.up.fe.specs.tools.lara.exception.BaseException; - -public class LARACompilerException extends BaseException { - - private static final long serialVersionUID = 1L; - private static final String DEFAULT_TEXT = "when running LARAC"; - private String message; - - public LARACompilerException(String message, Throwable e) { - super(e); - this.message = message; - } - - public LARACompilerException(Throwable e) { - this(null, e); - } - - public LARACompilerException(String message) { - this(message, null); - } - - @Override - protected String generateMessage() { - - return "Exception on "; - } - - @Override - protected String generateSimpleMessage() { - return this.message != null ? this.message : LARACompilerException.DEFAULT_TEXT; - } -} diff --git a/LARAC/src/larac/exceptions/LaraException.java b/LARAC/src/larac/exceptions/LaraException.java deleted file mode 100644 index 15e5fae3d..000000000 --- a/LARAC/src/larac/exceptions/LaraException.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright 2015 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.exceptions; - -import larac.utils.output.ErrorMsg; - -public class LaraException extends RuntimeException { - - /** - * - */ - private static final long serialVersionUID = 1L; - - public LaraException(String message) { - super(message); - } - - public LaraException(String message, Throwable cause) { - super(message, cause); - } - - /** - * Calls "ErrorMsg.say()" before returning the LaraException. - * - *

- * This method was built to replace LaraI.die(). - * - * @param message - * @return - */ - public static LaraException newError(String message) { - ErrorMsg.say(message); - return new LaraException(message); - } -} diff --git a/LARAC/src/larac/exceptions/OptionException.java b/LARAC/src/larac/exceptions/OptionException.java deleted file mode 100644 index cd6932b65..000000000 --- a/LARAC/src/larac/exceptions/OptionException.java +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright 2015 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.exceptions; - -public class OptionException { - -} diff --git a/LARAC/src/larac/exceptions/ParseExceptionData.java b/LARAC/src/larac/exceptions/ParseExceptionData.java deleted file mode 100644 index 85a0bdcd2..000000000 --- a/LARAC/src/larac/exceptions/ParseExceptionData.java +++ /dev/null @@ -1,58 +0,0 @@ -package larac.exceptions; - -import java.util.ArrayList; - -import org.dojo.jsl.parser.ast.Node; -import org.dojo.jsl.parser.ast.ParseException; -import org.dojo.jsl.parser.ast.Token; - -/** - * This class is used to store the exception data, which will be stored in a {@link Node}.
- * Note: This data may be used in the future for a syntax highlighter. - * - * @author tiago - * - */ -public class ParseExceptionData { - - private final ArrayList skippedTokens; - private ParseException exception; - private int skippedToTokenKind; - - public ParseExceptionData() { - skippedTokens = new ArrayList<>(); - exception = null; - skippedToTokenKind = -1; - } - - public ParseExceptionData(ParseException e) { - skippedTokens = new ArrayList<>(); - exception = e; - skippedToTokenKind = -1; - } - - public void addSkippedToken(Token token) { - skippedTokens.add(token); - } - - public ArrayList getSkippedTokens() { - return skippedTokens; - } - - public void setSkippedToToken(int kind) { - skippedToTokenKind = kind; - } - - public int getSkippedToToken() { - return skippedToTokenKind; - } - - public void setException(ParseException e) { - exception = e; - } - - public Throwable getException() { - return exception; - } - -} \ No newline at end of file diff --git a/LARAC/src/larac/exceptions/StopParseException.java b/LARAC/src/larac/exceptions/StopParseException.java deleted file mode 100644 index 3cef23a1a..000000000 --- a/LARAC/src/larac/exceptions/StopParseException.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright 2015 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.exceptions; - -/** - * Just an exception to stop the parse - * - * @author tiago - * - */ -public class StopParseException extends RuntimeException { - - /** - * - */ - private static final long serialVersionUID = 1L; - -} diff --git a/LARAC/src/larac/exceptions/SyntaxException.java b/LARAC/src/larac/exceptions/SyntaxException.java deleted file mode 100644 index 2dfbd2a9f..000000000 --- a/LARAC/src/larac/exceptions/SyntaxException.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright 2015 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.exceptions; - -import java.util.List; - -import pt.up.fe.specs.tools.lara.exception.BaseException; - -public class SyntaxException extends BaseException { - - /** - * - */ - private static final long serialVersionUID = 1L; - private final List exceptions; - - public SyntaxException(List exceptions) { - this(exceptions, null); - } - - public SyntaxException(List exceptions, Throwable cause) { - super(cause); - this.exceptions = exceptions; - } - - @Override - protected String generateMessage() { - return "Parsing problems"; - } - - @Override - protected String generateSimpleMessage() { - if (exceptions.isEmpty()) { - return "this message shouldn't even appear! the exceptions list is empty!"; - } - if (exceptions.size() > 1) { - String string = "Multiple syntax problems:"; - for (int i = 0; i < exceptions.size(); i++) { - string += "\n " + (i + 1) + ". " + exceptions.get(i).getMessage(); - } - // string += tdrc.utils.StringUtils.join(this.exceptions, Exception::getMessage, "\n"); - return string; - } - return exceptions.get(0).getMessage(); - } - - public List getExceptions() { - return exceptions; - } - -} diff --git a/LARAC/src/larac/imports/FileLaraImport.java b/LARAC/src/larac/imports/FileLaraImport.java deleted file mode 100644 index 5938bcbfa..000000000 --- a/LARAC/src/larac/imports/FileLaraImport.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright 2021 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.imports; - -import java.io.File; - -import larac.LaraC; -import pt.up.fe.specs.util.SpecsCheck; - -public class FileLaraImport extends LaraImport { - - private final File importFile; - - public FileLaraImport(String importPath, File importFile) { - super(importPath); - - SpecsCheck.checkArgument(importFile.exists(), () -> "Expected import file to exist: " + importFile); - this.importFile = importFile; - } - - @Override - public void resolveImport(LaraC lara) { - lara.printSubTopic("Importing " + importFile); - LaraImports.importLaraFile(lara, getImportPath(), importFile); - } - -} diff --git a/LARAC/src/larac/imports/LaraImport.java b/LARAC/src/larac/imports/LaraImport.java deleted file mode 100644 index 1d9617f9b..000000000 --- a/LARAC/src/larac/imports/LaraImport.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright 2021 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.imports; - -import larac.LaraC; - -public abstract class LaraImport { - - private final String importPath; - - public LaraImport(String importPath) { - this.importPath = importPath; - } - - public String getImportPath() { - return importPath; - } - - public abstract void resolveImport(LaraC lara); - - /* - // 1. - // Check include folders - for (final File path : lara.getOptions().getIncludeFolders()) { - for (var ext : LaraC.getSupportedExtensions()) { - var importPath = relativePath + "." + ext; - - final File importingFile = new File(path, importPath); - if (importingFile.exists()) { - lara.printSubTopic("Importing " + importingFile); - importLaraFile(lara, importPath, importingFile); - foundImport = true; - } - } - } - - // 2. - // Check resource by filename, instead of resource name - for (var ext : LaraC.getSupportedExtensions()) { - var importPath = relativePath + "." + ext; - - var resource = lara.getOptions().getIncludeResourcesMap().get(importPath); - if (!resource.isEmpty()) { - importLaraResource(lara, importPath, resource.get(0)); - - // importScriptFile(lara, filepath, findFirst.get()); - foundImport = true; - } - - // Optional findFirst = lara.getOptions().getIncludeResources().stream() - // .filter(r -> r.getFileLocation().replace("/", File.separator).equals(importPath)) - // .findFirst(); - // - // if (findFirst.isPresent()) { - // importLaraResource(lara, importPath, findFirst.get()); - // - // // importScriptFile(lara, filepath, findFirst.get()); - // foundImport = true; - // } - - } - */ -} diff --git a/LARAC/src/larac/imports/LaraImports.java b/LARAC/src/larac/imports/LaraImports.java deleted file mode 100644 index bbdcfbd69..000000000 --- a/LARAC/src/larac/imports/LaraImports.java +++ /dev/null @@ -1,133 +0,0 @@ -/** - * Copyright 2021 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.imports; - -import java.io.File; -import java.util.List; -import java.util.Map; - -import org.dojo.jsl.parser.ast.ASTAspectDef; -import org.dojo.jsl.parser.ast.SimpleNode; -import org.lara.interpreter.weaver.utils.LaraResourceProvider; - -import larac.LaraC; -import larac.exceptions.LARACompilerException; -import larac.utils.output.MessageConstants; -import pt.up.fe.specs.util.SpecsIo; -import tdrc.utils.StringUtils; - -public class LaraImports { - - public static void importLaraFile(final LaraC lara, final String importPath, final File importingFile) { - - String canonicalPath = SpecsIo.getCanonicalPath(importingFile); - if (lara.wasImported(canonicalPath)) { - LaraC importedLARA = lara.getImportedLARA(canonicalPath); - if (importedLARA == null) { - throw new LARACompilerException("Problem with recursive import with file: " + canonicalPath - + " one occurrence is: " + lara.getLaraPath()); - } - // LaraLog.debug("ALREADY IMPORTED:" + importedLARA); - lara.addPreviouslyImportedLARA(importedLARA); - lara.println(" Aspects from file " + importPath + " were already imported. Will ignore this import."); - return; - } - lara.printSubTopic(" Importing aspects from file " + importPath); - lara.addImportedLARA(canonicalPath, null); - final LaraC importingLara = LaraC.newImporter(importingFile, lara.getOptions(), lara.languageSpec(), - lara.getPrint(), lara.getImportedLARA()); - LaraImports.rearrangeImportedLaraAndImportAspects(lara, importPath, importingLara); - lara.setImportedLARA(importingLara.getImportedLARA()); - lara.addImportedLARA(canonicalPath, importingLara); - } - - public static void importLaraResource(final LaraC lara, String filePath, - final LaraResourceProvider importingResource) { - - String importName = importingResource.getFileLocation(); - String resource = importingResource.getResource(); - // if (lara.wasImported(resource)) { - - if (lara.wasImported(importName)) { - LaraC importedLARA = lara.getImportedLARA(importName); - if (importedLARA == null) { - throw new LARACompilerException("Problem with recursive import with resource: " + resource - + " one occurrence is: " + lara.getLaraPath()); - } - lara.addPreviouslyImportedLARA(importedLARA); - lara.println(" Aspects from import " + importName + " were already imported. Will ignore this import."); - return; - } - - if (importName.equals(resource)) { - lara.printSubTopic(" Importing aspects from resource " + resource); - } else { - lara.printSubTopic(" Importing aspects from resource " + resource + " (import '" + importName + "')"); - } - - // lara.addImportedLARA(resource); - lara.addImportedLARA(importName, null); - final LaraC importingLara = LaraC.newImporter(importingResource, lara.getOptions(), lara.languageSpec(), - lara.getPrint(), lara.getImportedLARA()); - LaraImports.rearrangeImportedLaraAndImportAspects(lara, resource.replace("/", File.separator), importingLara); - lara.setImportedLARA(importingLara.getImportedLARA()); - lara.addImportedLARA(importName, importingLara); - - } - - private static void rearrangeImportedLaraAndImportAspects(final LaraC lara, String filePath, - final LaraC importingLara) { - String prefix = filePath.replace(".lara", MessageConstants.NAME_SEPARATOR); - prefix = prefix.replace(File.separator, MessageConstants.NAME_SEPARATOR); - - importingLara.setPrefix(prefix); - lara.println("Organizing imported aspects from " + filePath); - importingLara.toAspectIR(); - - lara.println("Finished organizing imported aspects!"); - LaraImports.importAspects(lara, filePath, importingLara); - } - - private static void importAspects(final LaraC lara, String filePath, final LaraC importingLara) { - List importingAspects = importingLara.aspectIR().getAspectdefs(); - - if (!importingAspects.isEmpty()) { - for (final ASTAspectDef importingAsp : importingAspects) { - final String key = importingLara.getPrefix() + importingAsp.getName(); - - lara.aspectIR().getImportedAspectDefs().put(key, importingAsp); - } - String importingAspectsStr = StringUtils.join(importingAspects, ASTAspectDef::getName, ", "); - lara.println(" Imported the following aspects: " + importingAspectsStr); - } - - Map globalElements = importingLara.aspectIR().getGlobalElements(); - - if (!globalElements.isEmpty()) { - globalElements.entrySet() - .forEach(e -> lara.aspectIR().addGlobalElement(e.getKey(), e.getValue(), filePath)); - String importingAspectsStr = StringUtils.join(globalElements.keySet(), ", "); - lara.println(" Imported the following aspects: " + importingAspectsStr); - } - // Recursive import - Map recursiveImport = importingLara.aspectIR().getImportedAspectDefs(); - if (!recursiveImport.isEmpty()) { - lara.aspectIR().getImportedAspectDefs().putAll(recursiveImport); - String importedFromImporting = StringUtils.join(recursiveImport.keySet(), - s -> s.replace(MessageConstants.NAME_SEPARATOR, "."), ","); - lara.println(" Recursive import: " + importedFromImporting); - } - } - -} diff --git a/LARAC/src/larac/imports/ResourceLaraImport.java b/LARAC/src/larac/imports/ResourceLaraImport.java deleted file mode 100644 index e049a5ee0..000000000 --- a/LARAC/src/larac/imports/ResourceLaraImport.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright 2021 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.imports; - -import org.lara.interpreter.weaver.utils.LaraResourceProvider; - -import larac.LaraC; - -public class ResourceLaraImport extends LaraImport { - - private final LaraResourceProvider importResource; - - public ResourceLaraImport(String importPath, LaraResourceProvider importResource) { - super(importPath); - - this.importResource = importResource; - } - - @Override - public void resolveImport(LaraC lara) { - LaraImports.importLaraResource(lara, getImportPath(), importResource); - } - -} diff --git a/LARAC/src/larac/objects/Enums.java b/LARAC/src/larac/objects/Enums.java deleted file mode 100644 index b10f80b11..000000000 --- a/LARAC/src/larac/objects/Enums.java +++ /dev/null @@ -1,351 +0,0 @@ -/* - * Copyright 2013 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ -package larac.objects; - -import pt.up.fe.specs.util.enums.EnumHelperWithValue; -import pt.up.fe.specs.util.lazy.Lazy; -import pt.up.fe.specs.util.providers.StringProvider; -import tdrc.utils.StringUtils; - -public class Enums { - // private static final String CODE_PARAM_REGEX = "(?!\\[)(\\s*\\S+?\\s*)"; // no spaces in between - private static final String CODE_PARAM_REGEX = "(?!\\[)(.+?)"; - public static String SYMBOL_REGEX_BEGIN = "\\[\\["; - public static String SYMBOL_REGEX_END = "\\]\\]"; - public static String SYMBOL_BEGIN = "[["; - public static String SYMBOL_END = "]]"; - // public static String INSERT_SYMBOL_REGEX = Enums.SYMBOL_REGEX_BEGIN + "(?!\\[)(\\S+?)" + Enums.SYMBOL_REGEX_END; - public static String INSERT_SYMBOL_REGEX = Enums.SYMBOL_REGEX_BEGIN + Enums.CODE_PARAM_REGEX - + Enums.SYMBOL_REGEX_END; - - public static enum JoinOperator { - UNION_JOIN("+"), - NATURAL_JOIN("::"), - BITAND_JOIN("&"),; - - private String op; - - JoinOperator(String op) { - setOp(op); - } - - public void setOp(String op) { - this.op = op; - } - - public String getOp() { - return op; - } - - public static JoinOperator getOpTag(String text) { - if (text != null) { - for (final JoinOperator b : JoinOperator.values()) { - if (text.equalsIgnoreCase(b.op)) { - return b; - } - } - } - return null; - } - - public static boolean contains(String text) { - if (text != null) { - for (final JoinOperator b : JoinOperator.values()) { - if (text.equalsIgnoreCase(b.op)) { - return true; - } - } - } - return false; - } - } - - /** - * Binary operators ordered by precedence: less ordinal means less precedence - * - * @author Tiago - * - */ - public static enum BinaryOperator implements StringProvider { - - COMMA(",", 0), // 0 - OR("||", 1), // 1 - AND("&&", 2), // 2 - BitOR("|", 3), // 3 - BitXOR("^", 4), // 4 - BitAND("&", 5), // 5 - - SEQ("===", 6), // 6 - NSEQ("!==", 6), // 6 - EQ("==", 6), // 6 - NEQ("!=", 6), // 6 - MATCH("~=", 6), // 6 - - LT("<", 7), // 7 - LTE("<=", 7), // 7 - GT(">", 7), // 7 - GTE(">=", 7), // 7 - INSTANCEOF("instanceof", 7), // 7 - IN("in", 7), // 7 - - SHL("<<", 8), // 8 - SHR(">>", 8), // 8 - USHR(">>>", 8), // 8 - - ADD("+", 9), // 9 - SUB("-", 9), // 9 - - MULT("*", 10), // 10 - DIV("/", 10), // 10 - MOD("%", 10), // 10 - - ; - - private static final Lazy> ENUM_HELPER = EnumHelperWithValue - .newLazyHelperWithValue(BinaryOperator.class); - - private String op; - private final int precedence; - - BinaryOperator(String op, int precedence) { - setOp(op); - this.precedence = precedence; - } - - public void setOp(String op) { - this.op = op; - } - - public String getOp() { - return op; - } - - public static BinaryOperator getOpTag(String text) { - if (text != null) { - for (final BinaryOperator b : BinaryOperator.values()) { - if (text.equalsIgnoreCase(b.op)) { - return b; - } - } - } - return null; - } - - public static boolean contains(String text) { - if (text != null) { - for (final BinaryOperator b : BinaryOperator.values()) { - if (text.equalsIgnoreCase(b.op)) { - return true; - } - } - } - return false; - } - - public boolean hasPrecedence(BinaryOperator operator) { - return precedence > operator.precedence; - } - - @Override - public String getString() { - return name(); - } - - public static EnumHelperWithValue getHelper() { - return ENUM_HELPER.get(); - } - } - - public static enum UnaryOperator implements StringProvider { - POS("+"), - NEG("-"), - NOT("!"), - INV("~"), - INCP("++"), - DECP("--"), - TYPEOF("typeof"), - DELETE("delete"), - VOID("void"); - // NEW("new"); - - private static final Lazy> ENUM_HELPER = EnumHelperWithValue - .newLazyHelperWithValue(UnaryOperator.class); - - private String op; - - UnaryOperator(String op) { - setOp(op); - } - - public void setOp(String op) { - this.op = op; - } - - public String getOp() { - return op; - } - - public static UnaryOperator getOpTag(String text) { - if (text != null) { - for (final UnaryOperator b : UnaryOperator.values()) { - if (text.equalsIgnoreCase(b.op)) { - return b; - } - } - } - return null; - } - - public static boolean contains(String text) { - if (text != null) { - for (final UnaryOperator b : UnaryOperator.values()) { - if (text.equalsIgnoreCase(b.op)) { - return true; - } - } - } - return false; - } - - @Override - public String getString() { - return name(); - } - - public static EnumHelperWithValue getHelper() { - return ENUM_HELPER.get(); - } - } - - public static enum AssignOperator { - ASSIGN("="), - ASSIGN_ADD("+="), - ASSIGN_SUB("-="), - ASSIGN_MULT("*="), - ASSIGN_DIV("/="), - ASSIGN_MOD( - "%="), - ASSIGN_SHL("<<="), - ASSIGN_SHR(">>="), - ASSIGN_USHR(">>>="), - ASSIGN_BitAND("&="), - ASSIGN_BitXOR( - "^="), - ASSIGN_BitOR("|=") - - ; - /* - * "<<=" ">>=" - * ">>>=" "&=" "^=" "^=" "|=" - * - * - * - */ - - private String op; - - AssignOperator(String op) { - setOp(op); - } - - public void setOp(String op) { - this.op = op; - } - - public String getOp() { - return op; - } - - public static AssignOperator getOpTag(String text) { - if (text != null) { - for (final AssignOperator b : AssignOperator.values()) { - if (text.equalsIgnoreCase(b.op)) { - return b; - } - } - } - return null; - } - - public static boolean contains(String text) { - if (text != null) { - for (final AssignOperator b : AssignOperator.values()) { - if (text.equalsIgnoreCase(b.op)) { - return true; - } - } - } - return false; - } - } - - public static enum Types { - Null, - Boolean, - Int, - Float, - Double, - String, - RegEx, - Code, - Joinpoint, - Aspect, - Array, - Map, - Object, - FN, - GFN, - ArrowFN, - FNDecl, - GenFNDecl, - Exception, - Undefined, - AspectSTATIC, - Base64; - - public static Types getDefault() { - return Undefined; - } - - public static Types maxType(Types leftType, Types rightType) { - return leftType.compareTo(rightType) >= 0 ? leftType : rightType; - } - - public static Types value(String t) { - if (t.equals("Integer")) { - return Int; - } - t = StringUtils.firstCharToUpper(t); - try { - return valueOf(t); - } catch (final Exception e) { - return null; - } - } - - @Override - public String toString() { - return name().toLowerCase(); - } - - } - - public static enum LoopTypes { - WHILE, - DO, - FOR, - FORIN, - FOREACH; - } -} diff --git a/LARAC/src/larac/objects/SymbolTable.java b/LARAC/src/larac/objects/SymbolTable.java deleted file mode 100644 index 071d88316..000000000 --- a/LARAC/src/larac/objects/SymbolTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2013 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ -/** - * - */ -package larac.objects; - -import java.util.LinkedHashMap; - -/** - * @param - * Key - * @param - * Value - * - */ -public class SymbolTable extends LinkedHashMap { - private static final String MIDDLE = "_U_"; - private static final long serialVersionUID = 1L; - private static int unique_count = 0; - - public String getUniqueName(String key) { - if (containsKey(key)) { - key += SymbolTable.MIDDLE + SymbolTable.unique_count++; - } - return key; - } -} diff --git a/LARAC/src/larac/objects/Variable.java b/LARAC/src/larac/objects/Variable.java deleted file mode 100644 index 6e4a2e965..000000000 --- a/LARAC/src/larac/objects/Variable.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright 2013 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ -/** - * - */ -package larac.objects; - -import org.dojo.jsl.parser.ast.SimpleNode; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.objects.Enums.Types; -import larac.utils.output.NormalMsg; - -public class Variable { - public int staticCounter = 0; - public String staticName = "_larac_call_var_"; - private String name; - private Types type; - // private SimpleNode initialize; // REMOVED INIT as it is provoking a big issue when declaring variables with - // the same name - private SimpleNode expression; - private boolean notFound; - - /* - public Variable(String name, SimpleNode init) { - this.name = name; - if (!(init instanceof ASTFunctionDeclaration)) { - init.organize(init.jjtGetParent()); - } - - initialize = init; - expression = init; - type = init.getExpressionType(); - if (type == Types.FNDecl) { - type = Types.FN; - } - if (name.startsWith("$")) { - type = Types.Joinpoint; - } - notFound = false; - } - */ - public Variable(String name) { - this.name = name; - // initialize = expression = null; - type = Types.getDefault(); - notFound = false; - } - - public Variable(String name, Types type) { - this.name = name; - this.type = type; - notFound = false; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the type - */ - public Types getType() { - return type; - } - - /** - * @param type - * the type to set - */ - public void setType(Types type) { - this.type = type; - } - - /** - * @return the initialize - * - * public SimpleNode getInitialize() { return initialize; } - */ - - /** - * @param initialize - * the initialize to set - * - * public void setInitialize(SimpleNode initialize) { this.initialize = initialize; } - */ - - /** - * @return the expression - */ - public SimpleNode getExpression() { - return expression; - } - - /** - * @param expression - * the expression to set - */ - public void setExpression(SimpleNode expression) { - this.expression = expression; - } - - public void printIR() { - new NormalMsg() - .println("name \"" + getName() + "\"" + "\n type: " + type + "\n"); // + "\n initialize: " + initialize - } - - public void toXML(Document doc, Element parent) { - final Element el = doc.createElement("id"); - parent.appendChild(el); - // String xmlName = name.startsWith("$")?name.substring(1):name; - final String xmlName = name; - el.setAttribute("name", xmlName); - // if(type != Types.Undefined) - // el.setAttribute("type", type.name()); - - } - - @Override - public Object clone() throws CloneNotSupportedException { - final Variable newVar = new Variable(getName()); - return newVar; - } - - /** - * @return the notFound - */ - public boolean isNotFound() { - return notFound; - } - - /** - * @param notFound - * the notFound to set - */ - public void setNotFound(boolean notFound) { - this.notFound = notFound; - } -} diff --git a/LARAC/src/larac/options/LaraCOptions.java b/LARAC/src/larac/options/LaraCOptions.java deleted file mode 100644 index af9335300..000000000 --- a/LARAC/src/larac/options/LaraCOptions.java +++ /dev/null @@ -1,542 +0,0 @@ -/* - * Copyright 2013 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ -package larac.options; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.io.PrintStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.Option; -import org.apache.commons.cli.Options; -import org.lara.interpreter.weaver.utils.GenericLaraResourceProvider; -import org.lara.interpreter.weaver.utils.LaraResourceProvider; - -import larac.LaraC; -import larac.exceptions.LARACompilerException; -import larac.imports.FileLaraImport; -import larac.imports.LaraImport; -import larac.imports.ResourceLaraImport; -import larac.options.optionprovider.OptionUtils; -import larac.utils.output.MessageConstants; -import larac.utils.output.Output; -import pt.up.fe.specs.util.SpecsFactory; -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.collections.MultiMap; -import pt.up.fe.specs.util.lazy.Lazy; -import pt.up.fe.specs.util.providers.ResourceProvider; -import pt.up.fe.specs.util.utilities.JarPath; - -public class LaraCOptions { - public static final String CONFIG_FILE_NAME = "larac.properties"; - - private static final String SKIP_ARGS = "#lara_c_options_skip"; - - // Display the Aspect-IR - private boolean showAspectIR; - // Display all available information in the console - private boolean debug; - // Target Language - private String language; - // Specification Directory - private File xmlSpecDir; - // Output directory for the created files - private File outputDir; - // include aspects in the given directories (separated by the file separator) - private List includeFolders; - private List includeResources; - private Lazy> includeResourcesMap; - private boolean documentationMode; - - private Map> importsCache; - - private Options options; - private CommandLine command; - - public LaraCOptions() { - setDefaultOptions(); - } - - public static String getSkipArgs() { - return SKIP_ARGS; - } - - /** - * Define the default values for LaraC options - */ - private void setDefaultOptions() { - showAspectIR = debug = false; - language = MessageConstants.LANGUAGE_DEFAULT; - xmlSpecDir = outputDir = new File(MessageConstants.HOME_DIR); - includeFolders = new ArrayList<>(); - includeResources = new ArrayList<>(); - includeResourcesMap = Lazy.newInstance(() -> buildIncludeResourcesMap()); - importsCache = new HashMap<>(); - - // Add working dir to the included paths - final File workingDir = SpecsIo.getWorkingDir(); - includeFolders.add(workingDir); - documentationMode = false; - } - - /** - * Set {@link LaraCOptions} instance with the given input arguments - * - * @param args - * @return - */ - public boolean setOptions(LaraC larac, String args[]) { - // SpecsLogs.debug(() -> "LARAC args: " + Arrays.asList(args)); - options = OptionUtils.optionsBuilder(LaraOptionProvider.class); - // LaraC requires at least one input: the aspect file - if ((args.length < 1)) { - - OptionUtils.help(MessageConstants.LARAC_HELP_EXEC, options); - return false; - } - - String laraFileName = args[0]; - - if (laraFileName.equals(SKIP_ARGS)) { - return true; - } - - setLaraFile(larac, laraFileName); - - command = OptionUtils.parseOptions(options, args, MessageConstants.LARAC_HELP_EXEC); - if (command == null) { - return false; - } - - final Option[] processedOptions = command.getOptions(); - for (final Option option : processedOptions) { - - setOption(option, larac); - } - - larac.setJarPath(new JarPath(LaraC.class, LaraC.PROPERTY_JAR_PATH).buildJarPath()); - getIncludeFolders().add(larac.getLaraFile().getParentFile()); - return true; - } - - /** - * @param args - */ - public void setLaraFile(LaraC larac, String laraFileName) { - final File laraFile = new File(laraFileName); - - setLaraFile(larac, laraFile); - } - - /** - * @param args - */ - public void setLaraFile(LaraC larac, File laraFile) { - - if (!laraFile.exists()) { - throw new LARACompilerException("when loading file", - new FileNotFoundException("The file does not exist: " + laraFile.getPath())); - } - - final File absoluteLaraFile = SpecsIo.getCanonicalFile(laraFile); - - // try { - // laraFile = laraFile.getCanonicalFile(); - // } catch (final IOException e) { - // throw new LARACompilerException("when processing file", e); - // } - larac.setLaraName(absoluteLaraFile.getName()); - // larac.setLaraPath(absoluteLaraFile.getName()); - larac.setLaraPath(SpecsIo.getCanonicalPath(absoluteLaraFile)); - - larac.setLaraStreamProvider(() -> { - try { - return new FileInputStream(absoluteLaraFile); - } catch (Exception e) { - throw new LARACompilerException( - "Could not create InputStream from file: " + absoluteLaraFile.getAbsolutePath(), - e); - } - }); - - larac.setLaraFile(absoluteLaraFile); - - } - - public void setLaraResource(LaraC larac, ResourceProvider laraResource) { - - String resourcePath = laraResource.getResource(); - - // laraFile = IoUtils.getCanonicalFile(laraFile); - // try { - // laraFile = laraFile.getCanonicalFile(); - // } catch (final IOException e) { - // throw new LARACompilerException("when processing file", e); - // } - larac.setLaraName(laraResource.getResourceName()); - larac.setLaraPath(resourcePath); - - larac.setLaraStreamProvider(() -> { - InputStream stream = LaraCOptions.class.getClassLoader().getResourceAsStream(resourcePath); - if (stream == null) { - throw new LARACompilerException("when loading resource", - new FileNotFoundException("Could not read resource file: " + resourcePath)); - } - return stream; - }); - // larac.setLaraFile(laraFile); - } - - /** - * Set an option on larac according to the value given, if the option exists on the enum {@link LaraOptionProvider} - * - * @param optionName - * @return - */ - public boolean setOption(Option option, LaraC larac) { - - final String optionName = option.getLongOpt(); - final String value = option.getValue(); - - LaraOptionProvider arg = OptionUtils.getOptionByName(LaraOptionProvider.class, optionName); - if (arg == null) { - arg = OptionUtils.getOptionByShortName(LaraOptionProvider.class, optionName); - if (arg == null) { - larac.warnln("Option " + optionName + " does not exist. Ignoring option."); - return true; - } - } - switch (arg) { - case help: - OptionUtils.help(MessageConstants.LARAC_HELP_EXEC, options); - return false; - case version: - larac.println(MessageConstants.LARA_VERSION + "\n" + LaraC.FRONT_END_VERSION); - return false; - case debug: - setDebug(true); - break; - case documentation: - setDocumentationMode(true); - break; - case aspectir: - showAspectIR = true; - break; - case language: - setLanguage(value); - break; - case xmlspec: - setXmlSpecDir(new File(value)); - break; - case output: - setOutputDir(new File(value)); - break; - case verbose: - try { - - final int verboseLevel = Integer.parseInt(value); - if (verboseLevel < 0 || verboseLevel > 3) { - throw new NumberFormatException("Number out of bounds"); - } - larac.getPrint().setLevel(verboseLevel); - } catch (final NumberFormatException e) { - - larac.errorln("Wrong value for verbose level: " + value + ". Will use default level"); - } - break; - case stream: - try (final PrintStream streamFile = new PrintStream(new File(value));) { - - larac.getPrint().setStream(streamFile); - } catch (final FileNotFoundException e) { - - larac.errorln("Could not create stream file: " + value + ". Will use default output stream."); - } - break; - case include: - includeFolders.addAll(getIncludeFolders(value, larac)); - break; - case resource: - includeResources.addAll(getResourceProviders(value, larac)); - break; - default: - break; - } - return true; - } - // - // @Override - // public String toString() { - // final StringBuilder toString = new StringBuilder("LARAC options:"); - // toString.append("\n\tTODO"); - // toString.append("\n"); - // return toString.toString(); - // } - - public Collection getResourceProviders(String includeDir, LaraC larac) { - final String[] paths = SpecsIo.splitPaths(includeDir); - - final Collection importPaths = SpecsFactory.newArrayList(); - for (final String path : paths) { - - // importPaths.add(() -> path); - importPaths.add(new GenericLaraResourceProvider(path)); - } - return importPaths; - } - - public List getIncludeFolders(String includeDir, LaraC larac) { - final String[] paths = SpecsIo.splitPaths(includeDir); - - final List importPaths = SpecsFactory.newArrayList(); - for (final String path : paths) { - - final File includeFile = new File(path); - if (!includeFile.isDirectory()) { - larac.warnln("Tried to add folder '" + includeFile + "' to the includes, but the path was not found."); - } - - importPaths.add(includeFile); - } - return importPaths; - } - - /** - * @return the showAspectIR - */ - public boolean isShowAspectIR() { - return showAspectIR; - } - - /** - * @param showAspectIR - * the showAspectIR to set - */ - public void setShowAspectIR(boolean showAspectIR) { - this.showAspectIR = showAspectIR; - } - - /** - * @return the debug - */ - public boolean isDebug() { - return debug; - } - - /** - * @param debug - * the debug to set - */ - public void setDebug(boolean debug) { - this.debug = debug; - if (debug) { - showAspectIR = true; - } - } - - /** - * @return the language - */ - public String getLanguage() { - return language; - } - - /** - * @param language - * the language to set - */ - public void setLanguage(String language) { - this.language = language; - } - - /** - * @return the xmlSpecDir - */ - public File getXmlSpecDir() { - return xmlSpecDir; - } - - /** - * @param xmlSpecDir - * the xmlSpecDir to set - */ - public void setXmlSpecDir(File xmlSpecDir) { - this.xmlSpecDir = xmlSpecDir; - } - - /** - * @return the outputDir - */ - public File getOutputDir() { - return outputDir; - } - - /** - * @param outputDir - * the outputDir to set - */ - public void setOutputDir(File outputDir) { - this.outputDir = SpecsIo.mkdir(outputDir); - } - - /** - * @return the includeFolders - */ - public List getIncludeFolders() { - return includeFolders; - } - - /** - * @param includeFolders - * the includeFolders to set - */ - public void setIncludeFolders(List includeFolders) { - this.includeFolders = includeFolders; - - // Reset - importsCache = new HashMap<>(); - } - - /** - * @return the options - */ - public Options getOptions() { - return options; - } - - /** - * @param options - * the options to set - */ - public void setOptions(Options options) { - this.options = options; - } - - public List getIncludeResources() { - return includeResources; - } - - public MultiMap getIncludeResourcesMap() { - return includeResourcesMap.get(); - // Optional findFirst = lara.getOptions().getIncludeResources().stream() - // .filter(r -> r.getFileLocation().replace("/", File.separator).equals(importPath)) - // .findFirst(); - } - - private MultiMap buildIncludeResourcesMap() { - var resourcesMap = new MultiMap(); - - for (var resource : getIncludeResources()) { - resourcesMap.put(resource.getFileLocation().replace("/", File.separator), resource); - } - - return resourcesMap; - } - - public void setIncludeResources(List includeResources) { - this.includeResources = includeResources; - - // Reset in case it is initialized - if (includeResourcesMap.isInitialized()) { - includeResourcesMap = Lazy.newInstance(() -> buildIncludeResourcesMap()); - } - - // Reset - importsCache = new HashMap<>(); - } - - /** - * Print information regarding the LaraC Execution - * - * @param print - * Print streamer - */ - public void printInformation(Output print) { - // print.println("Concerning language: " + language); <-- Activate this when we start to use it - print.println("Language Specification folder: " + xmlSpecDir); - print.println("Output directory: " + outputDir); - if (!includeFolders.isEmpty()) { - print.println("Path included for import: " + includeFolders); - } - if (!includeResources.isEmpty()) { - print.println("Resources included for import: " - + includeResources.stream().map(ResourceProvider::getResource).collect(Collectors.toList())); - } - print.println("Running on: " + System.getProperty("os.name")); - } - - public boolean isDocumentationMode() { - return documentationMode; - } - - public void setDocumentationMode(boolean documentationMode) { - this.documentationMode = documentationMode; - } - - public List getLaraImports(String filename, String filePath) { - // Using forward slash as separator, since it is an illegal charater for a filename, both in Windows and Linux - var key = filename + "////" + filePath; - - var laraImports = importsCache.get(key); - - if (laraImports == null) { - laraImports = buildLaraImports(filename, filePath); - importsCache.put(key, laraImports); - } - - return laraImports; - } - - private List buildLaraImports(String filename, String filePath) { - var laraImports = new ArrayList(); - - String relativePath = filePath + filename; - - // 1. - // Check include folders - for (final File path : getIncludeFolders()) { - for (var ext : LaraC.getSupportedExtensions()) { - var importPath = relativePath + "." + ext; - - final File importingFile = new File(path, importPath); - if (importingFile.exists()) { - laraImports.add(new FileLaraImport(importPath, importingFile)); - // System.out.println("FILE: " + importingFile); - } - } - } - - // 2. - // Check resource by filename, instead of resource name - for (var ext : LaraC.getSupportedExtensions()) { - var importPath = relativePath + "." + ext; - - var resource = getIncludeResourcesMap().get(importPath); - if (!resource.isEmpty()) { - laraImports.add(new ResourceLaraImport(importPath, resource.get(0))); - // System.out.println("RESOURCE: " + resource.get(0)); - } - } - - return laraImports; - } - -} diff --git a/LARAC/src/larac/options/LaraOptionProvider.java b/LARAC/src/larac/options/LaraOptionProvider.java deleted file mode 100644 index b9537b7ef..000000000 --- a/LARAC/src/larac/options/LaraOptionProvider.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2013 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ -package larac.options; - -import larac.options.optionprovider.ArgOption; -import larac.options.optionprovider.Descriptor; -import larac.options.optionprovider.OptionProvider; -import larac.options.optionprovider.OptionUtils; -import larac.utils.output.MessageConstants; -import pt.up.fe.specs.util.providers.KeyProvider; - -public enum LaraOptionProvider implements OptionProvider, KeyProvider { - - /* Options with no arguments */ - // Show help message - help(OptionUtils.newDescriptor("help", "h", ArgOption.NO_ARGS, MessageConstants.HELP_DESC)), - // Show version - version(OptionUtils.newDescriptor("version", "v", ArgOption.NO_ARGS, MessageConstants.VERSION_DESC)), - // Display the Aspect-IR - aspectir(OptionUtils.newDescriptor("aspectir", "a", ArgOption.NO_ARGS, MessageConstants.SHOWXML_DESC)), - // Display all available information in the console - debug(OptionUtils.newDescriptor("debug", "d", ArgOption.NO_ARGS, MessageConstants.DEBUG_DESC)), - // Special mode to generate aspect IR for documentation purposes - documentation(OptionUtils.newDescriptor("doc", "c", ArgOption.NO_ARGS, MessageConstants.DOC_DESC)), - - /* Options with one argument */ - // Target Language - language(OptionUtils.newDescriptor("language", "l", ArgOption.ONE_ARG, "language", MessageConstants.LANGUAGE_DESC)), - // Specification Directory - xmlspec(OptionUtils.newDescriptor("xmlspec", "x", ArgOption.ONE_ARG, "dir", MessageConstants.XMLSPEC_DESC)), - // Output directory for the created files - output(OptionUtils.newDescriptor("output", "o", ArgOption.ONE_ARG, "dir", MessageConstants.OUTPUT_DESC)), - // Outputs to a file with the given name - stream(OptionUtils.newDescriptor("stream", "s", ArgOption.ONE_ARG, "file", MessageConstants.STREAM_DESC)), - // Verbose level - verbose(OptionUtils.newDescriptor("verbose", "b", ArgOption.ONE_ARG, "level", MessageConstants.VERBOSE_DESC)), - // include aspects in the given directories (separated by ';') - include(OptionUtils.newDescriptor("include", "i", ArgOption.ONE_ARG, "dir(;dir)*", MessageConstants.INCLUDE_DESC)), - resource(OptionUtils.newDescriptor("resource", "r", ArgOption.ONE_ARG, "resource(;resource)*", - MessageConstants.RESOURCE_DESC)),; - - private Descriptor descriptor; - - LaraOptionProvider(Descriptor descriptor) { - this.descriptor = descriptor; - } - - @Override - public Descriptor getKey() { - return getDescriptor(); - } - - @Override - public Descriptor getDescriptor() { - return descriptor; - } -} diff --git a/LARAC/src/larac/options/optionprovider/ArgOption.java b/LARAC/src/larac/options/optionprovider/ArgOption.java deleted file mode 100644 index f85881ba7..000000000 --- a/LARAC/src/larac/options/optionprovider/ArgOption.java +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright 2013 SPeCS Research Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.options.optionprovider; - -public enum ArgOption { - NO_ARGS, ONE_ARG, SEVERAL_ARGS, OPTIONAL_ARG, OPTIONAL_ARGS; -} \ No newline at end of file diff --git a/LARAC/src/larac/options/optionprovider/Descriptor.java b/LARAC/src/larac/options/optionprovider/Descriptor.java deleted file mode 100644 index ffadfde97..000000000 --- a/LARAC/src/larac/options/optionprovider/Descriptor.java +++ /dev/null @@ -1,148 +0,0 @@ -/** - * Copyright 2013 SPeCS Research Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.options.optionprovider; - -/** - * Description of a program option - * - * @author Tiago - * - */ -public class Descriptor { - - private String name; - private String shortName; - private ArgOption numOfArguments; - private String argumentName; - private String description; - - /** - * Creates a new Descriptor - * - * @param name - * the name of the option - * @param shortName - * short version for the option - * @param numOfArguments - * number of arguments the option requires (see {@link ArgOption} - * ) - * @param description - * a description for the option - */ - public Descriptor(String name, String shortName, ArgOption numOfArguments, String description) { - setName(name); - setShortName(shortName); - setNumOfArguments(numOfArguments); - setArgumentName(null); - setDescription(description); - } - - /** - * Creates a new Descriptor (with a name for the option argument) - * - * @param name - * the name of the option - * @param shortName - * short version for the option - * @param numOfArguments - * number of arguments the option requires (see {@link ArgOption} - * ) - * @param description - * a description for the option - */ - public Descriptor(String name, String shortName, ArgOption numOfArguments, String argumentName, - String description) { - setName(name); - setShortName(shortName); - setNumOfArguments(numOfArguments); - setArgumentName(argumentName); - setDescription(description); - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the shortName - */ - public String getShortName() { - return shortName; - } - - /** - * @return the numOfArguments - */ - public ArgOption getNumOfArguments() { - return numOfArguments; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param name - * the name to set - */ - protected void setName(String name) { - this.name = name; - } - - /** - * @param shortName - * the shortName to set - */ - protected void setShortName(String shortName) { - this.shortName = shortName; - } - - /** - * @param numOfArguments - * the numOfArguments to set - */ - protected void setNumOfArguments(ArgOption numOfArguments) { - this.numOfArguments = numOfArguments; - } - - /** - * @param description - * the description to set - */ - protected void setDescription(String description) { - this.description = description; - } - - /** - * @return the argumentName - */ - public String getArgumentName() { - return argumentName; - } - - /** - * @param argumentName - * the argumentName to set - */ - protected void setArgumentName(String argumentName) { - this.argumentName = argumentName; - } - -} diff --git a/LARAC/src/larac/options/optionprovider/OptionProvider.java b/LARAC/src/larac/options/optionprovider/OptionProvider.java deleted file mode 100644 index a46cd6bc1..000000000 --- a/LARAC/src/larac/options/optionprovider/OptionProvider.java +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright 2013 SPeCS Research Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.options.optionprovider; - -public interface OptionProvider { - public Descriptor getDescriptor(); -} \ No newline at end of file diff --git a/LARAC/src/larac/options/optionprovider/OptionUtils.java b/LARAC/src/larac/options/optionprovider/OptionUtils.java deleted file mode 100644 index 6a168f87d..000000000 --- a/LARAC/src/larac/options/optionprovider/OptionUtils.java +++ /dev/null @@ -1,271 +0,0 @@ -/** - * Copyright 2013 SPeCS Research Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.options.optionprovider; - -import java.io.ByteArrayOutputStream; -import java.io.PrintWriter; -import java.nio.charset.StandardCharsets; -import java.util.List; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.CommandLineParser; -import org.apache.commons.cli.DefaultParser; -import org.apache.commons.cli.HelpFormatter; -import org.apache.commons.cli.Option; -import org.apache.commons.cli.Option.Builder; -import org.apache.commons.cli.Options; -import org.apache.commons.cli.ParseException; - -import larac.exceptions.LARACompilerException; -import pt.up.fe.specs.util.SpecsEnums; -import pt.up.fe.specs.util.providers.KeyProvider; - -/** - * Utility class for Options creation and parsing. - * - * @author Tiago - * - */ -public class OptionUtils { - - /** - * Parse and create a {@link CommandLine} for the given input arguments for the {@link Options} available - * - * @param options - * @param args - * @param cmdLineSyntax - * @return - */ - public static CommandLine parseOptions(Options options, String[] args, String cmdLineSyntax) { - - try { - - final CommandLineParser parser = new DefaultParser(); - return parser.parse(options, args); - - } catch (final ParseException e) { - String message = e.getMessage() + "\n"; - final HelpFormatter formatter = new HelpFormatter(); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - PrintWriter pw = new PrintWriter(baos); - formatter.printHelp(pw, formatter.getWidth(), cmdLineSyntax, "Options:", options, - formatter.getLeftPadding(), - formatter.getDescPadding(), null, false); - pw.flush(); - String usage = new String(baos.toByteArray(), StandardCharsets.UTF_8); - // System.out.println("->" + usage); - message += usage; - throw new LARACompilerException("when processing options", new LARACompilerException(message)); - // System.out.println(message); - // help(cmdLineSyntax, options); - } - // return null; - } - - /** - * Print a help message of how to use the application and its options - * - * @param cmdLineSyntax - * the syntax one should use to execute the application - * @param options - * the options of the application - */ - public static void help(String cmdLineSyntax, Options options) { - - final HelpFormatter formatter = new HelpFormatter(); - formatter.printHelp(cmdLineSyntax, options); - } - - /** - * Create a new {@link Options} instance containing the enumerated options in optionsEnum (implementing - * {@link OptionProvider}). - * - * @param optionsEnum - * an enum implementing {@link OptionProvider} and {@link KeyProvider}<{@link Descriptor}> - * @return - */ - public static & OptionProvider & KeyProvider> Options optionsBuilder( - Class optionsEnum) { - - final Options options = new Options(); - final List descriptors = SpecsEnums.getKeys(optionsEnum); - - for (final Descriptor desc : descriptors) { - final Option newOpt = newOption(desc); - options.addOption(newOpt); - } - return options; - } - - /** - * Build an option according to a {@link Descriptor} - * - * @param descriptor - * @return - */ - public static Option newOption(Descriptor descriptor) { - final String shortName = descriptor.getShortName(); - - Builder builder; - - if (shortName == null) { - builder = Option.builder(); - } else { - builder = Option.builder(shortName); - } - - builder.longOpt(descriptor.getName()); - switch (descriptor.getNumOfArguments()) { - case ONE_ARG: - builder.hasArg(); - break; - case SEVERAL_ARGS: - builder.hasArgs(); - break; - case OPTIONAL_ARG: - builder.hasArg(); - builder.optionalArg(true); - break; - case OPTIONAL_ARGS: - builder.optionalArg(true); - builder.hasArgs(); - break; - default: - break; - } - - final String argumentName = descriptor.getArgumentName(); - if (argumentName != null) { - builder.argName(argumentName); - } - - builder.desc(descriptor.getDescription()); - - return builder.build(); - } - - /** - * Create a new Option Descriptor (see {@link Descriptor}) - * - * @param name - * @param shortName - * @param numOfArguments - * @param description - * @return - */ - public static Descriptor newDescriptor(String name, String shortName, ArgOption numOfArguments, - String description) { - return new Descriptor(name, shortName, numOfArguments, description); - } - - /** - * Create a new Option Descriptor, with an argument description (see {@link Descriptor}) - * - * @param name - * @param shortName - * @param numOfArguments - * @param argumentName - * @param description - * @return - */ - public static Descriptor newDescriptor(String name, String shortName, ArgOption numOfArguments, String argumentName, - String description) { - return new Descriptor(name, shortName, numOfArguments, description); - } - - /** - * Get the descriptor of an option with a specific shortName - * - * @param options - * Enum, implementing {@link OptionProvider}, containing the options - * @param shortName - * the short version of an option to search - * @return a {@link Descriptor} containing the option description - */ - public static & OptionProvider & KeyProvider> Descriptor getDescriptionByShortName( - Class options, String shortName) { - - final List descriptors = SpecsEnums.getKeys(options); - - for (final Descriptor desc : descriptors) { - if (desc.getShortName().equals(shortName)) { - return desc; - } - } - return null; - } - - /** - * Get the enum referent to an option with a specific shortName - * - * @param optionsEnum - * Enum, implementing {@link OptionProvider}, containing the options - * @param shortName - * the short version of an option to search - * @return the enum containing the option description - */ - public static & OptionProvider & KeyProvider> K getOptionByShortName( - Class optionsEnum, String shortName) { - final K[] optionsList = optionsEnum.getEnumConstants(); - for (final K opt : optionsList) { - if (opt.getDescriptor().getShortName().equals(shortName)) { - return opt; - } - } - return null; - } - - /** - * Verifies if an option exists in a given Enum implementing {@link OptionProvider} - * - * @param options - * Enum containing the options - * @param shortName - * the short version of an option to search - * @return a {@link Descriptor} containing the option description - */ - public static & OptionProvider & KeyProvider> boolean contains(Class options, - String optionName) { - - final List descriptors = SpecsEnums.getKeys(options); - - for (final Descriptor desc : descriptors) { - if (desc.getName().equals(optionName)) { - return true; - } - } - return false; - } - - /** - * Verifies if an option exists in a given Enum implementing {@link OptionProvider} - * - * @param optionsEnum - * Enum containing the options - * @param shortName - * the short version of an option to search - * @return a {@link Descriptor} containing the option description - */ - public static & OptionProvider & KeyProvider> K getOptionByName(Class optionsEnum, - String optionName) { - - final K[] optionsList = optionsEnum.getEnumConstants(); - for (final K opt : optionsList) { - if (opt.getDescriptor().getName().equals(optionName)) { - return opt; - } - } - return null; - } -} diff --git a/LARAC/src/larac/options/resources/InputStreamProvider.java b/LARAC/src/larac/options/resources/InputStreamProvider.java deleted file mode 100644 index f8486c21f..000000000 --- a/LARAC/src/larac/options/resources/InputStreamProvider.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.options.resources; - -import java.io.InputStream; - -public interface InputStreamProvider { - - public InputStream getInputStream(); -} diff --git a/LARAC/src/larac/structure/AspectIR.java b/LARAC/src/larac/structure/AspectIR.java deleted file mode 100644 index 309830f80..000000000 --- a/LARAC/src/larac/structure/AspectIR.java +++ /dev/null @@ -1,419 +0,0 @@ -/** - * Copyright 2013 SPeCS Research Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.structure; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.dojo.jsl.parser.ast.ASTAspectDef; -import org.dojo.jsl.parser.ast.ASTStart; -import org.dojo.jsl.parser.ast.SimpleNode; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.LaraC; -import larac.exceptions.AspectIRException; -import larac.exceptions.LARACompilerException; -import larac.exceptions.LaraException; -import larac.utils.output.MessageConstants; - -/** - * Class for creating an Aspect-Intermediate Representation (Aspect-IR) - * - * @author Tiago - * - */ -public class AspectIR { - private int codeCount; - // private ASTCompositeReference compositeReference; - private ASTStart ast; - // private Map codedefs; - private List aspectdefs; - private Map importedAspectDefs; - private Map globalElements; - private StringBuffer xml; - private final LaraC lara; - private static int globalUID = 0; - - public AspectIR(LaraC lara) { - this.lara = lara; - codeCount = 0; - // codedefs = new HashMap<>(); - aspectdefs = new ArrayList<>(); - importedAspectDefs = new HashMap<>(); - setGlobalElements(new LinkedHashMap<>()); - xml = null; - } - - /** - * * Organize the AST containing the aspects, according to the target language specification, to agree with the - * Aspect-IR structure specification - * - */ - public void organize() { - try { - ast.organize(lara); - } catch (Exception e) { - throw new AspectIRException(e); - } - - } - - /** - * Generate Aspect-IR as an org.w3c.dom.Document instance - * - * @return the Aspect-IR Document instance - */ - public Document toXML() { - final DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder; - try { - docBuilder = dbfac.newDocumentBuilder(); - final Document doc = docBuilder.newDocument(); - final Element root = doc.createElement("aspects"); - if (!aspectdefs.isEmpty()) { - // return doc; - root.setAttribute("main", aspectdefs.get(0).getName()); - } else { - root.setAttribute("main", ""); - } - doc.appendChild(root); - - for (final ASTAspectDef aspect : aspectdefs) { - aspect.toXML(doc, root); - } - for (final ASTAspectDef aspect : importedAspectDefs.values()) { - aspect.toXML(doc, root); - } - for (final SimpleNode node : globalElements.values()) { - node.globalToXML(doc, root); - } - return doc; - } catch (final ParserConfigurationException e) { - throw new LARACompilerException("When generating Aspect-IR", e); - } - - } - - /** - * Add a new Codedef to the Codedefs' hashmap - * - * @param name - * Codedef identifier - * @param codedef - * the Codedef instance - */ - // public void addCodeDef(String name, ASTCodeDef codedef) { - // if (codedefs.containsKey(name)) { - // throw new LARACompilerException("Duplicated name for codedef \"" + name + "\""); - // } - // codedefs.put(name, codedef); - // } - - /** - * Add a new AspectDef to the AspectDefs' List - * - * @param name - * @param aspectdef - */ - public void addAspectDef(String name, ASTAspectDef aspectdef) { - if (aspectdefs.contains(aspectdef)) { - throw new LARACompilerException("Duplicated name for aspectdef \"" + name + "\""); - } - if (globalElements.containsKey(name)) { - - throw new LaraException( - "Found an aspect with the same name as a declaration: " + name + "."); - } - aspectdefs.add(aspectdef); - } - - /** - * Return the AspectDef according to its name, or null if the AspectDef does not exist in the List - * - * @param name - * the name of the Aspect to be returned - * @return the corresponding AspectDef, or null if the AspectDef does not exist - */ - public ASTAspectDef getAspectDef(String name) { - for (final ASTAspectDef asp : aspectdefs) { - if (asp.getName().equals(name)) { - return asp; - } - } - return null; - } - - /** - * Get an imported AspectDef - * - * @param name - * @return - */ - public ASTAspectDef getImportedAspectDef(String name) { - ASTAspectDef asp = importedAspectDefs.get(name); - if (asp != null) { - return asp; - } - String lastName = ""; - final String endingName = MessageConstants.NAME_SEPARATOR + name; - for (final String key : importedAspectDefs.keySet()) { - if (key.endsWith(endingName)) { - if (asp != null) { - // String error = "Found more than one aspect with the same - // name in different files for '" + name - final String error = "Found more than one aspect with name '" + name + "' in different files.\n" - + "\tTwo of them are \"" + lastName.replace(MessageConstants.NAME_SEPARATOR, ".") - + "\" and \"" + key.replace(MessageConstants.NAME_SEPARATOR, ".") - + "\".\n\tPlease refine which is the intended aspect."; - throw new LARACompilerException(error); - } - - asp = importedAspectDefs.get(key); - lastName = key; - } - - } - if (asp != null) { - return asp; - } - for (LaraC laraC : lara.getPreviouslyImportedLARA()) { - List aspectdefs2 = laraC.getAspectIR().getAspectdefs(); - for (ASTAspectDef astAspectDef : aspectdefs2) { - String nameWPrefix = laraC.getPrefix() + astAspectDef.getName(); - if (nameWPrefix.endsWith(endingName)) { - - return astAspectDef; - } - } - asp = laraC.getAspectIR().getImportedAspectDef(name); - if (asp != null) { - return asp; - } - } - return asp; - } - - /** - * Get a codedef based on its name - * - * @param codeName - * @return - */ - // public ASTCodeDef getCodedef(String codeName) { - // - // return codedefs.get(codeName); - // } - - /** - * Prints the aspects intermediate representation - */ - public void printIR() { - // lara.println("CodeDefs"); - // for (final ASTCodeDef code : codedefs.values()) { - // code.printIR(); - // } - lara.println("AspectDefs"); - for (final ASTAspectDef aspect : aspectdefs) { - aspect.printIR(); - } - lara.println("Declarations (TODO)"); - // for (final SimpleNode node : globalElements.values()) { - // node.printIR(); - // } - } - - /** - * @return the codeCount - */ - public int getCodeCount() { - return codeCount; - } - - /** - * @param codeCount - * the codeCount to set - */ - public void setCodeCount(int codeCount) { - this.codeCount = codeCount; - } - - // /** - // * @return the compositeReference - // */ - // public ASTCompositeReference getCompositeReference() { - // return compositeReference; - // } - // - // /** - // * @param compositeReference - // * the compositeReference to set - // */ - // public void setCompositeReference(ASTCompositeReference compositeReference) { - // this.compositeReference = compositeReference; - // } - - /** - * @return the ast - */ - public ASTStart getAst() { - return ast; - } - - /** - * @param ast - * the ast to set - */ - public void setAst(ASTStart ast) { - this.ast = ast; - } - - /** - * @return the codedefs - */ - // public Map getCodedefs() { - // return codedefs; - // } - - /** - * @param codedefs - * the codedefs to set - */ - // public void setCodedefs(Map codedefs) { - // this.codedefs = codedefs; - // } - - /** - * @return the aspectdefs - */ - public List getAspectdefs() { - return aspectdefs; - } - - /** - * @param aspectdefs - * the aspectdefs to set - */ - public void setAspectdefs(List aspectdefs) { - this.aspectdefs = aspectdefs; - } - - /** - * @return the importedAspectDefs - */ - public Map getImportedAspectDefs() { - return importedAspectDefs; - } - - /** - * @param importedAspectDefs - * the importedAspectDefs to set - */ - public void setImportedAspectDefs(Map importedAspectDefs) { - this.importedAspectDefs = importedAspectDefs; - } - - /** - * @return the xml - */ - public StringBuffer getXml() { - return xml; - } - - /** - * @param xml - * the xml to set - */ - public void setXml(StringBuffer xml) { - this.xml = xml; - } - - /** - * Generate a new name for a code - * - * @return - */ - public String generateNewCodeName() { - final String codeName = lara.getLaraName() + "_code_" + codeCount++; - return codeName; - } - - public Map getGlobalElements() { - return globalElements; - } - - public void addGlobalElement(String name, SimpleNode element) { - addGlobalElement(name, element, lara.getLaraPath()); - } - - public void addGlobalStatement(SimpleNode element) { - addGlobalStatement(element, lara.getLaraPath()); - } - - public void addGlobalStatement(SimpleNode element, String origin) { - addGlobalElement("statement" + newGlobalUID(), element, origin); - } - - private static int newGlobalUID() { - - return globalUID++; - } - - public void addGlobalElement(String name, SimpleNode element, String origin) { - if (globalElements.containsKey(name)) { - String location; - String laraPath = lara.getLaraPath(); - if (laraPath.equals(origin)) { - location = "both in file " + origin; - } else { - location = "one in file " + lara.getLaraFile() + " other in file " + origin; - } - throw new LaraException("Two Declarations with the same name: " + name + ". " + location + "."); - } - boolean foundAspect = aspectdefs.stream().anyMatch(aspect -> aspect.getName().equals(name)); - if (foundAspect) { - String location; - String laraPath = lara.getLaraPath(); - if (laraPath.equals(origin)) { - location = "both in file " + origin; - } else { - location = "aspect in file " + laraPath + ", declaration in file " + origin; - } - throw new LaraException( - "Found an aspect with the same name as a declaration: " - + name + ". " + location + "."); - } - globalElements.put(name, element); - } - - public void setGlobalElements(Map globalElements) { - this.globalElements = globalElements; - } - - public boolean containsGlobal(String var) { - return globalElements.containsKey(var); - } - - public SimpleNode getGlobal(String var) { - return globalElements.get(var); - } - -} \ No newline at end of file diff --git a/LARAC/src/larac/structure/AspectView.java b/LARAC/src/larac/structure/AspectView.java deleted file mode 100644 index 087b92341..000000000 --- a/LARAC/src/larac/structure/AspectView.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.structure; - -/** - * Simple view of an aspect, containing a name, a list of inputs and list of outputs - * - * @author Tiago - * - */ -public class AspectView { - - // private String name; - // private List inputs; - // private String name; - -} diff --git a/LARAC/src/larac/utils/FileUtils.java b/LARAC/src/larac/utils/FileUtils.java deleted file mode 100644 index ade82714e..000000000 --- a/LARAC/src/larac/utils/FileUtils.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright 2013 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ -package larac.utils; - -import java.awt.Panel; -import java.awt.TextField; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.HashMap; - -import javax.swing.JFileChooser; -import javax.swing.filechooser.FileFilter; - -import larac.utils.output.NormalMsg; -import larac.utils.output.Output; -import pt.up.fe.specs.util.SpecsIo; - -public class FileUtils { - public enum Commands { - ASPECT, - LANGUAGE, - RESOURCE, - XML, - OUTPUT, - WORKSPACE, - LOAD, - SAVE, - SAVEAS, - CLEAR, - GENERATE, - OPEN - } - - public static FileFilter aspectFilter = new FileFilter() { - String extension = ".lara"; - - @Override - public String getDescription() { - return "Aspect File (" + extension + ")"; - } - - @Override - public boolean accept(File arg0) { - if (arg0.isDirectory()) { - return true; - } - if (arg0.getName().contains(extension)) { - return true; - } - - return false; - } - }; - public static FileFilter txtFilter = new FileFilter() { - String extension = ".txt"; - - @Override - public String getDescription() { - return "Resource File (" + extension + ")"; - } - - @Override - public boolean accept(File arg0) { - if (arg0.isDirectory()) { - return true; - } - if (arg0.getName().contains(extension)) { - return true; - } - - return false; - } - }; - public static FileFilter dirFilter = new FileFilter() { - @Override - public String getDescription() { - return "Directory"; - } - - @Override - public boolean accept(File arg0) { - if (arg0.isDirectory()) { - return true; - } - return false; - } - }; - public static FileFilter dirXMLFilter = new FileFilter() { - @Override - public String getDescription() { - return "XMLs Directory"; - } - - @Override - public boolean accept(File arg0) { - if (arg0.isDirectory()) { - return true; - } - return false; - } - }; - - /** - * - * @param app - * @param fc - * @param ff - * @param txtField - * @param type - */ - public static void processJFileChooser(Panel app, JFileChooser fc, FileFilter ff, TextField txtField, int type) { - fc.setFileSelectionMode(type); - fc.setFileFilter(ff); - final int returnValue = fc.showDialog(app, "Open"); - switch (returnValue) { - case JFileChooser.APPROVE_OPTION: - txtField.setText(fc.getSelectedFile().getPath()); - break; - default: - break; - } - } - - public static String processSaveFileChooser(Panel app, JFileChooser fc, FileFilter ff, String title, int type) { - fc.setFileSelectionMode(type); - fc.setFileFilter(ff); - - final int returnValue = fc.showSaveDialog(app); - switch (returnValue) { - case JFileChooser.APPROVE_OPTION: - return fc.getSelectedFile().getPath(); - default: - break; - } - return ""; - } - - public static File processOpenFileChooser(Panel app, JFileChooser fc, FileFilter ff, String title, int type) { - fc.setFileSelectionMode(type); - fc.setFileFilter(ff); - - final int returnValue = fc.showOpenDialog(app); - switch (returnValue) { - case JFileChooser.APPROVE_OPTION: - return fc.getSelectedFile(); - default: - break; - } - return null; - } - - public static void toFile(String filePath, String extension, String text, File outputDir) { - final File outputFile = new File(outputDir, filePath + extension); - System.out.println("Writing to file: " + outputFile.getAbsolutePath()); - SpecsIo.write(outputFile, text); - } - - public static void toFile(Output printStream, String filePath, String extension, String text, File outputDir) { - final File outputFile = new File(outputDir, filePath + extension); - printStream.println("Writing to file: " + outputFile.getAbsolutePath()); - SpecsIo.write(outputFile, text); - } - - public static String fromFile(File f) { - new NormalMsg().println("Opening file: " + f.getPath()); - return SpecsIo.read(f); - - } - - public static boolean getExamplesFromDir(String dirName, HashMap files) { - final File dir = new File(dirName); - if (!dir.exists() || !dir.isDirectory()) { - new NormalMsg().println("Directory not found: " + dirName); - return false; - } - final String path = dir.getPath() + "\\"; - for (final String fileName : dir.list()) { - final File f = new File(path + fileName); - if (f.isDirectory()) { - getExamplesFromDir(path + fileName, files); - } else if (f.getPath().endsWith(".lara") || f.getPath().endsWith(".js")) { - String key = f.getPath(); - if (key.contains(File.separator)) { - key = key.substring(key.lastIndexOf(File.separator) + 1); - } - try (FileReader fr = new FileReader(f.getPath()); BufferedReader br = new BufferedReader(fr);) { - - String line; - String aspectCode = ""; - while ((line = br.readLine()) != null) { - aspectCode += line + "\n"; - } - files.put(key, aspectCode); - } catch (final IOException e) { - System.err.println(e.getLocalizedMessage() + "\n"); - return false; - } - - } - } - return true; - } - - public static boolean removeDirectory(File directory) { - if (directory == null || !directory.exists() || !directory.isDirectory()) { - return false; - } - final String[] list = directory.list(); - if (list != null) { - for (int i = 0; i < list.length; i++) { - final File entry = new File(directory, list[i]); - if (entry.isDirectory() && !removeDirectory(entry)) { - return false; - } else if (!entry.delete()) { - return false; - } - } - } - return directory.delete(); - } -} diff --git a/LARAC/src/larac/utils/OrganizeUtils.java b/LARAC/src/larac/utils/OrganizeUtils.java deleted file mode 100644 index 4bb6b7cc4..000000000 --- a/LARAC/src/larac/utils/OrganizeUtils.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright 2013 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ -package larac.utils; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.dojo.jsl.parser.ast.ASTExpressionStatement; -import org.dojo.jsl.parser.ast.LARAEcmaScript; -import org.dojo.jsl.parser.ast.ParseException; -import org.dojo.jsl.parser.ast.SimpleNode; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import larac.exceptions.LARACompilerException; -import larac.objects.Enums; -import larac.objects.Enums.Types; - -public class OrganizeUtils { - private static final String VALUE_ARGUMENT_NAME = "value"; - - private static final String ATTRIBUTE_ARGUMENT_NAME = "attribute"; - private static final String CODE_ARGUMENT_NAME = "code"; - private static final String POSITION_ARGUMENT_NAME = "position"; - public String space = ""; - public static final String IDENT_STR = " "; - public String fileName = ""; - public int condNum = 0; - public int applyNum = 0; - public int codeNum = 0; - - public static ArrayList getDirectChilds(Element joinPoint, String tag) { - final ArrayList childs = new ArrayList<>(); - final NodeList nodeList = joinPoint.getChildNodes(); - for (int i = 0; i < nodeList.getLength(); i++) { - if (nodeList.item(i).getNodeName().equals(tag)) { - childs.add(nodeList.item(i)); - } - } - return childs; - } - - public static ArrayList getDescendantNodes(Element el, ArrayList tags, int pos) { - final String tag = tags.get(pos++); - final ArrayList nodes = getDirectChilds(el, tag); - if (tags.size() == pos) { - return nodes; - } - final ArrayList finalNodes = new ArrayList<>(); - for (final Node n : nodes) { - final Element elChild = (Element) n; - finalNodes.addAll(getDescendantNodes(elChild, tags, pos)); - } - return finalNodes; - } - - // @Deprecated - // public static Map createOutputActionParameters(LanguageSpecification spec) { - // final Map args = new LinkedHashMap<>(); - // final ActionArgument code = new ActionArgument(OrganizeUtils.CODE_ARGUMENT_NAME, "template", spec); - // args.put(OrganizeUtils.CODE_ARGUMENT_NAME, code); - // return args; - // } - - /** - * - */ - - private static final Pattern CODE_REGEX = Pattern.compile(Enums.INSERT_SYMBOL_REGEX); - - public static List getTagValues(final String str) { - final List tagValues = new ArrayList<>(); - final Matcher matcher = OrganizeUtils.CODE_REGEX.matcher(str); - while (matcher.find()) { - tagValues.add(matcher.group(1)); - } - return tagValues; - } - - public static String firstCharToUpper(String string) { - return charToUpper(string, 0); - } - - public static String charToUpper(String string, int pos) { - if (pos < 0 || pos >= string.length()) { - throw new StringIndexOutOfBoundsException(pos); - } - String ret = string.substring(0, pos); - ret += string.substring(pos, pos + 1).toUpperCase(); - ret += string.substring(pos + 1); - return ret; - } - - /** - * Create an element, inside the document, as an undefined literal type, as child of the given element - * - * @param doc - * @param parent - */ - public static void createLiteralUndefined(Document doc, Element parent) { - final Element litEl = doc.createElement("literal"); - litEl.setAttribute("type", Types.Undefined.toString()); - litEl.setAttribute("value", Types.Undefined.toString()); - parent.appendChild(litEl); - } - - /** - * Parse an arbitrary string as an expression statement and returns the expression itself - * - * @param code - * the code to parse - * @return the expression node - */ - public static SimpleNode parseExpression(String code) { - InputStream is = new ByteArrayInputStream(code.getBytes()); - LARAEcmaScript parser = new LARAEcmaScript(is); - try { - - ASTExpressionStatement parseExpression = parser.parseExpression(code); - if (parseExpression.jjtGetNumChildren() == 0) { - throw new RuntimeException("Expression is empty"); - } - if (parseExpression.jjtGetNumChildren() != 1) { - throw new RuntimeException("More than one expression was given"); - } - return parseExpression.getChild(0); - // return parseExpression; - } catch (ParseException e) { - RuntimeException simpleE = new RuntimeException(e.getMessage()); - throw new LARACompilerException("Problems when parsing code parameter: " + code, simpleE); - - } catch (Exception e) { - - throw new LARACompilerException("Problems when parsing code parameter: " + code, e); - } - - } - - public String getSpace() { - return space; - } - - public void setSpace(String space) { - this.space = space; - } - - public String getFileName() { - return fileName; - } - - public void setFileName(String fileName) { - this.fileName = fileName; - } - - public int getCondNum() { - return condNum; - } - - public void setCondNum(int condNum) { - this.condNum = condNum; - } - - public int getApplyNum() { - return applyNum; - } - - public void setApplyNum(int applyNum) { - this.applyNum = applyNum; - } - - public int getCodeNum() { - return codeNum; - } - - public void setCodeNum(int codeNum) { - this.codeNum = codeNum; - } - - public static String getValueArgumentName() { - return OrganizeUtils.VALUE_ARGUMENT_NAME; - } - - public static String getAttributeArgumentName() { - return OrganizeUtils.ATTRIBUTE_ARGUMENT_NAME; - } - - public static String getCodeArgumentName() { - return OrganizeUtils.CODE_ARGUMENT_NAME; - } - - public static String getPositionArgumentName() { - return OrganizeUtils.POSITION_ARGUMENT_NAME; - } - - public static String getIdentStr() { - return OrganizeUtils.IDENT_STR; - } - - public static Pattern getCodeRegex() { - return OrganizeUtils.CODE_REGEX; - } -} diff --git a/LARAC/src/larac/utils/Organizer.java b/LARAC/src/larac/utils/Organizer.java deleted file mode 100644 index 792d3371b..000000000 --- a/LARAC/src/larac/utils/Organizer.java +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Copyright 2020 SPeCS. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larac.utils; - -import larac.objects.Enums.Types; -import larac.utils.xml.entity.ActionArgument; -import org.lara.language.specification.dsl.Action; -import org.lara.language.specification.dsl.JoinPointClass; -import org.lara.language.specification.dsl.LanguageSpecification; -import org.lara.language.specification.dsl.types.TypeDef; -import tdrc.utils.StringUtils; - -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * Methods for organization of the LARA AST. - * - * @author jbispo - * - */ -public class Organizer { - - private static final String CODE_ARGUMENT_NAME = "code"; - private static final String POSITION_ARGUMENT_NAME = "position"; - private static final String VALUE_ARGUMENT_NAME = "value"; - private static final String ATTRIBUTE_ARGUMENT_NAME = "attribute"; - - private final LanguageSpecification langSpec; - - public Organizer(LanguageSpecification langSpec) { - this.langSpec = langSpec; - } - - public Map createActionParameters(final Action act) { - Map args = new LinkedHashMap<>(); - for (var param : act.getParameters()) { - - final ActionArgument actionArgument = new ActionArgument(param.getDeclaration().getName(), - param.getDeclaration().getType().getType(), this); - - var defaultValue = param.getDefaultValue(); - if (!defaultValue.isEmpty()) { - actionArgument.setValue(defaultValue); - } - args.put(param.getDeclaration().getName(), actionArgument); - } - return args; - } - - public Types getConvertedType(String typeStr) { - - final Types type = Types.value(typeStr); - if (type != null) { - return type; - } - if (typeStr.contains("[]")) { - return Types.Array; - } - - // if the object declaration exist in the artifacts - if (langSpec.hasTypeDef(typeStr)) { - return Types.Object; - } - // if it is a join point class - if (langSpec.hasJoinPointName(typeStr)) { - return Types.Joinpoint; - } - - // If it does not exist, throw an exception with the error message and - // the possible - // types that can be used - final StringBuilder message = new StringBuilder("Could not convert type '" + type + "'. Available types: "); - - final StringBuilder availableTypes = reportAvailableTypes(); - message.append(availableTypes); - - throw new RuntimeException(message.toString()); - } - - private StringBuilder reportAvailableTypes() { - final StringBuilder message = new StringBuilder("\n\t Primitives: "); - message.append(StringUtils.join(Arrays.asList(Types.values()), ", ")); - // message.append(", Object, Array, Map, Template, Joinpoint"); - - final Collection objects = langSpec.getTypeDefs().values(); - if (!objects.isEmpty()) { - - message.append("\n\t Defined types: "); - final String objectsString = StringUtils.join(objects, TypeDef::getName, ", "); - message.append(objectsString); - } - - var joinpoints = langSpec.getJoinPoints().values(); - if (!joinpoints.isEmpty()) { - - message.append("\n\t Join point types: "); - final String jpsString = StringUtils.join(joinpoints, JoinPointClass::getName, ", "); - message.append(jpsString); - } - return message; - } - - public Map createInsertParameters() { - final Map args = new LinkedHashMap<>(); - - final ActionArgument when = new ActionArgument(POSITION_ARGUMENT_NAME, "string", this); - args.put(POSITION_ARGUMENT_NAME, when); - final ActionArgument code = new ActionArgument(CODE_ARGUMENT_NAME, "template", this); - args.put(CODE_ARGUMENT_NAME, code); - return args; - } - - public Map createDefParameters() { - final Map args = new LinkedHashMap<>(); - - final ActionArgument attribute = new ActionArgument(ATTRIBUTE_ARGUMENT_NAME, "string", this); - args.put(ATTRIBUTE_ARGUMENT_NAME, attribute); - final ActionArgument value = new ActionArgument(VALUE_ARGUMENT_NAME, "Object", this); - args.put(VALUE_ARGUMENT_NAME, value); - return args; - } -} diff --git a/LARAC/src/larac/utils/output/ErrorMsg.java b/LARAC/src/larac/utils/output/ErrorMsg.java deleted file mode 100644 index a9f5bf780..000000000 --- a/LARAC/src/larac/utils/output/ErrorMsg.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2013 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ -package larac.utils.output; - -import java.io.PrintStream; - -public class ErrorMsg extends Message { - private static final String ERROR = "[Error] "; - - public ErrorMsg(PrintStream stream) { - super(stream, true); - tag = ErrorMsg.ERROR; - } - - public ErrorMsg() { - super(System.out, true); - tag = ErrorMsg.ERROR; - } - - public static void say(String message) { - // LoggingUtils.msgWarn(message); - Message.defaulOutput.println(ErrorMsg.ERROR + message); - } -} diff --git a/LARAC/src/larac/utils/output/Message.java b/LARAC/src/larac/utils/output/Message.java deleted file mode 100644 index f6efab3c0..000000000 --- a/LARAC/src/larac/utils/output/Message.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2013 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ -package larac.utils.output; - -import java.io.PrintStream; - -public class Message { - private final PrintStream output; - protected static PrintStream defaulOutput = System.out; - protected String tag = ""; - - @SuppressWarnings("unused") - private final boolean showStackTrace; - - protected Message(PrintStream stream, boolean showStackTrace) { - output = stream; - this.showStackTrace = showStackTrace; - } - - public Message() { - this(System.out, false); - // output = System.out; - } - - public Message(PrintStream stream) { - this(stream, false); - // output = stream; - } - - public void print(String s) { - output.print(MessageConstants.space + tag + s); - /* - * if (showStackTrace) { LoggingUtils.msgWarn(s); } - */ - } - - public void println(String s) { - print(s + "\n"); - } - - public static void say(String message) { - Message.defaulOutput.println(message); - } - - public PrintStream getStream() { - // TODO Auto-generated method stub - return output; - } -} diff --git a/LARAC/src/larac/utils/output/MessageConstants.java b/LARAC/src/larac/utils/output/MessageConstants.java deleted file mode 100644 index 3661833f0..000000000 --- a/LARAC/src/larac/utils/output/MessageConstants.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2013 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ -package larac.utils.output; - -import java.io.File; - -import larac.objects.Variable; - -/** - * Class containing all the predefined messages used on Lara - * - * @author Tiago Carvalho - * - */ -public class MessageConstants { - - // Ai ai, this should not be a global - public static int order = 1; - - public static final String HELP_DESC = "Shows this message"; - public static final String DEBUG_DESC = "Enter debug mode, i.e., reply all the possible information"; - public static final String DOC_DESC = "Compiles in documentation mode (e.g., does not process imports)"; - public static final String VERSION_DESC = "Shows the version of the LARA language and the Front-End"; - public static final String SHOWXML_DESC = "Show Aspect-IR in the console"; - public static final String OUTPUT_DESC = "Change Output directory of resulting files. Default: ." + File.separator; - public static final String XMLSPEC_DESC = "Change language specification directory. Default: ." + File.separator; - public static final String LANGUAGE_DESC = "Change the concerning programming language. Default: C"; - public static final String VERBOSE_DESC = "Change the message level from 0(none) to 3(all). Default: 3"; - public static final String STREAM_DESC = "Change the output stream. Default: java.lang.System.out"; - public static final String INCLUDE_DESC = "Include a list of folders containing lara aspect files. Separate paths with ';'"; - public static final String RESOURCE_DESC = "Include a list of resources that reference lara aspect files. Separate paths with ';'"; - - public static final String USAGE = "usage: java -jar larac.jar ( | -gen ) [-

- * For instance, if filePath and fileName resolve to lara.EgImport, will import lara/EgImport.lara and - * lara/EgImport.js, if they exist. - * - * @param lara - * @param fileName - * @param filePath - */ - private boolean importSingleName(final LaraC lara, String fileName, String filePath) { - - // Get LARA imports - var laraImports = lara.getOptions().getLaraImports(fileName, filePath); - - laraImports.stream().forEach(laraImport -> laraImport.resolveImport(lara)); - - // true if there where imports found - return !laraImports.isEmpty(); - - /* - String relativePath = filePath + fileName; - - var foundImport = false; - - // var filesToCheck = getFilesToCheck(lara, relativePath); - - // 1. - // Check include folders - for (final File path : lara.getOptions().getIncludeFolders()) { - for (var ext : LaraC.getSupportedExtensions()) { - var importPath = relativePath + "." + ext; - - final File importingFile = new File(path, importPath); - if (importingFile.exists()) { - lara.printSubTopic("Importing " + importingFile); - LaraImports.importLaraFile(lara, importPath, importingFile); - foundImport = true; - } - } - } - - // 2. - // Check resource by filename, instead of resource name - for (var ext : LaraC.getSupportedExtensions()) { - var importPath = relativePath + "." + ext; - - var resource = lara.getOptions().getIncludeResourcesMap().get(importPath); - if (!resource.isEmpty()) { - LaraImports.importLaraResource(lara, importPath, resource.get(0)); - - // importScriptFile(lara, filepath, findFirst.get()); - foundImport = true; - } - - // Optional findFirst = lara.getOptions().getIncludeResources().stream() - // .filter(r -> r.getFileLocation().replace("/", File.separator).equals(importPath)) - // .findFirst(); - // - // if (findFirst.isPresent()) { - // importLaraResource(lara, importPath, findFirst.get()); - // - // // importScriptFile(lara, filepath, findFirst.get()); - // foundImport = true; - // } - - } - - return foundImport; - */ - } - - /* - private boolean importFromResource(final LaraC lara, String relativePath) { - - // Check resource by filename, instead of resource name - Optional findFirst = lara.getOptions().getIncludeResources().stream() - // .filter(r -> r.getResource().replace("/", File.separator).equals(relativePath)) - .filter(r -> r.getFileLocation().replace("/", File.separator).equals(relativePath)) - .findFirst(); - - if (findFirst.isPresent()) { - importLaraResource(lara, relativePath, findFirst.get()); - return true; - } - - return false; - } - */ - /* - private boolean importFromInclude(final LaraC lara, String fileName, String filePath) { - String relativePath = filePath + fileName; - - for (final File path : lara.getOptions().getIncludeFolders()) { - final File importingFile = new File(path, relativePath); - if (importingFile.exists()) { - lara.printSubTopic("Importing " + importingFile); - if (!importingFile.exists()) { - throw newException( - "Import: Could not find file '" + fileName + "' on file path: " + path + relativePath); - } - - importLaraFile(lara, relativePath, importingFile); - return true; - } - } - - return false; - } - */ - - // private List getFilesToCheck(LaraC lara, String relativePath) { - // - // var filesToCheck = new ArrayList(); - // - // for (final File path : lara.getOptions().getIncludeFolders()) { - // for (var ext : LaraC.getSupportedScriptExtensions()) { - // filesToCheck.add(relativePath + "." + ext); - // } - // } - // - // return filesToCheck; - // } - - // @Override - // public void globalToXML(Document doc, Element parent) { - // SpecsCheck.checkArgument(parent.getNodeName().equals("aspects"), - // () -> "Expected node to be 'aspects', is '" + parent.getNodeName() + "'"); - // - // // HACK: To avoid regeneration the Java classes from XML, using attributes Statement already has - // final Element statementDeclEl = doc.createElement("declaration"); - // statementDeclEl.setAttribute("name", "ScriptImport"); - // statementDeclEl.setAttribute("coord", path); - // statementDeclEl.setAttribute("desc", scriptContents.get()); - // // statementDeclEl.setAttribute("script", scriptContents.get()); - // // final Element statementDeclEl = doc.createElement("scriptImport"); - // // statementDeclEl.setNodeValue(scriptContents.get()); - // - // // System.out.println("PARENT: " + parent.getNodeName()); - // // final Element statementDeclEl = doc.createElement("scriptImport"); - // // statementDeclEl.setNodeValue(scriptContents.get()); - // // statementDeclEl.setAttribute("name", "scriptImport"); - // // statementDeclEl.setAttribute("path", path); - // // statementDeclEl.setAttribute("script", scriptContents.get()); - // // statementDeclEl.setAttribute("coord", getCoords()); - // // addXMLComent(statementDeclEl); - // parent.appendChild(statementDeclEl); - // toXML(doc, statementDeclEl); - // } - - @Override - public void toXML(Document doc, Element parent) { - // System.out.println("PARENT: " + parent.getNodeName()); - - } -} -/* - * JavaCC - OriginalChecksum=70d3639852523f4c77e45a34861ed251 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTInclude.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTInclude.java deleted file mode 100644 index 0fe75c9f9..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTInclude.java +++ /dev/null @@ -1,21 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTInclude.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -public class ASTInclude extends SimpleNode { - public ASTInclude(int id) { - super(id); - } - - public ASTInclude(LARAEcmaScript p, int id) { - super(p, id); - } - -} -/* - * JavaCC - OriginalChecksum=13a79f3491a3f2efc06dbcd9003d4157 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTInitialize.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTInitialize.java deleted file mode 100644 index 1f5ed4377..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTInitialize.java +++ /dev/null @@ -1,40 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTInitialize.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ASTInitialize extends SimpleNode { - public ASTInitialize(int id) { - super(id); - } - - public ASTInitialize(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - if (((SimpleNode) getChildren()[0]).getChildren() == null) { - return null; - } - ((SimpleNode) getChildren()[0]).organize(obj); - ((ASTAspectDef) parent).setInitialize(this); - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - final Element initEl = doc.createElement("initialize"); - parent.appendChild(initEl); - ((SimpleNode) getChildren()[0]).toXML(doc, initEl); - } -} -/* - * JavaCC - OriginalChecksum=e670fa2115c280692f65386d9b0bdfb4 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTInput.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTInput.java deleted file mode 100644 index fe9fc3262..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTInput.java +++ /dev/null @@ -1,66 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTInput.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import java.util.HashMap; - -import larac.objects.Variable; - -public class ASTInput extends SimpleNode { - public ASTInput(int id) { - super(id); - } - - public ASTInput(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - final ASTAspectDef asp = (ASTAspectDef) parent; - - // if (!asp.getInputs().isEmpty()) { - if (asp.getInputsNode() != null) { - throw newException("Can only have one input section!"); - } - asp.setInputsNode(this); - // - if (getChildren() == null) { - return null; - } - ((SimpleNode) getChildren()[0]).organize(this); - return null; - } - - @Override - public HashMap getHMVars() { - return ((ASTAspectDef) parent).getInputs(); - } - - @Override - public String toSource(int indentation) { - - String source = indent(indentation) + "input"; - if (getChildren() == null) { - return source + " end"; - } - SimpleNode child = getChild(0); - if (child instanceof ASTVariableDeclarationList) { - if (child.getChildren() != null) { - for (final Node n : child.getChildren()) { - source += "\n" + ((SimpleNode) n).toSource(indentation + 1); - } - } - } else { - source += "\n" + child.toSource(indentation + 1); - } - return source + "\n" + indent(indentation) + "end"; - } -} -/* - * JavaCC - OriginalChecksum=4e4b76905016ac2c5b045b1fa76fe04f (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTInputList.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTInputList.java deleted file mode 100644 index 0f4eb862a..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTInputList.java +++ /dev/null @@ -1,21 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTInputList.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -public class ASTInputList extends SimpleNode { - public ASTInputList(int id) { - super(id); - } - - public ASTInputList(LARAEcmaScript p, int id) { - super(p, id); - } - -} -/* - * JavaCC - OriginalChecksum=76f7005148588ad22f69afab042d69c9 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTInsert.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTInsert.java deleted file mode 100644 index e475d58d3..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTInsert.java +++ /dev/null @@ -1,315 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTInsert.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.Map; - -import javax.xml.bind.DatatypeConverter; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.objects.Enums; -import larac.objects.Enums.Types; -import larac.utils.xml.entity.ActionArgument; - -public class ASTInsert extends SimpleNode { - private String when; - private String language; - private ASTCodeDef codeDef; - private String codeFileName; - private boolean pureCode; - private final ArrayList codeParams = new ArrayList<>(); - private Map codeMapping = new LinkedHashMap<>(); - - public ASTInsert(int id) { - super(id); - } - - public ASTInsert(LARAEcmaScript p, int id) { - super(p, id); - } - - public void setWhen(String when) { - this.when = when; - value = when; - } - - public String getWhen() { - return when; - } - - @Override - public String toString() { - return LARAEcmaScriptTreeConstants.jjtNodeName[id] + " [" + when + "," + language + "]"; - } - - /** - * @param language - * the language to set - */ - public void setLanguage(String language) { - this.language = language; - } - - /** - * @return the language - */ - public String getLanguage() { - return language; - } - - /** - * @param codeMapping - * the paramMapping to set - */ - public void setCodeMapping(LinkedHashMap codeMapping) { - this.codeMapping = codeMapping; - } - - /** - * @return the paramMapping - */ - public Map getCodeMapping() { - return codeMapping; - } - - @Override - public Object organize(Object obj) { - - final ASTAction act = (ASTAction) parent; - act.setMethod("insert"); - // act.setArguments(OrganizeUtils.createInsertParameters(getLara().languageSpec())); - act.setArguments(getLara().getOrganizer().createInsertParameters()); - final Map arguments = act.getArguments(); - if (jjtGetChild(0) instanceof ASTFunctionCallParameters) { - final ASTFunctionCallParameters params = (ASTFunctionCallParameters) jjtGetChild(0); - if (params.areNamed) { - for (final Node param : params.getChildren()) { - final ASTNamedArgument na = (ASTNamedArgument) param; - if (!arguments.containsKey(na.value)) { - throw newException("The argument '" + na.value + "' does not exist for action 'insert'"); - } - final ActionArgument actArg = arguments.get(na.value); - // if (na.value.equals("code")) { - // verifyCodeDef(na.jjtGetChild(0), arguments); - // } else { - na.organize(obj); - actArg.setValue((SimpleNode) na.jjtGetChild(0)); - // } - } - } else { - if (params.getChildren().length != arguments.size()) { - throw newException("Illegal number of arguments for action 'insert'"); - } - params.getChild(0).organize(this); - arguments.get("position").setValue(params.getChild(0)); - params.getChild(1).organize(this); - arguments.get("code").setValue(params.getChild(1)); - // verifyCodeDef(params.jjtGetChild(1), arguments); - } - } else { - arguments.get("position").setValue(when); - // if (children[0] instanceof ASTLiteral) { - // ((SimpleNode) children[0]).organize(this); - // arguments.get("code").setValue((SimpleNode) children[0]); - // } else { - SimpleNode codeExpr = getChild(0); - codeExpr.organize(this); - arguments.get("code").setValue(codeExpr); - // verifyCodeDef(children[0], arguments); - // } - } - return null; - } - - /* - private void verifyCodeDef(Node node, Map arguments) { - String codeName = ""; - if (node instanceof ASTLiteral) { // This will never happen! - ((SimpleNode) node).organize(this); - - arguments.get("code").setValue((SimpleNode) node); - return; - } - if (node instanceof ASTIdentifier) { - codeName = ((ASTIdentifier) node).value.toString(); - // codeDef = getLara().aspectIR().getCodedef(codeName); - // if (codeDef == null) { - Variable lookupNoError = lookupNoError(codeName); - if (lookupNoError == null) { - // getLara().warnln("Did not find a codedef but found : " + lookupNoError.getName()); - // } else { - throw newException("No codedef nor variable was found for name '" + codeName + "'."); - } - // }else - // throw newException("No Codedef nor variable exists with name '" + codeName + "'."); - // } - } else if (node instanceof ASTCompositeReference) { - - codeName = ((ASTIdentifier) node.jjtGetChild(0)).value.toString(); - // codeDef = getLara().aspectIR().getCodedef(codeName); - final ASTFunctionCallParameters params = (ASTFunctionCallParameters) node.jjtGetChild(1); - // if (codeDef == null) { - // Variable lookupNoError = lookupNoError(codeName); - // if (lookupNoError != null) { - // getLara().warnln("Did not find a codedef but found : " + lookupNoError.getName()); - // } else { - // throw newException("No codedef nor variable was found for name '" + codeName + "'."); - // } - // params.organize(this); - // } else { - - for (final String arg : codeDef.getArguments()) { - codeMapping.put(arg, null); - } - - organizeArguments(params); - // } - - } else { - throw newException("Argument 'code' for insert is invalid."); - } - - arguments.get("code").setValue(this); - } - - private void organizeArguments(ASTFunctionCallParameters astFunctionCallParameters) { - if (astFunctionCallParameters.areNamed) { - for (final Node node : astFunctionCallParameters.getSimpleNodeChildren()) { - final ASTNamedArgument named = (ASTNamedArgument) node; - if (!codeDef.getArguments().contains(named.value)) { - throw newException("In Action 'insert': '" + named.value + "' does not exist."); - } - ((SimpleNode) named.getChildren()[0]).organize(this); - getCodeMapping().put(named.value.toString(), (SimpleNode) named.getChildren()[0]); - } - } else { - for (final SimpleNode node : astFunctionCallParameters.getSimpleNodeChildren()) { - final String arg = getParamWithNoValue(); - if (arg == null) { - throw newException("In Action 'insert': Illegal number of arguments"); - } - node.organize(this); - codeMapping.put(arg, node); - } - } - - for (final SimpleNode sn : codeMapping.values()) { - if (sn == null) { - String unsigned = ""; - for (final String nulls : codeMapping.keySet()) { - if (codeMapping.get(nulls) == null) { - unsigned += nulls + ","; - } - } - unsigned = unsigned.substring(0, unsigned.length() - 1); - throw newException("In Action 'insert': not all codedef arguments are set: " + unsigned); - } - } - } - - private String getParamWithNoValue() { - for (final String param : codeMapping.keySet()) { - if (codeMapping.get(param) == null) { - return param; - } - } - return null; - } - */ - /** - * @param codeDef - * the codeDef to set - */ - public void setCodeDef(ASTCodeDef codeDef) { - this.codeDef = codeDef; - } - - /** - * @return the codeDef - */ - public ASTCodeDef getCodeDef() { - return codeDef; - } - - /** - * @param codeFileName - * the codeFileName to set - */ - public void setCodeFileName(String codeFileName) { - this.codeFileName = codeFileName; - } - - /** - * @return the codeFileName - */ - public String getCodeFileName() { - return codeFileName; - } - - /** - * @param pureCode - * the pureCode to set - */ - public void setPureCode(boolean pureCode) { - this.pureCode = pureCode; - } - - /** - * @return the pureCode - */ - public boolean isPureCode() { - return pureCode; - } - - @Override - public void toXMLTemplate(Document doc, Element parent) { - - final Element literalEl = doc.createElement("literal"); - literalEl.setAttribute("type", Types.Object.toString()); - literalEl.setAttribute("desc", Types.Code.toString()); - parent.appendChild(literalEl); - final Element propEl = doc.createElement("key"); - propEl.setAttribute("name", "code"); - literalEl.appendChild(propEl); - if (codeDef != null) { - addCodeDef(doc, propEl); - } else { - getChild(0).toXML(doc, propEl); - } - - for (final String prop : codeMapping.keySet()) { - final SimpleNode replace = codeMapping.get(prop); - final Element propertyKeyEl = doc.createElement("key"); - literalEl.appendChild(propertyKeyEl); - propertyKeyEl.setAttribute("name", Enums.SYMBOL_BEGIN + prop + Enums.SYMBOL_END); - replace.toXML(doc, propertyKeyEl); - } - codeTemplateArgumentsToXML(doc, literalEl, codeParams); - } - - public void addCodeDef(Document doc, final Element propEl) { - final Element stringEl = doc.createElement("literal"); - stringEl.setAttribute("type", Types.Base64.toString()); - propEl.appendChild(stringEl); - try { - final String codeBase64 = DatatypeConverter.printBase64Binary(codeDef.getCode().getBytes("UTF-8")); - stringEl.setAttribute("value", codeBase64); - } catch (final UnsupportedEncodingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - -} -/* - * JavaCC - OriginalChecksum=dc1f61881b611a8788d045963882552a (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTJavaScript.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTJavaScript.java deleted file mode 100644 index bd85aa291..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTJavaScript.java +++ /dev/null @@ -1,89 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTJavaScript.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import java.util.HashMap; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.objects.SymbolTable; -import larac.objects.Variable; - -public class ASTJavaScript extends SimpleNode { - private SymbolTable localVars = new SymbolTable<>(); - - public ASTJavaScript(int id) { - super(id); - } - - public ASTJavaScript(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - if (getChildren() != null) { - for (final Node child : getChildren()) { - ((SimpleNode) child).organize(obj); - } - } - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - // createXMLDecl(localVars.values(), doc, parent); - - if (getChildren() != null) { - for (final Node node : getChildren()) { - ((SimpleNode) node).toXML(doc, parent); - } - } - } - - /** - * @param localVars - * the localVars to set - */ - public void setLocalVars(SymbolTable localVars) { - this.localVars = localVars; - } - - /** - * @return the localVars - */ - public SymbolTable getLocalVars() { - return localVars; - } - - @Override - public Variable lookup(String var) { - if (localVars.containsKey(var)) { - return localVars.get(var); - } - return ((SimpleNode) parent).lookup(var); - } - - @Override - public Variable lookupNoError(String var) { - - if (localVars.containsKey(var)) { - return localVars.get(var); - } - - return ((SimpleNode) parent).lookupNoError(var); - } - - @Override - public HashMap getHMVars() { - return localVars; - } -} -/* - * JavaCC - OriginalChecksum=f7b7ff61dae1ae6df2aaefd3fd88c256 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTJoin.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTJoin.java deleted file mode 100644 index 6508421d0..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTJoin.java +++ /dev/null @@ -1,100 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTJoin.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.objects.Enums.JoinOperator; -import larac.objects.Variable; - -public class ASTJoin extends SimpleNode { - public SimpleNode leftObj; - public SimpleNode rightObj; - - public ASTJoin(int id) { - super(id); - } - - public ASTJoin(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - final ASTAspectDef aspectDef = (ASTAspectDef) obj; - // final ASTAspectDef aspectDef = getAspectDefForDeclStmt("Join "); - final SimpleNode leftChild = (SimpleNode) getChildren()[0]; - final SimpleNode rightChild = (SimpleNode) getChildren()[1]; - final ASTSelect parentSelect = (ASTSelect) getParentById(LARAEcmaScriptTreeConstants.JJTSELECT); - leftObj = setAJoinSide(aspectDef, leftChild, parentSelect); - rightObj = setAJoinSide(aspectDef, rightChild, parentSelect); - return null; - } - - private SimpleNode setAJoinSide(ASTAspectDef aspectDef, SimpleNode pcChild, ASTSelect parentSelect) { - SimpleNode pcExpr; - if (pcChild instanceof ASTJoin) { - pcChild.organize(aspectDef); - pcExpr = pcChild; - } else { - final ASTIdentifier ident = (ASTIdentifier) pcChild; - pcExpr = aspectDef.getSelect(ident.value.toString()); - if (pcExpr == null) { - throw newException("Select '" + ident.value + "' is undefined"); - } - - // Undesired code, since it was doing nothing useful and was only - // creating bugs! - // ASTSelect leftSelect = (ASTSelect) pcExpr; - // for (String key : leftSelect.getPointcuts().keySet()) - // parentSelect.putPointcut(key, leftSelect.getPointcut(key)); - } - return pcExpr; - } - - @Override - public Object organizeFirst(Object obj, int i) { - return organize(obj); - } - - @Override - public void toXML(Document doc, Element parent) { - final JoinOperator tag = JoinOperator.getOpTag(value.toString()); - - final Element joinEl = doc.createElement("op"); - joinEl.setAttribute("name", tag.toString()); - parent.appendChild(joinEl); - if (getChildren()[0] instanceof ASTIdentifier) { - createPointcutElement(doc, joinEl, 0); - } else { - ((SimpleNode) getChildren()[0]).toXML(doc, joinEl); - } - if (getChildren()[1] instanceof ASTIdentifier) { - createPointcutElement(doc, joinEl, 1); - } else { - ((SimpleNode) getChildren()[1]).toXML(doc, joinEl); - } - } - - private void createPointcutElement(Document doc, Element joinEl, int i) { - final Element pcEl = doc.createElement("id"); - pcEl.setAttribute("name", ((SimpleNode) getChildren()[i]).value.toString()); - // pcEl.setAttribute("type", "JoinSet"); - joinEl.appendChild(pcEl); - } - - @Override - public Variable lookupLastJPVariable() { - - return rightObj.lookupLastJPVariable(); - } - -} -/* - * JavaCC - OriginalChecksum=a7f54d8229a9a8b322a56732cea28a8e (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTLabelledStatement.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTLabelledStatement.java deleted file mode 100644 index 48ed660da..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTLabelledStatement.java +++ /dev/null @@ -1,39 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTLabelledStatement.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ASTLabelledStatement extends SimpleNode { - public ASTLabelledStatement(int id) { - super(id); - } - - public ASTLabelledStatement(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - final String label = ((ASTIdentifier) getChildren()[0]).value.toString(); - if (lookupLabel(label) != null) { - throw newException("Duplicated label: " + label); - } - ((SimpleNode) getChildren()[1]).label = label; - ((SimpleNode) getChildren()[1]).organize(obj); - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - ((SimpleNode) getChildren()[1]).toXML(doc, parent); - } -} -/* - * JavaCC - OriginalChecksum=85d80aae31823079b4111bf08ef25c33 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTLiteral.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTLiteral.java deleted file mode 100644 index 7ecad9d60..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTLiteral.java +++ /dev/null @@ -1,212 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTLiteral.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import java.io.UnsupportedEncodingException; -import java.util.List; - -import javax.xml.bind.DatatypeConverter; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.objects.Enums.Types; - -public class ASTLiteral extends SimpleNode { - private Types type; - private List codeParams = null; - - // private String codeFileName; - - public ASTLiteral(int id) { - super(id); - } - - public ASTLiteral(LARAEcmaScript p, int id) { - super(p, id); - } - - public void setStringValue(String image) { - value = image.substring(1, image.length() - 1); - } - - public void setDecimalValue(String image) { - - try { - value = Long.valueOf(image); - } catch (final NumberFormatException e) { - // it's a floating point - value = Double.valueOf(image); - } - } - - public void setHexValue(String image) { - - value = Long.valueOf(image.substring(2), 16); - } - - public void setFloatingPointValue(String image) { - value = Double.valueOf(image); - } - - public void setBooleanValue(String image) { - value = Boolean.valueOf(image); - } - - public void setNullValue() { - } - - public void setRegexValue(String image) { - value = image; - - } - - public void setCodeValue(String image) { - value = image; - } - - public void setType(Types type) { - this.type = type; - } - - public Types getType() { - return type; - } - - @Override - public String toString() { - String ret = LARAEcmaScriptTreeConstants.jjtNodeName[id]; - - if (type.equals(Types.Null)) { - ret += " [null]"; - } else { - ret += value != null ? (" [" + type + "," + value + "]") : ""; - } - return ret; - } - - public Element getFilterElement(Document doc, String prefix) { - final Element literalEl = doc.createElement("literal"); - // literalEl.setAttribute("type", type.name()); - literalEl.setAttribute("value", prefix + value.toString().replace("\"", "")); - return literalEl; - } - - @Override - public Types getExpressionType() { - return getType(); - } - - @Override - public Object organize(Object obj) { - if (type.equals(Types.Code)) { - codeParams = getCodeArguments(value.toString()); - try { - value = value.toString().substring(2, value.toString().length() - 2); - value = DatatypeConverter.printBase64Binary(value.toString().getBytes("UTF-8")); - - } catch (final UnsupportedEncodingException e) { - - e.printStackTrace(); - } - // LaraC lara = getLara(); - // - // codeFileName = lara.aspectIR().generateNewCodeName(); - // String fileSep = System.getProperty("file.separator"); - // File outputDir = lara.getOptions().getOutputDir(); - // FileUtils.toFile(lara.getPrint(), codeFileName, ".code", - // value.toString().substring(2, value.toString().length() - 2), - // outputDir); - // File codeFile = new File(outputDir, codeFileName + ".code"); - // value = codeFile.getAbsolutePath().replace(fileSep, fileSep + - // fileSep); - } - if (obj instanceof ASTInsert && type.equals(Types.String)) { - codeParams = getCodeArguments(value.toString()); - } - return type; - } - - @Override - public void toXML(Document doc, Element parent) { - final Element literalEl = doc.createElement("literal"); - - if (type.equals(Types.Null)) { - literalEl.setAttribute("value", "null"); - literalEl.setAttribute("type", Types.Object.toString()); - } else { - - if (type.equals(Types.Code) || (type.equals(Types.String) && codeParams != null && !codeParams.isEmpty())) { - // final SimpleNode obj = ((SimpleNode) - // this.parent).getParentById(LARAEcmaScriptTreeConstants.JJTACTION); - // if (obj == null) { - codeToXML(doc, parent); - return; - // } - // literalEl.setAttribute("type", Types.Base64.toString()); - } else { - literalEl.setAttribute("type", type.toString()); - } - - literalEl.setAttribute("value", value.toString()); - - } - parent.appendChild(literalEl); - } - - @Override - public void toXMLTemplate(Document doc, Element parent) { - final Element literalEl = doc.createElement("literal"); - literalEl.setAttribute("type", Types.Object.toString()); - literalEl.setAttribute("desc", Types.Code.toString()); - parent.appendChild(literalEl); - final Element propEl = doc.createElement("key"); - literalEl.appendChild(propEl); - propEl.setAttribute("name", "code"); - if (type == Types.String) { - codeParams = getCodeArguments(value.toString()); - } - toXML(doc, propEl); - if (codeParams != null) { - verifyCodeArguments(codeParams); - codeTemplateArgumentsToXML(doc, literalEl, codeParams); - } - } - - public void codeToXML(Document doc, Element parent) { - final Element literalEl = doc.createElement("literal"); - literalEl.setAttribute("type", Types.Object.toString()); - literalEl.setAttribute("desc", Types.Code.toString()); - parent.appendChild(literalEl); - - final Element propEl = doc.createElement("key"); - literalEl.appendChild(propEl); - propEl.setAttribute("name", "code"); - - final Element literalCodeEl = doc.createElement("literal"); - literalCodeEl.setAttribute("value", value.toString()); - literalCodeEl.setAttribute("type", type.toString()); - propEl.appendChild(literalCodeEl); - if (codeParams != null) { - verifyCodeArguments(codeParams); - codeTemplateArgumentsToXML(doc, literalEl, codeParams); - } - } - - @Override - public String toSource(int indentation) { - - String string = value.toString(); - if (type == Types.String) { - string = '"' + string + '"'; - } - return indent(indentation) + string; - } -} -/* - * JavaCC - OriginalChecksum=de0fd5e10db38b45e5e755afa080eb7f (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTLiteralField.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTLiteralField.java deleted file mode 100644 index 5f066b1cf..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTLiteralField.java +++ /dev/null @@ -1,21 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTLiteralField.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -public @SuppressWarnings("all") class ASTLiteralField extends SimpleNode { - public ASTLiteralField(int id) { - super(id); - } - - public ASTLiteralField(LARAEcmaScript p, int id) { - super(p, id); - } - -} -/* - * JavaCC - OriginalChecksum=0f6af9d9a7db9dfb202ef74b938fbc2e (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTNamedArgument.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTNamedArgument.java deleted file mode 100644 index 61c094cd5..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTNamedArgument.java +++ /dev/null @@ -1,34 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTNamedArgument.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ASTNamedArgument extends SimpleNode { - public ASTNamedArgument(int id) { - super(id); - } - - public ASTNamedArgument(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - return ((SimpleNode) children[0]).organize(obj); - } - - @Override - public void toXML(Document doc, Element parent) { - parent.setAttribute("name", value.toString()); - ((SimpleNode) children[0]).toXML(doc, parent); - } -} -/* - * JavaCC - OriginalChecksum=b92964a2b6aa12c3bcb99e149c9adacf (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTNaturalJoin.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTNaturalJoin.java deleted file mode 100644 index 489d7229a..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTNaturalJoin.java +++ /dev/null @@ -1,21 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTNaturalJoin.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -public class ASTNaturalJoin extends SimpleNode { - public ASTNaturalJoin(int id) { - super(id); - } - - public ASTNaturalJoin(LARAEcmaScript p, int id) { - super(p, id); - } - -} -/* - * JavaCC - OriginalChecksum=db982db7548861f6fff221e20c8ee9ac (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTORJPExpr.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTORJPExpr.java deleted file mode 100644 index dba10c408..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTORJPExpr.java +++ /dev/null @@ -1,58 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTORJPExpr.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ASTORJPExpr extends SimpleNode { - public ASTORJPExpr(int id) { - super(id); - } - - public ASTORJPExpr(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - - for (final Node child : getChildren()) { - ((SimpleNode) child).organize(obj); - } - return null; - } - - @Override - public Object organizeFirst(Object obj, int dummy) { - - for (int i = 0; i < getChildren().length; i++) { - ((SimpleNode) getChildren()[i]).organizeFirst(obj, i); - } - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - for (final Node child : getChildren()) { - ((SimpleNode) child).toXML(doc, parent); - } - } - - @Override - public boolean hasFilter() { - for (final Node child : getChildren()) { - if (((SimpleNode) child).hasFilter()) { - return true; - } - } - return false; - } -} -/* - * JavaCC - OriginalChecksum=809ee13c569e1e4397220af63595e13e (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTObjectLiteral.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTObjectLiteral.java deleted file mode 100644 index e2225f562..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTObjectLiteral.java +++ /dev/null @@ -1,67 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTObjectLiteral.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import java.util.LinkedHashMap; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.objects.Enums.Types; - -public class ASTObjectLiteral extends SimpleNode { - private final LinkedHashMap props = new LinkedHashMap<>(); - - public ASTObjectLiteral(int id) { - super(id); - } - - public ASTObjectLiteral(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - // System.out.println(children); - if (children == null) { - return null; - } - - for (final Node child : children) { - final ASTLiteralField litField = (ASTLiteralField) child; - final String prop = ((SimpleNode) litField.children[0]).value.toString(); - // if (props.containsKey(prop)) - // throw newException("The object already contains the property \"" - // + prop + "\"."); - final SimpleNode init = ((SimpleNode) litField.children[1]); - init.organize(obj); - props.put(prop, init); - } - return null; - } - - @Override - public Types getExpressionType() { - return Types.Object; - } - - @Override - public void toXML(Document doc, Element parent) { - final Element literalEl = doc.createElement("literal"); - literalEl.setAttribute("type", Types.Object.toString()); - parent.appendChild(literalEl); - for (final String prop : props.keySet()) { - final Element propEl = doc.createElement("key"); - propEl.setAttribute("name", prop); - literalEl.appendChild(propEl); - props.get(prop).toXML(doc, propEl); - } - } -} -/* - * JavaCC - OriginalChecksum=8a6932db8f6cab10e111b9097896eeee (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTOperator.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTOperator.java deleted file mode 100644 index c650e8b05..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTOperator.java +++ /dev/null @@ -1,94 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTOperator.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import larac.objects.Enums.AssignOperator; -import larac.objects.Enums.BinaryOperator; -import larac.objects.Enums.Types; -import larac.objects.Enums.UnaryOperator; - -public class ASTOperator extends SimpleNode { - private String tag; - private Types returnType; - - public ASTOperator(int id) { - super(id); - } - - public ASTOperator(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - if (obj instanceof ASTBinaryExpressionSequence && BinaryOperator.contains(value.toString())) { - tag = BinaryOperator.getOpTag(value.toString()).toString(); - - } else if (obj instanceof ASTAssignmentExpression && AssignOperator.contains(value.toString())) { - tag = AssignOperator.getOpTag(value.toString()).toString(); - } else if (obj instanceof ASTUnaryExpression && UnaryOperator.contains(value.toString())) { - tag = UnaryOperator.getOpTag(value.toString()).toString(); - } else if (obj instanceof ASTAndExpressionSequence && BinaryOperator.contains(value.toString())) { - tag = BinaryOperator.getOpTag(value.toString()).toString(); - } else if (obj instanceof ASTOrExpressionSequence && BinaryOperator.contains(value.toString())) { - tag = BinaryOperator.getOpTag(value.toString()).toString(); - } - if (tag == null) { - throw newException("Operator \"" + value + "\" not suported on " + obj); - } - return null; - } - - /** - * @return the tag - */ - public String getTag() { - if (tag == null) { - this.organize(parent); - } - return tag; - } - - /** - * @param tag - * the tag to set - */ - public void setTag(String tag) { - this.tag = tag; - } - - /** - * @return the returnType - */ - public Types getReturnType() { - return returnType; - } - - /** - * @param returnType - * the returnType to set - */ - public void setReturnType(Types returnType) { - this.returnType = returnType; - } - - /** - * @param returnType - * the returnType to set - */ - public void setReturnType(Types returnType, Types returnType2) { - this.returnType = Types.maxType(returnType, returnType2); - } - - @Override - public String toSource(int indentation) { - return indent(indentation) + value.toString(); - } -} -/* - * JavaCC - OriginalChecksum=59c67cb5edd2fdd095ebcb001516032d (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTOrExpressionSequence.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTOrExpressionSequence.java deleted file mode 100644 index 761967d6b..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTOrExpressionSequence.java +++ /dev/null @@ -1,69 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTOrExpressionSequence.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.objects.Enums.Types; - -public class ASTOrExpressionSequence extends SimpleNode { - public ASTOrExpressionSequence(int id) { - super(id); - } - - public ASTOrExpressionSequence(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - final SimpleNode left = (SimpleNode) children[0]; - left.organize(this); - for (int i = 1; i < children.length; i += 2) { - final ASTOperator operator = (ASTOperator) children[i]; - operator.organize(this); - final SimpleNode right = (SimpleNode) children[i + 1]; - right.organize(this); - operator.setReturnType(Types.Boolean); - } - return obj; - } - - @Override - public void toXML(Document doc, Element parent) { - SimpleNode left = (SimpleNode) children[0]; - ASTOperator operator = (ASTOperator) children[1]; - Element opEl = doc.createElement("op"); - opEl.setAttribute("name", operator.getTag()); - parent.appendChild(opEl); - left.toXML(doc, opEl); - // opEl.setAttribute("type", operator.getReturnType().name()); - int i = 2; - while (i + 1 < children.length) { - left = (SimpleNode) children[i++]; - operator = (ASTOperator) children[i++]; - final Element newOpEl = doc.createElement("op"); - newOpEl.setAttribute("name", operator.getTag()); - opEl.appendChild(newOpEl); - opEl = newOpEl; - // opEl.setAttribute("type", operator.getReturnType().name()); - left.toXML(doc, opEl); - } - final SimpleNode right = (SimpleNode) children[i]; - right.toXML(doc, opEl); - } - - @Override - public Types getExpressionType() { - return Types.Boolean; - } - -} -/* - * JavaCC - OriginalChecksum=672bba3e5cbcb55cd86b548c2fbe249e (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTOrFiltersExpr.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTOrFiltersExpr.java deleted file mode 100644 index 669c6845e..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTOrFiltersExpr.java +++ /dev/null @@ -1,60 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTOrFiltersExpr.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.lara.language.specification.dsl.LanguageSpecification; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ASTOrFiltersExpr extends SimpleNode { - public ASTOrFiltersExpr(int id) { - super(id); - } - - public ASTOrFiltersExpr(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public String organize(String type, LanguageSpecification langSpec) { - for (final Node child : getChildren()) { - ((SimpleNode) child).organize(type, langSpec); - } - return null; - } - - @Override - public Element getFilterElement(Document doc) { - Element aux = null; - boolean first = true; - Element jpOREl = null; - - for (final Node child : getChildren()) { - final Element childEl = ((SimpleNode) child).getFilterElement(doc); - if (childEl != null) { - if (first) { - aux = childEl; - first = false; - } else { - if (jpOREl == null) { - jpOREl = doc.createElement("op"); - jpOREl.setAttribute("name", "OR"); - jpOREl.appendChild(aux); - } - jpOREl.appendChild(childEl); - } - } - } - if (jpOREl != null) { - return jpOREl; - } - return aux; - } -} -/* - * JavaCC - OriginalChecksum=3506f10ce2f5a7c50c491a5b58d86e9b (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTOutput.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTOutput.java deleted file mode 100644 index ae372fe16..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTOutput.java +++ /dev/null @@ -1,66 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTOutput.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import java.util.HashMap; - -import larac.objects.Variable; - -public class ASTOutput extends SimpleNode { - - public ASTOutput(int id) { - super(id); - } - - public ASTOutput(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - final ASTAspectDef asp = (ASTAspectDef) parent; - if (asp.getOutputsNode() != null) { - // if (!asp.getOutputs().isEmpty()) { - throw newException("Can only have one output section!"); - } - asp.setOutputsNode(this); - if (getChildren() == null) { - return null; - } - final ASTAspectDef aspect = (ASTAspectDef) obj; - ((SimpleNode) getChildren()[0]).organize(aspect.getOutputs(), aspect.getInputs()); - return null; - } - - @Override - public HashMap getHMVars() { - return ((ASTAspectDef) parent).getOutputs(); - } - - @Override - public String toSource(int indentation) { - - String source = indent(indentation) + "output"; - if (getChildren() == null) { - return source + " end"; - } - SimpleNode child = getChild(0); - if (child instanceof ASTVariableDeclarationList) { - if (child.getChildren() != null) { - for (final Node n : child.getChildren()) { - source += "\n" + ((SimpleNode) n).toSource(indentation + 1); - } - } - } else { - source += "\n" + child.toSource(indentation + 1); - } - return source + "\n" + indent(indentation) + "end"; - } -} -/* - * JavaCC - OriginalChecksum=86064c04cf6bb75b2b5038c23b32713a (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTOutputAct.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTOutputAct.java deleted file mode 100644 index c479495f1..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTOutputAct.java +++ /dev/null @@ -1,262 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTOutputAct.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.LinkedHashMap; - -import javax.xml.bind.DatatypeConverter; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.objects.Enums; -import larac.objects.Enums.Types; - -@Deprecated -public class ASTOutputAct extends SimpleNode { - private String language; - private boolean pureCode; - private ASTCodeDef codeDef; - private final ArrayList codeParams = new ArrayList<>(); - private LinkedHashMap codeMapping = new LinkedHashMap<>(); - - public ASTOutputAct(int id) { - super(id); - } - - public ASTOutputAct(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public String toString() { - return LARAEcmaScriptTreeConstants.jjtNodeName[id]; - } - - /** - * @param language - * the language to set - */ - public void setLanguage(String language) { - this.language = language; - } - - /** - * @return the language - */ - public String getLanguage() { - return language; - } - - /** - * @param paramMapping - * the paramMapping to set - */ - public void setParamMapping(LinkedHashMap paramMapping) { - codeMapping = paramMapping; - } - - /** - * @return the paramMapping - */ - public LinkedHashMap getParamMapping() { - return codeMapping; - } - - @Override - public Object organize(Object obj) { - /* - final ASTAction act = (ASTAction) parent; - act.setMethod("out"); - act.setArguments(OrganizeUtils.createOutputActionParameters(getLara().languageSpec())); - final Map arguments = act.getArguments(); - if (jjtGetChild(0) instanceof ASTFunctionCallParameters) { - final ASTFunctionCallParameters params = (ASTFunctionCallParameters) jjtGetChild(0); - if (params.areNamed) { - for (final Node param : params.getChildren()) { - final ASTNamedArgument na = (ASTNamedArgument) param; - if (!arguments.containsKey(na.value)) { - throw newException("The argument '" + na.value + "' does not exist for action 'out'"); - } - final ActionArgument actArg = arguments.get(na.value); - if (na.value.equals("code")) { - verifyCodeDef(na.jjtGetChild(0), arguments); - } else { - na.organize(obj); - actArg.setValue((SimpleNode) na.jjtGetChild(0)); - } - } - } else { - if (params.getChildren().length != arguments.size()) { - throw newException("Illegal number of arguments for action 'out'"); - } - verifyCodeDef(params.jjtGetChild(0), arguments); - } - } else { - if (children[0] instanceof ASTLiteral) { - ((SimpleNode) children[0]).organize(this); - arguments.get("code").setValue((SimpleNode) children[0]); - } else { - verifyCodeDef(children[0], arguments); - } - }*/ - return null; - } - - /* - private void verifyCodeDef(Node node, Map arguments) { - String codeName = ""; - if (node instanceof ASTLiteral) { - ((SimpleNode) node).organize(this); - - arguments.get("code").setValue((SimpleNode) node); - return; - } - if (node instanceof ASTIdentifier) { - codeName = ((ASTIdentifier) node).value.toString(); - codeDef = getLara().aspectIR().getCodedef(codeName); - if (codeDef == null) { - throw newException("Codedef '" + codeName + "' does not exist."); - } - } else if (node instanceof ASTCompositeReference) { - - codeName = ((ASTIdentifier) node.jjtGetChild(0)).value.toString(); - codeDef = getLara().aspectIR().getCodedef(codeName); - if (codeDef == null) { - throw newException("Codedef '" + codeName + "' does not exist."); - } - - for (final String arg : codeDef.getArguments()) { - codeMapping.put(arg, null); - } - final ASTFunctionCallParameters params = (ASTFunctionCallParameters) node.jjtGetChild(1); - organizeArguments(params); - } else { - throw newException("Argument 'code' for out is invalid."); - } - - arguments.get("code").setValue(this); - } - - private void organizeArguments(ASTFunctionCallParameters astFunctionCallParameters) { - if (astFunctionCallParameters.areNamed) { - for (final Node node : astFunctionCallParameters.getChildren()) { - final ASTNamedArgument named = (ASTNamedArgument) node; - if (!codeDef.getArguments().contains(named.value)) { - throw newException("In Action 'out': '" + named.value + "' does not exist."); - } - ((SimpleNode) named.getChildren()[0]).organize(this); - getParamMapping().put(named.value.toString(), (SimpleNode) named.getChildren()[0]); - } - } else { - for (final Node node : astFunctionCallParameters.getChildren()) { - final String arg = getParamWithNoValue(); - if (arg == null) { - throw newException("In Action 'out': Illegal number of arguments"); - } - ((SimpleNode) node).organize(this); - codeMapping.put(arg, (SimpleNode) node); - } - } - - for (final SimpleNode sn : codeMapping.values()) { - if (sn == null) { - String unsigned = ""; - for (final String nulls : codeMapping.keySet()) { - if (codeMapping.get(nulls) == null) { - unsigned += nulls + ","; - } - } - unsigned = unsigned.substring(0, unsigned.length() - 1); - throw newException("In Action 'out': not all codedef arguments are set: " + unsigned); - } - } - } - - private String getParamWithNoValue() { - for (final String param : codeMapping.keySet()) { - if (codeMapping.get(param) == null) { - return param; - } - } - return null; - } - */ - /** - * @param codeDef - * the codeDef to set - */ - public void setCodeDef(ASTCodeDef codeDef) { - this.codeDef = codeDef; - } - - /** - * @return the codeDef - */ - public ASTCodeDef getCodeDef() { - return codeDef; - } - - /** - * @param pureCode - * the pureCode to set - */ - public void setPureCode(boolean pureCode) { - this.pureCode = pureCode; - } - - /** - * @return the pureCode - */ - public boolean isPureCode() { - return pureCode; - } - - /** - * @param doc - * Document where the Aspect-IR is going to be saved - * @param parent - * the parent node owner for the nodes generated in this node - */ - @Override - public void toXMLTemplate(Document doc, Element parent) { - final Element literalEl = doc.createElement("literal"); - literalEl.setAttribute("type", Types.Object.toString()); - parent.appendChild(literalEl); - final Element propEl = doc.createElement("key"); - propEl.setAttribute("name", "'code'"); - literalEl.appendChild(propEl); - final Element stringEl = doc.createElement("literal"); - // stringEl.setAttribute("type", Types.String.toString()); - // propEl.appendChild(stringEl); - // stringEl.setAttribute("value", codeDef.getName() + ".code"); - stringEl.setAttribute("type", Types.Base64.toString()); - propEl.appendChild(stringEl); - try { - final String codeBase64 = DatatypeConverter.printBase64Binary(codeDef.getCode().getBytes("UTF-8")); - stringEl.setAttribute("value", codeBase64); - } catch (final UnsupportedEncodingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - for (final String prop : codeMapping.keySet()) { - final SimpleNode replace = codeMapping.get(prop); - final Element propertyKeyEl = doc.createElement("key"); - literalEl.appendChild(propertyKeyEl); - propertyKeyEl.setAttribute("name", Enums.SYMBOL_BEGIN + prop + Enums.SYMBOL_END); - replace.toXML(doc, propertyKeyEl); - } - codeTemplateArgumentsToXML(doc, literalEl, codeParams); - } - -} -/* - * JavaCC - OriginalChecksum=686f16c31cea47f2f993b8d2a4070c21 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTParenExpression.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTParenExpression.java deleted file mode 100644 index ad8e2648a..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTParenExpression.java +++ /dev/null @@ -1,60 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTParenExpression.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.objects.Enums.BinaryOperator; - -public class ASTParenExpression extends SimpleNode { - public ASTParenExpression(int id) { - super(id); - } - - public ASTParenExpression(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - if (getChildren() != null) { - for (final Node child : getChildren()) { - ((SimpleNode) child).organize(obj); - } - } - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - if (getChildren() == null) { - return; - } - if (children[0] instanceof ASTExpressionList) { - final ASTExpressionList exprList = (ASTExpressionList) children[0]; - Element auxEl = doc.createElement("aux"); - ((SimpleNode) exprList.children[0]).toXML(doc, auxEl); - auxEl = (Element) auxEl.getFirstChild(); - for (int i = 1; i < exprList.children.length; i++) { - final Element commaEl = doc.createElement("op"); - commaEl.setAttribute("name", BinaryOperator.COMMA.toString()); - commaEl.appendChild(auxEl); - ((SimpleNode) exprList.children[i]).toXML(doc, commaEl); - auxEl = commaEl; - } - parent.appendChild(auxEl); - } else { - for (final Node child : getChildren()) { - ((SimpleNode) child).toXML(doc, parent); - } - } - } -} -/* - * JavaCC - OriginalChecksum=7ed48279809a76b7276997fbebe6ca6a (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTPerform.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTPerform.java deleted file mode 100644 index 2800babaa..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTPerform.java +++ /dev/null @@ -1,533 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTPerform.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.lara.language.specification.dsl.Action; - -// import org.lara.language.specification.actionsmodel.schema.Action; - -import larac.LaraC; -import larac.exceptions.LARACompilerException; -import larac.objects.Variable; -import larac.utils.xml.entity.ActionArgument; -import pt.up.fe.specs.util.SpecsFactory; -import tdrc.utils.StringUtils; - -public class ASTPerform extends SimpleNode { - - private String action; - private Optional returnName = Optional.empty(); - - public ASTPerform(int id) { - super(id); - } - - public ASTPerform(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - final LaraC lara = getLara(); - - var organizer = lara.getOrganizer(); - var languageSpec = lara.getLanguageSpec(); - // final ActionModel actionModel = languageSpec.getActionModel(); - final ASTAction act = (ASTAction) parent; - act.setMethod(action); - - // if (!actionModel.contains(action)) { - if (!languageSpec.hasAction(action)) { - - lara.warnln("Action '" + action - + "' does not exist in the action model. The arguments cannot be verified. Will use action as is."); - final Map emptyMap = Collections.emptyMap(); - act.setArguments(emptyMap); - return null; - } - - // Since we accept method overloading then we should verify all possible actions - List actions = languageSpec.getAction(action); - if (children == null) { - // Base case: no arguments were given to the action and there is an action without parameters - for (Action action : actions) { - if (action.getParameters().isEmpty()) { - final Map actionParam = organizer.createActionParameters(action); - act.setArguments(actionParam); - validateReturn(lara, action); - return null; - } - } - throwIllegalParameters(actions, children); - // + actionParam.size() + " arguments: '" + actionParam.keySet() + "'"); - } - - // Get the action arguments - final ASTFunctionCallParameters params = (ASTFunctionCallParameters) children[0]; - int callparametersId = LARAEcmaScriptTreeConstants.JJTFUNCTIONCALLPARAMETERS; - // Instantiate the new arguments that will comprise the necessary changes - final ASTFunctionCallParameters newParams = new ASTFunctionCallParameters(callparametersId); - List> actionsParams = SpecsFactory.newLinkedList(); - List possibleActions = SpecsFactory.newLinkedList(); - if (params.areNamed) { - actions: for (Action action : actions) { - final Map actionParam = organizer.createActionParameters(action); - for (final Node param : params.getChildren()) { - final ASTNamedArgument na = (ASTNamedArgument) param; - if (!actionParam.containsKey(na.value)) { - continue actions; - } - - final ActionArgument actArg = actionParam.get(na.value); - actArg.setValue(na.getChild(0)); - } - if (argsAreValid(actionParam)) { - actionsParams.add(actionParam); - possibleActions.add(action); - } - } - if (possibleActions.isEmpty()) { - throwIllegalParameters(actions, params.children); - } - if (possibleActions.size() > 1) { - String message = "Conflicting action choice when using named arguments. Given: (show named arguments given by user)"; - message += "Conflicting Options:\n"; - int i = 0; - for (Action action : possibleActions) { - message += "\t" + i + ") " + action2String(action) + "\n"; - } - throw new RuntimeException(message); - } - Map map = actionsParams.get(0); - Action action = possibleActions.get(0); - organizeWithGivenParams(lara, act, params, newParams, action, map); - } else { - for (Action action : actions) { - int length = params.children == null ? 0 : params.children.length; - int actionParametersLength = action.getParameters().size(); - - int requiredParametersLength = action.getParameters().size(); - for (var child : action.getParameters()) { - if (child.getDefaultValue() != null) { - requiredParametersLength--; - } - } - - if (length == 0 && actionParametersLength == 0) { - final Map actionParam = organizer.createActionParameters(action); - act.setArguments(actionParam); - validateReturn(lara, action); - return null; - } else { - if (length >= requiredParametersLength && length <= actionParametersLength) { - final Map actionParam = organizer.createActionParameters(action); - int i = 0; - for (final ActionArgument arg : actionParam.values()) { - if (i >= length) { - break; - } - arg.setValue((SimpleNode) params.jjtGetChild(i++)); - } - - - organizeWithGivenParams(lara, act, params, newParams, action, actionParam); - return null; - } - } - } - throwIllegalParameters(actions, params.children); - } - - return null; - } - - // @Override - // public Object organize(Object obj) { - // final LaraC lara = getLara(); - // final LanguageSpecification languageSpec = lara.languageSpec(); - // final ActionModel actionModel = languageSpec.getActionModel(); - // final ASTAction act = (ASTAction) parent; - // act.setMethod(action); - // - // if (!actionModel.contains(action)) { - // - // lara.warnln("Action '" + action - // + "' does not exist in the action model. The arguments cannot be verified. Will use action as is."); - // final Map emptyMap = Collections.emptyMap(); - // act.setArguments(emptyMap); - // return null; - // } - // // Since we accept method overloading then we should verify all possible actions - // List actions = actionModel.getActions(action); - // if (children == null) { - // // Base case: no arguments were given to the action and there is an action without parameters - // for (Action action : actions) { - // if (action.getParameter().isEmpty()) { - // final Map actionParam = OrganizeUtils.createActionParameters(action, - // languageSpec); - // act.setArguments(actionParam); - // validateReturn(lara, action); - // return null; - // } - // } - // throwIllegalParameters(actions, children); - // // + actionParam.size() + " arguments: '" + actionParam.keySet() + "'"); - // } - // - // // Get the action arguments - // final ASTFunctionCallParameters params = (ASTFunctionCallParameters) children[0]; - // int callparametersId = LARAEcmaScriptTreeConstants.JJTFUNCTIONCALLPARAMETERS; - // // Instantiate the new arguments that will comprise the necessary changes - // final ASTFunctionCallParameters newParams = new ASTFunctionCallParameters(callparametersId); - // List> actionsParams = SpecsFactory.newLinkedList(); - // List possibleActions = SpecsFactory.newLinkedList(); - // if (params.areNamed) { - // actions: for (Action action : actions) { - // final Map actionParam = OrganizeUtils.createActionParameters(action, - // languageSpec); - // for (final Node param : params.getChildren()) { - // final ASTNamedArgument na = (ASTNamedArgument) param; - // if (!actionParam.containsKey(na.value)) { - // continue actions; - // } - // - // final ActionArgument actArg = actionParam.get(na.value); - // actArg.setValue(na.getChild(0)); - // } - // if (argsAreValid(actionParam)) { - // actionsParams.add(actionParam); - // possibleActions.add(action); - // } - // } - // if (possibleActions.isEmpty()) { - // throwIllegalParameters(actions, params.children); - // } - // if (possibleActions.size() > 1) { - // String message = "Conflicting action choice when using named arguments. Given: (show named arguments given by - // user)"; - // message += "Conflicting Options:\n"; - // int i = 0; - // for (Action action : possibleActions) { - // message += "\t" + i + ") " + action2String(action) + "\n"; - // } - // throw new RuntimeException(message); - // } - // Map map = actionsParams.get(0); - // Action action = possibleActions.get(0); - // organizeWithGivenParams(lara, act, params, newParams, action, map); - // } else { - // if (params.children == null) { - // for (Action action : actions) { - // if (action.getParameter().isEmpty()) { - // final Map actionParam = OrganizeUtils.createActionParameters(action, - // languageSpec); - // act.setArguments(actionParam); - // validateReturn(lara, action); - // return null; - // } - // } - // } else { - // for (Action action : actions) { - // int length = params.children.length; - // if (length == action.getParameter().size()) { // Just accept same size of parameters - // final Map actionParam = OrganizeUtils.createActionParameters(action, - // languageSpec); - // int i = 0; - // for (final ActionArgument arg : actionParam.values()) { - // arg.setValue((SimpleNode) params.jjtGetChild(i++)); - // } - // - // organizeWithGivenParams(lara, act, params, newParams, action, actionParam); - // return null; - // } - // } - // } - // throwIllegalParameters(actions, params.children); - // } - // /* - // - // act.setArguments(actionParam); - // - // if (children == null) { //DONE - // if (!actionParam.isEmpty()) { //DONE - // throw newException("Illegal number of arguments in action '" + action + "'. None was given, Expected " - // + actionParam.size() + " arguments: '" + actionParam.keySet() + "'"); - // } - // - // return null; //DONE - // } - // final ASTFunctionCallParameters params = (ASTFunctionCallParameters) children[0]; - // int callparametersId = LARAEcmaScriptTreeConstants.JJTFUNCTIONCALLPARAMETERS; - // final ASTFunctionCallParameters newParams = new ASTFunctionCallParameters(callparametersId); - // if (params.areNamed) { - // for (final Node param : params.getChildren()) { - // final ASTNamedArgument na = (ASTNamedArgument) param; - // if (!actionParam.containsKey(na.value)) { - // throw newException("The argument '" + na.value + "' does not exist for action '" + action - // + "'. Expected arguments: " + actionParam.keySet()); - // } - // final ActionArgument actArg = actionParam.get(na.value); - // actArg.setValue(na.getChild(0)); - // } - // } else { - // if (params.children == null) { - // if (actionParam.size() > 0) { - // // final int given = 0; - // // final String verb = given == 1 ? "was" : "were"; - // throw newException( - // "Illegal number of arguments in action '" + action + ". No arguments given, Expected " - // + actionParam.size() + " arguments: '" + actionParam.keySet() + "'"); - // } - // } else if ((params.children.length != actionParam.size())) { - // final int given = params.children.length; - // final String verb = given == 1 ? "was" : "were"; - // throw newException("Illegal number of arguments in action '" + action + ". '" + given + "' " + verb - // + " given, Expected " + actionParam.size() + " arguments: '" + actionParam.keySet() + "'"); - // } - // int i = 0; - // for (final ActionArgument arg : actionParam.values()) { - // arg.setValue((SimpleNode) params.jjtGetChild(i++)); - // } - // } - // int i = 0; - // final List missingArguments = new ArrayList<>(); - // for (final ActionArgument arg : actionParam.values()) { - // if (arg.getValue() == null) { - // missingArguments.add(arg.getName()); - // } else { - // if (arg.getType().equals("template")) { - // arg.getValue().isTemplate = true; - // } - // arg.getValue().organize(this); - // newParams.associateChild(arg.getValue(), i++); - // } - // } - // if (!missingArguments.isEmpty()) { - // throw newException("Arguments " + missingArguments + " for action '" + action + "' must be defined."); - // } - // associateChild(newParams, children.length - 1); - // - // if (returnName.isPresent()) { - // Action action2 = actionModel.getAction((action)); - // if (action2.getReturn().equals("void")) { - // lara.warnln("Using a variable assignment from an action that returns void."); - // } - // String varName = returnName.get(); - // final HashMap vars = getHMVars(); - // if (!vars.containsKey(varName)) { - // - // // Verify outputs - // - // Optional ancestorOfType = getAncestorOfType(ASTAspectDef.class); - // if (!ancestorOfType.isPresent() || - // !ancestorOfType.get().getOutputs().containsKey(varName)) { - // - // getHMVars().put(varName, new Variable(varName)); - // } - // } - // ASTAction parent = (ASTAction) jjtGetParent(); - // parent.setVarName(varName); - // - // } - // // if (children.length - 2 == 0) - // // return true; - // // - // - // */ - // // validateReturn(lara, actionModel); - // return null; - // } - - private void organizeWithGivenParams(final LaraC lara, final ASTAction act, final ASTFunctionCallParameters params, - final ASTFunctionCallParameters newParams, Action action, final Map actionParam) { - act.setArguments(actionParam); - int i = 0; - for (final ActionArgument arg : actionParam.values()) { - // arg.setValue((SimpleNode) params.jjtGetChild(i)); - if (arg.getType().equals("template")) { - arg.getValue().isTemplate = true; - } - arg.getValue().organize(this); - newParams.associateChild(arg.getValue(), i); - associateChild(newParams, children.length - 1); - validateReturn(lara, action); - i++; - } - - // for (final ActionArgument arg : actionParam.values()) { - // - // if (arg.getType().equals("template")) { - // arg.getValue().isTemplate = true; - // } - // arg.getValue().organize(this); - // newParams.associateChild(arg.getValue(), i++); - // } - } - - // private void validateReturn(final LaraC lara, final ActionModel actionModel) { - // if (returnName.isPresent()) - // - // { - // Action action2 = actionModel.getAction((action)); - // if (action2.getReturn().equals("void")) { - // lara.warnln("Using a variable assignment from an action that returns void."); - // } - // String varName = returnName.get(); - // final HashMap vars = getHMVars(); - // if (!vars.containsKey(varName)) { - // - // // Verify outputs - // - // Optional ancestorOfType = getAncestorOfType(ASTAspectDef.class); - // if (!ancestorOfType.isPresent() || - // !ancestorOfType.get().getOutputs().containsKey(varName)) { - // - // getHMVars().put(varName, new Variable(varName)); - // } - // } - // ASTAction parent = (ASTAction) jjtGetParent(); - // parent.setVarName(varName); - // - // } - // } - private void validateReturn(final LaraC lara, final Action action) { - if (returnName.isPresent()) { - - if (action.getReturnType().equals("void")) { - lara.warnln("Using a variable assignment from an action that returns void."); - } - String varName = returnName.get(); - final HashMap vars = getHMVars(); - if (!vars.containsKey(varName)) { - - // Verify outputs - - Optional ancestorOfType = getAncestorOfType(ASTAspectDef.class); - if (!ancestorOfType.isPresent() || - !ancestorOfType.get().getOutputs().containsKey(varName)) { - - getHMVars().put(varName, new Variable(varName)); - } - } - ASTAction parent = (ASTAction) jjtGetParent(); - parent.setVarName(varName); - - } - } - - private static boolean argsAreValid(Map actionParam) { - // int i = 0; - // final List missingArguments = SpecsFactory.newArrayList(); - for (final ActionArgument arg : actionParam.values()) { - if (arg.getValue() == null) { - return false; - // missingArguments.add(arg.getName()); - } else { - // if (arg.getType().equals("template")) { - // arg.getValue().isTemplate = true; - // } - // arg.getValue().organize(this); - // newParams.associateChild(arg.getValue(), i++); - } - } - // if (!missingArguments.isEmpty()) { - // throw newException( - // "Arguments " + missingArguments + " for action '" + action + "' must be defined."); - // } - return true; - } - - // private void organizeArgs(Map actionParam, ASTActionParameterList params) { - // int i = 0; - // for (final ActionArgument arg : actionParam.values()) { - // if (arg.getValue() == null) { - // throw new LARACompilerException("Unnexpected error. Please report to LARA developer"); - // // missingArguments.add(arg.getName()); - // } else { - // if (arg.getType().equals("template")) { - // arg.getValue().isTemplate = true; - // } - // arg.getValue().organize(this); - // params.associateChild(arg.getValue(), i++); - // } - // } - // // // if (!missingArguments.isEmpty()) { - // // // throw newException( - // // // "Arguments " + missingArguments + " for action '" + action + "' must be defined."); - // // // } - // // return true; - // } - - private void throwIllegalParameters(List actions, Node[] children) { - String message = "Illegal number of arguments in action '" + action + "'. "; - if (children == null) { - message += "None were given"; - } else { - if (children.length == 1) { - message += "One was given"; - } else { - message += children.length + " were given"; - } - } - - String numArgs = StringUtils.join(actions, a -> "(" + a.getParameters().size() + ")", ", "); - message += ", expected one of: " + numArgs + ". "; - String options = getOptionsString(actions); - message += options; - throw new LARACompilerException(message); - } - - private static String getOptionsString(List actions) { - String options = "Options:\n"; - int pos = 1; - for (Action action : actions) { - - String args = action2String(action); - options += "\t" + (pos++) + ") " + args + "\n"; - } - return options; - } - - private static String action2String(Action action) { - String args = action.getName() + "(" - + StringUtils.join(action.getParameters(), p -> p.getType() + " " + p.getName(), ", ") + ")"; - return args; - } - - /** - * @return the action - */ - public String getAction() { - return action; - } - - /** - * @param action - * the action to set - */ - public void setAction(String action) { - this.action = action; - } - - @Override - public String toString() { - return LARAEcmaScriptTreeConstants.jjtNodeName[id] + " [" + action + "]"; - } - - public void setVariable(String name) { - returnName = Optional.of(name); - } -} -/* - * JavaCC - OriginalChecksum=4864020f6ff39a51d8cfa5dfc0b2b815 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTPointcut.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTPointcut.java deleted file mode 100644 index 1232569b8..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTPointcut.java +++ /dev/null @@ -1,415 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTPointcut.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import larac.LaraC; -import larac.exceptions.LARACompilerException; -import larac.exceptions.LaraException; -import larac.objects.Enums.Types; -import larac.objects.Variable; -import org.dojo.jsl.parser.ast.utils.LARACConstantPool; -import org.lara.language.specification.dsl.Select; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import utils.SelectionPath; -import utils.Selector; - -import java.util.List; - -public class ASTPointcut extends SimpleNode { - public String reference; - private String type; - private Variable var; - private boolean validateChain = true; - - public ASTPointcut(int id) { - super(id); - } - - public ASTPointcut(LARAEcmaScript p, int id) { - super(p, id); - } - - public void setReference(String string) { - - if (!string.startsWith("$")) { - throw new LaraException( - "Id \"" + string + "\" for join point \"" + value + "\" must start with '$'"); - } - - reference = string; - - } - - public String getReference() { - return reference; - } - - /** - * @return the var - */ - public Variable getVar() { - return var; - } - - /** - * @param var the var to set - */ - public void setVar(Variable var) { - this.var = var; - } - - @Override - public Object organize(Object obj) { - final ASTSelect select = ((ASTSelect) obj); - final ASTAspectDef aspdef = this.getAspectDefForDeclStmt("Select"); - // final ASTAspectDef aspdef = (ASTAspectDef) (select.parent); - final LaraC lara = aspdef.getLara(); - // final JoinPointModel joinPointModel = lara.languageSpec().getJpModel(); - // This type was set previously, I hope! - // setType(joinPointModel.getLastPointcutType()); - var = new Variable(reference, Types.Joinpoint); - select.putPointcut(reference, this); - if (getChildren() == null) { - return null; - } - final SimpleNode firstChild = (SimpleNode) getChildren()[0]; - SimpleNode pointcutNode = null; - - if (firstChild instanceof ASTPointcutFilters) { - final ASTPointcutFilters pcp = (ASTPointcutFilters) firstChild; - pcp.organize(this, type, lara); - - if (getChildren().length > 1) { - pointcutNode = (SimpleNode) getChildren()[1]; - } else { - return null; - } - } else { - pointcutNode = firstChild; - } - - final String jpType = getType(); - final String selectName = pointcutNode.value.toString(); - // final PairList path2 = joinPointModel.getPath(jpType, selectName, validateChain); - final SelectionPath selPath = new Selector(lara.languageSpec()).selectionPath(jpType, selectName, - validateChain); - // final SelectionPathV2 selPath = joinPointModel.selectionPath(jpType, selectName, validateChain); - - // System.out.println("##########################################"); - // System.out.println("[DEBUG]" + path2); - // System.out.println("[DEBUG]" + selPath); - // System.out.println("##########################################"); - - if ((!selPath.hasPath() || selPath.getPath().isEmpty()) && validateChain) { - throw newException( - "The following pointcut chain is not correct: \"" + value + "\"->\"" + pointcutNode.value + "\""); - } - - if (selPath.hasSecondaryPath()) { - getLara().warnln("More than one path was found for select: " + selPath.toString()); - - } - List path = selPath.getReversedPath(); - - for (int j = 0; j < path.size() - 1; j++) { - final ASTPointcut pc = new ASTPointcut(id); - final String pcName = path.get(j).getSelectName(); - // final String pcName = path.get(j).getAlias(); - // final String pcType = path.get(j).getClazz().getClazz(); - final String pcType = path.get(j).getClazz().getName(); - pc.jjtSetValue(pcName); - pc.setReference("$" + pcName + LARACConstantPool.HIDDEN_TAG + select.getHiddenCount()); - pc.setType(pcType); - ((SimpleNode) parent).associateChild(pc, i); - pc.associateChild(this, 0); - i = 0; - } - // setType(path.get(path.size() - 1).getClazz().getClazz()); - setType(path.get(path.size() - 1).getClazz().getName()); - - // if (path == null || path.isEmpty()) { - // throw new LARACompilerException("No path exists for was found for join pont '" + value + "'"); - // } - // - // for (int j = 0; j < path.size() - 1; j++) { - // final ASTPointcut pc = new ASTPointcut(id); - // final String pcName = path.get(j).getLeft(); - // final String pcType = path.get(j).getRight(); - // pc.jjtSetValue(pcName); - // pc.setReference("$" + pcName + LARACConstantPool.HIDDEN_TAG + select.getHiddenCount()); - // pc.setType(pcType); - // ((SimpleNode) parent).associateChild(pc, i); - // pc.associateChild(this, 0); - // i = 0; - // } - // setType(path.last().getRight()); - this.organize(obj); - return null; - } - - private void setValidateChain(boolean b) { - validateChain = b; - } - - @Override - public Variable lookupLastJPVariable() { - if (children == null) { - return var; - } - if (children.length == 1) { - if ((children[0] instanceof ASTPointcutFilters)) { - return var; - } - return ((SimpleNode) children[0]).lookupLastJPVariable(); - } - return ((SimpleNode) children[1]).lookupLastJPVariable(); - } - - @Override - public String toString() { - return LARAEcmaScriptTreeConstants.jjtNodeName[id] - + (value != null ? " [" + reference + "," + value + "]" : ""); - } - - @Override - public void toXML(Document doc, Element parent) { - final Element nameExprEl = doc.createElement("expression"); - parent.appendChild(nameExprEl); - Element nameLitEl; - if (type != null && type.equals(LARACConstantPool.USER_DEFINED)) { - // nameExprEl.setAttribute("desc", USER_DEFINED); - nameLitEl = doc.createElement("id"); - nameLitEl.setAttribute("name", value.toString()); - } else { - - nameLitEl = doc.createElement("literal"); - nameLitEl.setAttribute("value", value.toString()); - nameLitEl.setAttribute("type", Types.String.toString()); - - } - - nameExprEl.appendChild(nameLitEl); - - final Element idExprEl = doc.createElement("expression"); - parent.appendChild(idExprEl); - final Element idLitEl = doc.createElement("literal"); - - idLitEl.setAttribute("value", getReference().substring(1)); - idLitEl.setAttribute("type", Types.String.toString()); - idExprEl.appendChild(idLitEl); - /* - * Element classExprEl = doc.createElement("expression"); - * parent.appendChild(classExprEl); Element classLitEl = - * doc.createElement("literal"); classLitEl.setAttribute("value", type); - * classLitEl.setAttribute("type", Types.String.toString()); - * classExprEl.appendChild(classLitEl); - */ - final Element filterExprEl = doc.createElement("expression"); - parent.appendChild(filterExprEl); - if (getChildren() == null) { - return; - } - if (((SimpleNode) getChildren()[0]) instanceof ASTPointcutFilters) { - ((SimpleNode) getChildren()[0]).toXML(doc, filterExprEl); - if (getChildren().length > 1) { - ((SimpleNode) getChildren()[1]).toXML(doc, parent); - } - } else { - ((SimpleNode) getChildren()[0]).toXML(doc, parent); - } - - } - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - - @Override - public boolean hasFilter() { - if (getChildren() == null) { - return false; - } - if (getChildren().length == 2) { - return true; - } - if (getChildren()[0] instanceof ASTPointcutFilters) { - return true; - } - return ((SimpleNode) getChildren()[0]).hasFilter(); - } - - @Override - public Element getFilterElement(Document doc) { - - // Element filterEl = doc.createElement("TODO-FILTER"); - if (getChildren() == null) { - return null; - } - if (getChildren().length == 2) { - final ASTPointcutFilters props = (ASTPointcutFilters) getChildren()[0]; - final Element propsEl = props.getFilterElement(doc); - final Element childPropsEl = ((SimpleNode) getChildren()[1]).getFilterElement(doc); - if (childPropsEl != null) { - final Element andEl = doc.createElement("AND"); - andEl.appendChild(propsEl); - andEl.appendChild(childPropsEl); - return andEl; - } - return propsEl; - } - if (getChildren()[0] instanceof ASTPointcutFilters) { - final ASTPointcutFilters props = (ASTPointcutFilters) getChildren()[0]; - return props.getFilterElement(doc); - } - return ((SimpleNode) getChildren()[0]).getFilterElement(doc); - - } -} - -/* - * JavaCC - OriginalChecksum=fe9e94dd85a2ee269ee705d34a1bed04 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTPointcutFilters.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTPointcutFilters.java deleted file mode 100644 index 10d9e362c..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTPointcutFilters.java +++ /dev/null @@ -1,102 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTPointcutFilters.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.LaraC; -import larac.exceptions.LARACompilerException; - -public class ASTPointcutFilters extends SimpleNode { - private boolean fullSpecified; - - public ASTPointcutFilters(int id) { - super(id); - } - - public ASTPointcutFilters(LARAEcmaScript p, int id) { - super(p, id); - } - - /** - * - * @param obj - * @param type - * @param lara - * @return - */ - public Object organize(Object obj, String type, LaraC lara) { - // if not full specified then we need to search for the default attribute and convert the children - // to full specified, i.e., == || == - if (!this.fullSpecified) { - final SimpleNode propChild = (SimpleNode) getChildren()[0]; - if (propChild instanceof ASTOrFiltersExpr) { - - for (int i = 0; i < propChild.getChildren().length; i++) { - setDefaultProperty(lara, propChild, (SimpleNode) propChild.getChildren()[i], i, type); - } - } else { - setDefaultProperty(lara, this, propChild, 0, type); - } - } - - for (final Node node : getChildren()) { - ((SimpleNode) node).organize(type, lara.languageSpec()); - } - return null; - } - - private static void setDefaultProperty(LaraC lara, SimpleNode child, SimpleNode value, int pos, String type) { - // final ArtifactsModel artifacts = lara.languageSpec().getArtifacts(); - // final Artifact art = artifacts.getArtifactRecursively(type); - // if (art == null) { - // - // throw new LARACompilerException("The joinpoint '" + type - // + "' does not contain any attribute defined, please reformulate the filter of the select."); - // } - // - // final String propStr = art.getDefault(); - - var defaultAttr = lara.languageSpec().getJoinPoint(type).getDefaultAttribute(); - - // if (propStr != null) { - if (defaultAttr.isPresent()) { - final ASTFilter prop = new ASTFilter(LARAEcmaScriptTreeConstants.JJTFILTER); - final ASTOperator op = new ASTOperator(LARAEcmaScriptTreeConstants.JJTOPERATOR); - op.jjtSetValue("=="); - // prop.setProp(propStr); - prop.setProp(defaultAttr.get()); - // prop.setOp("=="); - prop.associateChild(op, 0); - prop.associateChild(value, 1); - child.associateChild(prop, pos); - } else { - throw new LARACompilerException("The joinpoint '" + type - + "' does not contain a default attribute, please reformulate the filter of the select."); - } - } - - @Override - public Element getFilterElement(Document doc) { - return ((SimpleNode) getChildren()[0]).getFilterElement(doc); - } - - @Override - public void toXML(Document doc, Element parent) { - final Element propsCondEl = getFilterElement(doc); - - parent.appendChild(propsCondEl); - } - - public void setFullSpecified(boolean b) { - this.fullSpecified = b; - } -} -/* - * JavaCC - OriginalChecksum=b23d1ef4e84bc3e2939268dff4344012 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTPostAssignmentList.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTPostAssignmentList.java deleted file mode 100644 index 758b2f1b1..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTPostAssignmentList.java +++ /dev/null @@ -1,38 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTPostAssignmentList.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ASTPostAssignmentList extends SimpleNode { - public ASTPostAssignmentList(int id) { - super(id); - } - - public ASTPostAssignmentList(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - for (int i = 0; i < children.length; i++) { - ((SimpleNode) children[i]).organize(obj); - } - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - for (int i = 0; i < children.length; i++) { - ((SimpleNode) children[i]).toXML(doc, parent); - } - } -} -/* - * JavaCC - OriginalChecksum=3436d21d14d367e791f53c8a9e7d0b32 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTPostfixExpression.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTPostfixExpression.java deleted file mode 100644 index b9a667e23..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTPostfixExpression.java +++ /dev/null @@ -1,45 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTPostfixExpression.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ASTPostfixExpression extends SimpleNode { - private String op; - - public ASTPostfixExpression(int id) { - super(id); - } - - public ASTPostfixExpression(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - ((SimpleNode) children[0]).organize(obj); - final ASTOperator oper = ((ASTOperator) children[1]); - if (oper.value.toString().equals("++")) { - op = "INCS"; - } else { - op = "DECS"; - } - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - final Element opEl = doc.createElement("op"); - opEl.setAttribute("name", op); - parent.appendChild(opEl); - ((SimpleNode) children[0]).toXML(doc, opEl); - } -} -/* - * JavaCC - OriginalChecksum=0868f138559f384bd58ad9f9f495f1bb (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTPreAssignmentList.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTPreAssignmentList.java deleted file mode 100644 index 033d89005..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTPreAssignmentList.java +++ /dev/null @@ -1,38 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTPreAssignmentList.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ASTPreAssignmentList extends SimpleNode { - public ASTPreAssignmentList(int id) { - super(id); - } - - public ASTPreAssignmentList(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - for (int i = 0; i < children.length; i++) { - ((SimpleNode) children[i]).organize(obj); - } - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - for (int i = 0; i < children.length; i++) { - ((SimpleNode) children[i]).toXML(doc, parent); - } - } -} -/* - * JavaCC - OriginalChecksum=cf67b85cf68fc8793080c566bccd03d0 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTPropertyIdentifierReference.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTPropertyIdentifierReference.java deleted file mode 100644 index 847dd9d43..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTPropertyIdentifierReference.java +++ /dev/null @@ -1,78 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTPropertyIdentifierReference.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.LaraC; -import larac.objects.Enums.Types; - -public class ASTPropertyIdentifierReference extends SimpleNode { - public ASTPropertyIdentifierReference(int id) { - super(id); - } - - public ASTPropertyIdentifierReference(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public void toXML(Document doc, Element parent) { - final String name = ((ASTIdentifier) children[0]).getName(); - final Element literalEl = doc.createElement("literal"); - literalEl.setAttribute("value", name); - literalEl.setAttribute("type", Types.String.toString()); - parent.appendChild(literalEl); - // ((SimpleNode)children[0]).toXML(doc, parent); - } - - @Override - public Object organize(Object obj) { - return null; - } - - @Override - public String toSource(int indentation) { - - return indent(indentation) + ((ASTIdentifier) children[0]).toSource(); - } - - @Override - public void organizePointcutReference(ASTPointcut pc) { - final LaraC lara = getLara(); - if (lara.languageSpec().getJoinPoint(pc.getType()).getAttribute(((SimpleNode) children[0]).value.toString()) - .isEmpty()) { - // if (lara.languageSpec().getArtifacts().getAttribute(pc.getType(), - // ((SimpleNode) children[0]).value.toString()) == null) { - throw newException("The joinpoint \"" + pc.getReference() + "\" does not contain the attribute \"" - + ((SimpleNode) children[0]).value.toString() + "\""); - } - } - - @Override - public void organizeActionReference(ASTPointcut pc) { - final LaraC lara = getLara(); - // if (!lara.languageSpec().getActionModel().contains(((SimpleNode) children[0]).value.toString())) { - if (!lara.languageSpec().hasAction(((SimpleNode) children[0]).value.toString())) { - throw newException("The action \"" + ((SimpleNode) children[0]).value.toString() + "\" does not exist"); - } - } - - @Override - public String getMethodId() { - return ((SimpleNode) children[0]).getMethodId(); - } - - @Override - public String getVarName() { - return ((SimpleNode) children[0]).getVarName(); - } -} -/* - * JavaCC - OriginalChecksum=ce74fbfcc89103c0721fd0ebd16fcba1 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTPropertyValueReference.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTPropertyValueReference.java deleted file mode 100644 index 4f483d2bc..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTPropertyValueReference.java +++ /dev/null @@ -1,39 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTPropertyValueReference.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ASTPropertyValueReference extends SimpleNode { - public ASTPropertyValueReference(int id) { - super(id); - } - - public ASTPropertyValueReference(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - return ((SimpleNode) children[0]).organize(obj); - } - - @Override - public void toXML(Document doc, Element parent) { - ((SimpleNode) children[0]).toXML(doc, parent); - } - - @Override - public String toSource(int indentation) { - - return indent(indentation) + "[" + ((SimpleNode) children[0]).toSource(0) + "]"; - } -} -/* - * JavaCC - OriginalChecksum=a9e3d25c9236ea41f6a673f87a9ca4a5 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTReturnStatement.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTReturnStatement.java deleted file mode 100644 index 10155e6be..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTReturnStatement.java +++ /dev/null @@ -1,51 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTReturnStatement.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ASTReturnStatement extends SimpleNode { - public ASTReturnStatement(int id) { - super(id); - } - - public ASTReturnStatement(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - ((SimpleNode) children[0]).organize(obj); - return obj; - } - - @Override - public void toXML(Document doc, Element parent) { - // Element returnEl = doc.createElement("return"); - final SimpleNode funDecl = getParentById(LARAEcmaScriptTreeConstants.JJTFUNCTIONDECLARATION); - final SimpleNode funExpr = getParentById(LARAEcmaScriptTreeConstants.JJTFUNCTIONEXPRESSION); - final Element returnEl = doc.createElement("statement"); - if (funDecl == null && funExpr == null) { // IF both are null, mean that - // the return is somewhere - // inside the - // aspect - returnEl.setAttribute("name", "exit"); - } else { - returnEl.setAttribute("name", "return"); - } - returnEl.setAttribute("coord", getCoords()); - parent.appendChild(returnEl); - final Element exprEl = doc.createElement("expression"); - returnEl.appendChild(exprEl); - ((SimpleNode) children[0]).toXML(doc, exprEl); - } - -} -/* - * JavaCC - OriginalChecksum=1bec65412e57773f32b5cb7e65646749 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTRun.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTRun.java deleted file mode 100644 index 31592a475..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTRun.java +++ /dev/null @@ -1,212 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTRun.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.objects.Enums.AssignOperator; -import larac.objects.Enums.Types; -import larac.utils.OrganizeUtils; - -public @SuppressWarnings("all") class ASTRun extends SimpleNode { - private String toolName; - private static final int numOfJSRunMethod = 6; - - public ASTRun(int id) { - super(id); - } - - public ASTRun(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - int pos = 0; - if (!(children[pos] instanceof ASTFunctionCallParameters)) { - pos++; - } - - final ASTFunctionCallParameters args = (ASTFunctionCallParameters) children[pos]; - args.organize(obj); - if (args.jjtGetNumChildren() == 0 && toolName == null) { - throw newException("No argument was given in 'run'. At least 'tool' is required to execute."); - } - if (toolName != null) { - - return null; - } - final int remainingArgs = ASTRun.numOfJSRunMethod - args.jjtGetNumChildren(); - - if (remainingArgs < 0) { - getLara().warnln("A total of " + args.jjtGetNumChildren() - + " arguments was used in the tool execution, the required number of arguments are: " - + (ASTRun.numOfJSRunMethod - 1) + ". This may lead to issues in the tool execution."); - } else if (remainingArgs == 0 && (pos < children.length)) { - getLara().warnln(ASTRun.numOfJSRunMethod - + " arguments and a pipe in the 'run' method. However, the last argument overrides the used pipe."); - } - - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - final Element statementEl = doc.createElement("statement"); - statementEl.setAttribute("coord", getCoords()); - statementEl.setAttribute("name", "expr"); - parent.appendChild(statementEl); - - final Element exprEl = doc.createElement("expression"); - statementEl.appendChild(exprEl); - int pos = 0; - Element current = exprEl; - if (!(children[pos] instanceof ASTFunctionCallParameters)) { - // Then it is a left hand side expression - final Element opEl = doc.createElement("op"); - opEl.setAttribute("name", AssignOperator.ASSIGN.name()); - exprEl.appendChild(opEl); - ((SimpleNode) children[pos]).toXML(doc, opEl); - pos++; - current = opEl; - } - - final Element callEl = doc.createElement("call"); - current.appendChild(callEl); - final Element methodEl = doc.createElement("method"); - callEl.appendChild(methodEl); - final Element runIDEl = doc.createElement("id"); - runIDEl.setAttribute("name", "run"); - methodEl.appendChild(runIDEl); - final ASTFunctionCallParameters args = (ASTFunctionCallParameters) children[pos++]; - - if (toolName != null) { - toXMLOfNewVersion(doc, pos, callEl, args); - } else { // old version was used - - toXMLOldVersion(doc, pos, callEl, args); - } - } - - /** - * Generate the arguments of the use of old run method - * - * @param doc - * @param pos - * @param callEl - * @param args - */ - private void toXMLOldVersion(Document doc, int pos, Element callEl, ASTFunctionCallParameters args) { - args.toXML(doc, callEl); - final int remainingArgs = ASTRun.numOfJSRunMethod - args.jjtGetNumChildren(); - if (remainingArgs <= 0) { - return; - } - - final Element pipeEl = doc.createElement("argument"); - if (args.areNamed) { - pipeEl.setAttribute("name", "pipe"); - } else { - // Fill the missing arguments with 'undefined' - for (int i = 0; i < remainingArgs - 1; i++) { - final Element argEl = doc.createElement("argument"); - callEl.appendChild(argEl); - OrganizeUtils.createLiteralUndefined(doc, argEl); - } - - } - - callEl.appendChild(pipeEl); - - if (pos < children.length) { - final SimpleNode pipeExpr = (SimpleNode) children[pos]; - pipeExpr.toXML(doc, pipeEl); - } else { - OrganizeUtils.createLiteralUndefined(doc, pipeEl); - - } - } - - /** - * Generate the arguments of the use of new run method - */ - private void toXMLOfNewVersion(Document doc, int pos, Element callEl, ASTFunctionCallParameters args) { - // Then is the new run version - Element argEl = doc.createElement("argument"); - argEl.setAttribute("name", "tool"); - callEl.appendChild(argEl); - Element litEl = doc.createElement("literal"); - litEl.setAttribute("type", Types.String.toString()); - litEl.setAttribute("value", toolName); - argEl.appendChild(litEl); - setArgumentsAsList(args, doc, callEl); - - argEl = doc.createElement("argument"); - argEl.setAttribute("name", "verbose"); - callEl.appendChild(argEl); - litEl = doc.createElement("literal"); - litEl.setAttribute("type", Types.Int.toString()); - litEl.setAttribute("value", String.valueOf(2)); - argEl.appendChild(litEl); - argEl = doc.createElement("argument"); - argEl.setAttribute("name", "pipe"); - callEl.appendChild(argEl); - if (pos < children.length) { - final SimpleNode pipeExpr = (SimpleNode) children[pos]; - pipeExpr.toXML(doc, argEl); - } else { - OrganizeUtils.createLiteralUndefined(doc, argEl); - } - } - - private void setArgumentsAsList(ASTFunctionCallParameters args, Document doc, Element parentEl) { - final Element argEl = doc.createElement("argument"); - parentEl.appendChild(argEl); - argEl.setAttribute("name", "args"); - final Element litEl = doc.createElement("literal"); - argEl.appendChild(litEl); - if (args.areNamed) { - litEl.setAttribute("type", "object"); - for (final Node arg : args.getChildren()) { - final ASTNamedArgument na = (ASTNamedArgument) arg; - final Element keyEl = doc.createElement("key"); - na.toXML(doc, keyEl); - litEl.appendChild(keyEl); - } - } else { - litEl.setAttribute("type", "array"); - int i = 0; - for (final Node arg : args.getChildren()) { - final Element keyEl = doc.createElement("key"); - keyEl.setAttribute("name", String.valueOf(i++)); - litEl.appendChild(keyEl); - ((SimpleNode) arg).toXML(doc, keyEl); - } - } - - } - - /** - * @return the toolName - */ - public String getToolName() { - return toolName; - } - - /** - * @param toolName - * the toolName to set - */ - public void setToolName(String toolName) { - this.toolName = toolName; - } - -} -/* - * JavaCC - OriginalChecksum=a983f8b6f04dcc338add9564fb6fdd01 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTSecondSetOp.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTSecondSetOp.java deleted file mode 100644 index 3b8c7c553..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTSecondSetOp.java +++ /dev/null @@ -1,21 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTSecondSetOp.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -public class ASTSecondSetOp extends SimpleNode { - public ASTSecondSetOp(int id) { - super(id); - } - - public ASTSecondSetOp(LARAEcmaScript p, int id) { - super(p, id); - } - -} -/* - * JavaCC - OriginalChecksum=d91e265260790110aaade59f0249a7dd (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTSelect.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTSelect.java deleted file mode 100644 index 7bda02837..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTSelect.java +++ /dev/null @@ -1,184 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTSelect.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import java.util.HashMap; - -import org.dojo.jsl.parser.ast.utils.LARACConstantPool; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.objects.Enums.Types; -import larac.objects.Variable; -import tdrc.utils.HashBag; - -public class ASTSelect extends SimpleNode { - private String name; - private Variable lastJPVariable; - private int hiddenCount = 0; - private HashMap pointcuts = new HashMap<>(); - private final HashBag repeatedPointcutsBag = new HashBag<>(); - - public ASTSelect(int id) { - super(id); - } - - public ASTSelect(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - // final ASTAspectDef aspectDef = ((ASTAspectDef) obj); - final ASTAspectDef aspectDef = this.getAspectDefForDeclStmt("Select"); - if (name == null) { - name = aspectDef.getName() + "_select_" + aspectDef.getSelectCount(); - aspectDef.setLastSelectWithNoLabel(this); - } - - /* - * Variable var = lookup(name); if(var != null){ - * System.out.println("WHAT??"); throw newException("variable '"+name+ - * "' used in 'select' is already defined."); } - */ - final SimpleNode child = (SimpleNode) getChildren()[0]; - if (child instanceof ASTJoin) { - child.organize(aspectDef); - } else { - child.organizeFirst(this, 0); - // aspectDef.getLara().languageSpec().getJpModel().setLastPointcutType(null); - } - - if (aspectDef.putSelect(name, this) != null) { - throw newException("select '" + name + "' already defined."); - } - setLastJPVariable(lookupLastJPVariable()); - getHMVars().put(name, new Variable(name, Types.Joinpoint)); - return null; - } - - public Object organizeJoinInApply(Object obj) { - final ASTAspectDef aspectDef = ((ASTAspectDef) obj); - // final ASTAspectDef aspectDef = this.getAspectDefForDeclStmt("Select"); - final SimpleNode child = (SimpleNode) getChildren()[0]; - child.organize(aspectDef); - setLastJPVariable(lookupLastJPVariable()); - return null; - } - - @Override - public Variable lookupLastJPVariable() { - final SimpleNode child = (SimpleNode) getChildren()[0]; - return child.lookupLastJPVariable(); - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set - */ - public void setName(String name) { - this.name = name; - } - - @Override - public String toString() { - return LARAEcmaScriptTreeConstants.jjtNodeName[id] + (name != null ? " [" + name + "]" : ""); - } - - /** - * @return the pointcuts - */ - public HashMap getPointcuts() { - return pointcuts; - } - - public ASTPointcut getPointcut(String pc) { - return pointcuts.get(pc); - } - - /** - * @param pointcuts - * the pointcuts to set - */ - public void setPointcuts(HashMap pointcuts) { - this.pointcuts = pointcuts; - } - - public void putPointcut(String key, ASTPointcut pointcut) { - if (pointcuts.containsKey(key)) { - final ASTPointcut oldPC = pointcuts.get(key); - // System.out.println("KEY: " + key); - // System.out.println("REPEATED REF: " + oldPC.getReference()); - final int newVal = repeatedPointcutsBag.get(key); - repeatedPointcutsBag.put(key); - oldPC.setReference(key + LARACConstantPool.DISABLED_TAG + newVal); - pointcuts.put(oldPC.getReference(), oldPC); - } - pointcuts.put(key, pointcut); - } - - public int getHiddenCount() { - - return hiddenCount++; - } - - @Override - public void toXML(Document doc, Element parent) { - final Element selectEl = doc.createElement("statement"); - selectEl.setAttribute("name", "select"); - selectEl.setAttribute("label", getName()); - selectEl.setAttribute("coord", getCoords()); - parent.appendChild(selectEl); - /* - * UNCOMMENT IF NAME REQUIRED! * Element nameExprEl = - * doc.createElement("expression"); selectEl.appendChild(nameExprEl); - * Element nameLitEl = doc.createElement("literal"); - * nameLitEl.setAttribute("value", getName()); - * nameLitEl.setAttribute("type", Types.String.toString()); - * nameExprEl.appendChild(nameLitEl); / - **/ - if ((SimpleNode) getChildren()[0] instanceof ASTPointcut) { - ((SimpleNode) getChildren()[0]).toXML(doc, selectEl); - } else { - final Element exprEl = doc.createElement("expression"); - selectEl.appendChild(exprEl); - ((SimpleNode) getChildren()[0]).toXML(doc, exprEl); - } - } - - @Override - public boolean hasFilter() { - final SimpleNode child = (SimpleNode) getChildren()[0]; - return child.hasFilter(); - } - - @Override - public Element getFilterElement(Document doc) { - - final SimpleNode child = (SimpleNode) getChildren()[0]; - return child.getFilterElement(doc); - } - - public void setLastJPVariable(Variable lastJPVariable) { - this.lastJPVariable = lastJPVariable; - } - - public Variable getLastJPVariable() { - return lastJPVariable; - } - -} -/* - * JavaCC - OriginalChecksum=35d276dbfb06bfd94dbf01f8f69a2519 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTStart.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTStart.java deleted file mode 100644 index be233674a..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTStart.java +++ /dev/null @@ -1,133 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTStart.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import java.util.ArrayList; -import java.util.Iterator; - -import larac.LaraC; -import larac.objects.Variable; - -public class ASTStart extends SimpleNode { - private LaraC lara; - - public ASTStart(int id) { - super(id); - } - - public ASTStart(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - lara = (LaraC) obj; - var declList = new ArrayList(); - final ArrayList aspectsList = new ArrayList<>(); - if (getChildren() == null) { - return null; - } - for (final SimpleNode n : getSimpleNodeChildren()) { - if (!(n instanceof ASTAspectDef)) { - // n.declareGlobal(lara); - declList.add(n); // delay declaring global symbols - // ((SimpleNode) n).organize(obj); - } else { - aspectsList.add((ASTAspectDef) n); - } - } - for (final ASTAspectDef asp : aspectsList) { - asp.createAspect(lara); - asp.createVar(); - } - - // declare global symbols after aspects have been created - for (var n : declList) { - n.declareGlobal(lara); - } - - for (final ASTAspectDef asp : aspectsList) { - asp.organize(obj); - for (final SimpleNode sn : asp.getApplies()) { - ((ASTApply) sn).organizeAfter(); - } - } - return null; - } - - @Override - public Variable lookup(String var) { - ASTAspectDef asp = lara.aspectIR().getAspectDef(var); - if (asp != null) { - return asp.getStaticVar(); - } - asp = lara.aspectIR().getImportedAspectDef(var); - if (asp != null) { - return asp.getStaticVar(); - } - - if (lara.aspectIR().containsGlobal(var)) { - SimpleNode global = lara.aspectIR().getGlobal(var); - return new Variable(var, global.getExpressionType()); - } - - final Variable variableNotFound = new Variable(var); - variableNotFound.setNotFound(true); - return variableNotFound; - } - - public void getMatchingAspectDef(ArrayList aspects, String name) { - final Iterator it = aspects.iterator(); - while (it.hasNext()) { - final ASTAspectDef asp = it.next(); - if (!asp.getCompleteName().contains(name)) { - it.remove(); - } - } - } - - @Override - public Variable lookupNoError(String var) { - ASTAspectDef asp = lara.aspectIR().getAspectDef(var); - - if (asp != null) { - return asp.getStaticVar(); - } - asp = lara.aspectIR().getImportedAspectDef(var); - if (asp != null) { - return asp.getStaticVar(); - } - - return new Variable(var); - } - - @Override - public LaraC getLara() { - return lara; - } - - public void setLara(LaraC lara) { - this.lara = lara; - } - - @Override - public String toSource(int indentation) { - if (getChildren() == null) { - return ""; - } - String source = ""; - - for (final Node n : getChildren()) { - source += ((SimpleNode) n).toSource(indentation) + "\n"; - } - return source; - } - -} -/* - * JavaCC - OriginalChecksum=8071fc6e50a502f262cc0461c29fb06b (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTStatementList.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTStatementList.java deleted file mode 100644 index b5eb63947..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTStatementList.java +++ /dev/null @@ -1,38 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTStatementList.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ASTStatementList extends SimpleNode { - public ASTStatementList(int id) { - super(id); - } - - public ASTStatementList(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - for (final Node child : getChildren()) { - ((SimpleNode) child).organize(obj); - } - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - for (final Node child : getChildren()) { - ((SimpleNode) child).toXML(doc, parent); - } - } -} -/* - * JavaCC - OriginalChecksum=abb3ed87f64e250c8d785390504b91ff (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTStatic.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTStatic.java deleted file mode 100644 index 505e71fef..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTStatic.java +++ /dev/null @@ -1,109 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTStatic.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import java.util.HashMap; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.objects.SymbolTable; -import larac.objects.Variable; - -public class ASTStatic extends SimpleNode { - private SymbolTable localVars = new SymbolTable<>(); - - public ASTStatic(int id) { - super(id); - } - - public ASTStatic(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - if (getChildren() == null) { - return null; - } - if (((ASTAspectDef) parent).getStatic() != null) { - throw newException("Can only have one static section"); - } - ((ASTAspectDef) parent).setStatic(this); - for (final Node child : getChildren()) { - ((SimpleNode) child).organize(this); - } - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - if (localVars.isEmpty()) { - return; - } - final Element staticEl = doc.createElement("static"); - parent.appendChild(staticEl); - // createXMLDecl(localVars.values(),doc,staticEl); - for (final Node child : children) { - final SimpleNode sn = (SimpleNode) child; - sn.toXML(doc, staticEl); - } - } - - /** - * @return the localVars - */ - public SymbolTable getLocalVars() { - return localVars; - } - - @Override - public HashMap getHMVars() { - return localVars; - } - - /** - * @param localVars - * the localVars to set - */ - public void setLocalVars(SymbolTable localVars) { - this.localVars = localVars; - } - - @Override - public Variable lookup(String var) { - if (localVars.containsKey(var)) { - return localVars.get(var); - } - return ((SimpleNode) ((SimpleNode) parent).parent).lookupNoError(var); // grandfather - } - - public Variable lookupStatic(String var) { - if (localVars.containsKey(var)) { - return localVars.get(var); - } - return null; - } - - @Override - public Variable lookupNoError(String var) { - if (localVars.containsKey(var)) { - return localVars.get(var); - } - return ((SimpleNode) ((SimpleNode) parent).parent).lookupNoError(var); // grandfather - } - - public Variable lookupNoErrorStatic(String var) { - if (localVars.containsKey(var)) { - return localVars.get(var); - } - return null; - } -} -/* - * JavaCC - OriginalChecksum=5e81d4475827eff1b045f39e6f06f00f (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTSwitchStatement.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTSwitchStatement.java deleted file mode 100644 index e65a386da..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTSwitchStatement.java +++ /dev/null @@ -1,49 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTSwitchStatement.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ASTSwitchStatement extends SimpleNode { - public ASTSwitchStatement(int id) { - super(id); - } - - public ASTSwitchStatement(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - for (int i = 0; i < children.length; i++) { - ((SimpleNode) children[i]).organize(obj); - } - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - final Element statEl = doc.createElement("statement"); - parent.appendChild(statEl); - statEl.setAttribute("name", "switch"); - statEl.setAttribute("coord", getCoords()); - if (!label.isEmpty()) { - statEl.setAttribute("label", label); - } - final Element swEl = doc.createElement("expression"); - statEl.appendChild(swEl); - swEl.setAttribute("desc", "switcher"); - ((SimpleNode) children[0]).toXML(doc, swEl); - - ((SimpleNode) children[1]).toXML(doc, statEl); - } - -} -/* - * JavaCC - OriginalChecksum=c4be2b1ffd729f6b6c4034f162aad0e4 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTThirdSetOp.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTThirdSetOp.java deleted file mode 100644 index 8717863b3..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTThirdSetOp.java +++ /dev/null @@ -1,21 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTThirdSetOp.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -public class ASTThirdSetOp extends SimpleNode { - public ASTThirdSetOp(int id) { - super(id); - } - - public ASTThirdSetOp(LARAEcmaScript p, int id) { - super(p, id); - } - -} -/* - * JavaCC - OriginalChecksum=69404b05376c45d8012af93aee712405 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTThisReference.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTThisReference.java deleted file mode 100644 index 3bc36108e..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTThisReference.java +++ /dev/null @@ -1,43 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTThisReference.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.objects.Variable; - -public class ASTThisReference extends SimpleNode { - public ASTThisReference(int id) { - super(id); - } - - public ASTThisReference(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - return new Variable("this");// getParentById(LARAEcmaScriptTreeConstants.JJTASPECTDEF); - } - - @Override - public void toXML(Document doc, Element parent) { - final Element thisEl = doc.createElement("id"); - thisEl.setAttribute("name", "this"); - parent.appendChild(thisEl); - } - - @Override - public String toSource(int indentation) { - return indent(indentation) + "this"; - } - -} -/* - * JavaCC - OriginalChecksum=e8f88206dc48b417690bf934d8e6788e (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTThrowStatement.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTThrowStatement.java deleted file mode 100644 index 4e1ab5508..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTThrowStatement.java +++ /dev/null @@ -1,39 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTThrowStatement.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ASTThrowStatement extends SimpleNode { - public ASTThrowStatement(int id) { - super(id); - } - - public ASTThrowStatement(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - return ((SimpleNode) children[0]).organize(obj); - } - - @Override - public void toXML(Document doc, Element parent) { - final Element statEl = doc.createElement("statement"); - statEl.setAttribute("name", "throw"); - statEl.setAttribute("coord", getCoords()); - parent.appendChild(statEl); - final Element exprEl = doc.createElement("expression"); - statEl.appendChild(exprEl); - ((SimpleNode) children[0]).toXML(doc, exprEl); - } -} -/* - * JavaCC - OriginalChecksum=d4955a4ea899d87a9870aeeab52a0554 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTTo.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTTo.java deleted file mode 100644 index 1eb53fb40..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTTo.java +++ /dev/null @@ -1,97 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTTo.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import java.util.ArrayList; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ASTTo extends SimpleNode { - ArrayList selects = new ArrayList<>(); - - public ASTTo(int id) { - super(id); - } - - public ASTTo(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - final ASTApply apply = ((ASTApply) parent); - final ASTJavaScript js = apply.getBody(); - if (children[0] instanceof ASTJoin) { - final ASTSelect sel = new ASTSelect(LARAEcmaScriptTreeConstants.JJTSELECT); - sel.associateChild(((ASTJoin) children[0]), 0); - sel.organizeJoinInApply(getParentById(LARAEcmaScriptTreeConstants.JJTASPECTDEF)); - ((ASTJoin) children[0]).organize(apply.parent); - selects.add(sel); - - js.organize(apply); - associateChild(((ASTJoin) children[0]), 0); - } else { - final String id = ((ASTIdentifier) getChildren()[0]).value.toString(); - final ASTSelect select = apply.getSelect(id); - if (select == null) { - throw newException("Select '" + id + "' is undefined"); - } - selects.add(select); - js.organize(apply); - } - for (int i = 1; i < getChildren().length; i++) { - - if (children[i] instanceof ASTJoin) { - final ASTSelect sel = new ASTSelect(LARAEcmaScriptTreeConstants.JJTSELECT); - sel.associateChild(((ASTJoin) children[i]), 0); - sel.organizeJoinInApply(getParentById(LARAEcmaScriptTreeConstants.JJTASPECTDEF)); - ((ASTJoin) children[i]).organize(apply.parent); - selects.add(sel); - js.secondOrganize(sel); - associateChild(((ASTJoin) children[i]), i); - } else { - final String id = ((ASTIdentifier) getChildren()[i]).value.toString(); - final ASTSelect select = apply.getSelect(id); - if (select == null) { - throw newException("Select '" + id + "' is undefined"); - } - selects.add(select); - js.secondOrganize(select); - } - } - return null; - } - - public void organizeCondition(ASTApply astApply) { - final ASTApply apply = ((ASTApply) parent); - ((SimpleNode) apply.getCondition().getChildren()[1]).organize(apply); - - } - - public void toXML(Document doc, Element applyEl, int i) { - final SimpleNode child = (SimpleNode) children[i]; - final Element toEl = doc.createElement("expression"); - applyEl.appendChild(toEl); - if (child instanceof ASTIdentifier) { - final Element pcEl = doc.createElement("id"); - pcEl.setAttribute("name", child.value.toString()); - // pcEl.setAttribute("type", "JoinSet"); - toEl.appendChild(pcEl); - } else { - child.toXML(doc, toEl); - } - - } - - public String getLastJoinPointVar(int toPosition) { - return selects.get(toPosition).getLastJPVariable().getName(); - } -} -/* - * JavaCC - OriginalChecksum=7f29d2de88bf3b3dcd7b3887fc9e9770 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTTryStatement.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTTryStatement.java deleted file mode 100644 index 734c94605..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTTryStatement.java +++ /dev/null @@ -1,49 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTTryStatement.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ASTTryStatement extends SimpleNode { - public ASTTryStatement(int id) { - super(id); - } - - public ASTTryStatement(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - for (final Node child : getChildren()) { - ((SimpleNode) child).organize(obj); - } - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - final Element statEl = doc.createElement("statement"); - if (!label.isEmpty()) { - statEl.setAttribute("label", label); - } - statEl.setAttribute("name", "try"); - statEl.setAttribute("coord", getCoords()); - parent.appendChild(statEl); - final Element tryScope = doc.createElement("code"); - tryScope.setAttribute("desc", "body"); - statEl.appendChild(tryScope); - ((SimpleNode) children[0]).toXML(doc, tryScope); - for (int i = 1; i < children.length; i++) { - ((SimpleNode) children[i]).toXML(doc, statEl); - } - } -} -/* - * JavaCC - OriginalChecksum=45edd72666c6ffd45d42c72f6bc3c2c8 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTUnaryExpression.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTUnaryExpression.java deleted file mode 100644 index 1a6397abd..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTUnaryExpression.java +++ /dev/null @@ -1,59 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTUnaryExpression.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.objects.Enums.Types; - -public class ASTUnaryExpression extends SimpleNode { - public ASTUnaryExpression(int id) { - super(id); - } - - public ASTUnaryExpression(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - final SimpleNode unary = (SimpleNode) getChildren()[1]; - unary.organize(this); - final ASTOperator operator = (ASTOperator) getChildren()[0]; - operator.organize(this); - operator.setReturnType(unary.getExpressionType()); - return obj; - } - - @Override - public void toXML(Document doc, Element parent) { - final Element opEl = toXMLCommon(doc, parent); - final SimpleNode unary = getChild(1); - unary.toXML(doc, opEl); - } - - private Element toXMLCommon(Document doc, Element parent) { - final ASTOperator operator = (ASTOperator) getChildren()[0]; - final Element opEl = doc.createElement("op"); - opEl.setAttribute("name", operator.getTag()); - parent.appendChild(opEl); - if (!operator.getReturnType().equals(Types.Undefined)) { - opEl.setAttribute("type", operator.getReturnType().toString()); - } - return opEl; - } - - @Override - public Types getExpressionType() { - - return ((SimpleNode) getChildren()[1]).getExpressionType(); - } -} -/* - * JavaCC - OriginalChecksum=970e1ce05c9ee12da7f7ce34b02241b5 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTVariableDeclaration.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTVariableDeclaration.java deleted file mode 100644 index 3b75884e3..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTVariableDeclaration.java +++ /dev/null @@ -1,164 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTVariableDeclaration.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import java.util.HashMap; -import java.util.Optional; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.LaraC; -import larac.objects.Variable; -import larac.utils.xml.AspectIRFactory; - -public class ASTVariableDeclaration extends SimpleNode { - - private Optional type; - - public ASTVariableDeclaration(int id) { - super(id); - } - - public ASTVariableDeclaration(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public void declareGlobal(LaraC lara) { - - final ASTIdentifier id = (ASTIdentifier) getChildren()[0]; - final String varName = id.value.toString(); - if (getChildren().length > 1) { - SimpleNode init = getChild(1); - if (init instanceof ASTAssignmentExpression) { - throw newException("Chainned variable declaration assignments are not supported."); - } - init.organize(this); - // vars.put(varName, new Variable(varName, (SimpleNode) getChildren()[1])); - } - - lara.aspectIR().addGlobalElement(varName, this); - Optional ancestorOfType = getAncestorOfType(ASTVariableStatement.class); - if (ancestorOfType.isPresent()) { - jjtGetFirstToken().specialToken = ancestorOfType.get().jjtGetFirstToken().specialToken; - } - } - - @Override - public Object organize(Object obj) { - final HashMap vars = ((SimpleNode) obj).getHMVars(); - // final HashMap vars = getHMVars(); - if (!(getChildren()[0] instanceof ASTIdentifier)) { - throw newException("Variable not supported: \"" + ((SimpleNode) getChildren()[0]).toString() + "\"\n"); - } - final ASTIdentifier id = (ASTIdentifier) getChildren()[0]; - final String varName = id.value.toString(); - /* - * if(vars.containsKey(varName)) throw newException("Variable '" - * +varName+"' is already declared"); / - **/if (getChildren().length > 1) { - - SimpleNode init = getChild(1); - if (init instanceof ASTAssignmentExpression) { - throw newException("Chainned variable declaration assignments are not supported."); - } - init.organize(this); - // vars.put(varName, new Variable(varName, (SimpleNode) getChildren()[1])); - } - vars.put(varName, new Variable(varName)); - - return null; - - } - - @Override - public Object organize(Object obj, Object obj2) { - if (!(obj instanceof HashMap)) { - throw newException("Should have been an HashMap on ASTVariableDeclaration!\n"); - } - @SuppressWarnings("unchecked") - final HashMap vars = (HashMap) obj; - @SuppressWarnings("unchecked") - final HashMap otherVars = (HashMap) obj2; - if (getChildren()[0] instanceof ASTIdentifier) { - final String varName = getIdName(); - /* - * if(vars.containsKey(varName)) throw newException("Variable '" - * +varName+"' is already declared"); / - **/ - if (getChildren().length > 1) { - if (otherVars.containsKey(varName)) { - throw newException("Variable \"" + varName - + "\", used in both in Input and Output, can only be initialized on the Input.\n"); - } - - if (getChildren()[1] instanceof ASTAssignmentExpression) { - final ASTAssignmentExpression assignExpr = (ASTAssignmentExpression) getChild(1); - // final SimpleNode expr = - assignExpr.solveInitializeAssignment(vars); - // vars.put(varName, new Variable(varName));// , expr)); - } else { - getChild(1).organize(this); - // else { - } - // vars.put(varName, new Variable(varName));// , (SimpleNode) getChildren()[1])); - // } - } // else { - /* - * if(otherVars.containsKey(varName)) throw newException( - * "Variable '"+varName+"' already declared" - * );//vars.put(varName, otherVars.get(varName)); else/ - **/ - vars.put(varName, new Variable(varName)); - // } - } else - - { - throw newException("Variable not supported: \"" + ((SimpleNode) getChildren()[0]).toString() + "\"\n"); - } - // ASTAspectDef aspectDef = ((ASTAspectDef)obj); - // aspectDef.putInput(this); - return null; - - } - - @Override - public void toXML(Document doc, Element parent) { - final SimpleNode init = jjtGetNumChildren() > 1 ? getChild(1) : null; - AspectIRFactory.varDeclExprToXML(doc, parent, getIdName(), init, type); - //// final Variable var = lookupNoError(id.getName()); - // varDeclToXML(doc, parent, var); // <--replace this invocation! - } - - @Override - public void globalToXML(Document doc, Element parent) { - final Element statementDeclEl = doc.createElement("declaration"); - statementDeclEl.setAttribute("name", "vardecl"); - statementDeclEl.setAttribute("coord", getCoords()); - addXMLComent(statementDeclEl); - parent.appendChild(statementDeclEl); - toXML(doc, statementDeclEl); - - } - - public String getIdName() { - ASTIdentifier id = (ASTIdentifier) jjtGetChild(0); - return id.getName(); - } - - public Optional getType() { - return type; - } - - public void setType(String type) { - this.type = Optional.of(type); - } -} -/* - * JavaCC - OriginalChecksum=f4dddfe6c7daf45cbac10963428e4a90 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTVariableDeclarationList.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTVariableDeclarationList.java deleted file mode 100644 index 5551d641d..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTVariableDeclarationList.java +++ /dev/null @@ -1,68 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTVariableDeclarationList.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import java.util.ArrayList; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.LaraC; - -public class ASTVariableDeclarationList extends SimpleNode { - public ASTVariableDeclarationList(int id) { - super(id); - } - - public ASTVariableDeclarationList(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public void declareGlobal(LaraC lara) { - getSimpleNodeChildren().forEach(n -> n.declareGlobal(lara)); - } - - @Override - public Object organize(Object obj) { - - final ArrayList variablesDeclaration = new ArrayList<>(); - if (getChildren() != null) { - for (final Node n : getChildren()) { - variablesDeclaration.add((ASTVariableDeclaration) n); - ((SimpleNode) n).organize(obj); - } - } - return variablesDeclaration; - } - - @Override - public Object organize(Object obj, Object obj2) { - if (getChildren() == null) { - return null; - } - - final ArrayList variablesDeclaration = new ArrayList<>(); - for (final Node n : getChildren()) { - variablesDeclaration.add((ASTVariableDeclaration) n); - ((SimpleNode) n).organize(obj, obj2); - } - return variablesDeclaration; - } - - @Override - public void toXML(Document doc, Element parent) { - - for (final Node n : getChildren()) { - ((SimpleNode) n).toXML(doc, parent); - } - - } -} -/* - * JavaCC - OriginalChecksum=6a776e0bca1e74c8919a4767da17888c (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTVariableStatement.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTVariableStatement.java deleted file mode 100644 index 3ae3c586a..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTVariableStatement.java +++ /dev/null @@ -1,65 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTVariableStatement.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.LaraC; - -public class ASTVariableStatement extends SimpleNode { - public ASTVariableStatement(int id) { - super(id); - } - - public ASTVariableStatement(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj, Object obj2) { - for (final Node child : getChildren()) { - ((SimpleNode) child).organize(obj, obj2); - } - return null; - } - - @Override - public void declareGlobal(LaraC lara) { - getSimpleNodeChildren().forEach(n -> n.declareGlobal(lara)); - } - - @Override - public Object organize(Object obj) { - for (final Node child : getChildren()) { - ((SimpleNode) child).organize(this); - } - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - - final Element statementDeclEl = doc.createElement("statement"); - statementDeclEl.setAttribute("name", "vardecl"); - statementDeclEl.setAttribute("coord", getCoords()); - addXMLComent(statementDeclEl); - if (!label.isEmpty()) { - statementDeclEl.setAttribute("label", label); - } - - for (final Node child : getChildren()) { - ((SimpleNode) child).toXML(doc, statementDeclEl); - } - if (statementDeclEl.hasChildNodes()) { - parent.appendChild(statementDeclEl); - } - } -} -/* - * JavaCC - OriginalChecksum=c2a03cbc033a9517e3ea8ffd52530488 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTWhileStatement.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTWhileStatement.java deleted file mode 100644 index aa8f07ba8..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTWhileStatement.java +++ /dev/null @@ -1,56 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTWhileStatement.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.objects.Enums; - -public class ASTWhileStatement extends SimpleNode { - public ASTWhileStatement(int id) { - super(id); - } - - public ASTWhileStatement(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - for (int i = 0; i < children.length; i++) { - ((SimpleNode) children[i]).organize(obj); - } - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - final Element stmtEl = doc.createElement("statement"); - stmtEl.setAttribute("name", "loop"); - stmtEl.setAttribute("desc", Enums.LoopTypes.WHILE.toString()); - stmtEl.setAttribute("coord", getCoords()); - if (!label.isEmpty()) { - stmtEl.setAttribute("label", label); - } - parent.appendChild(stmtEl); - - final Element conditionEl = doc.createElement("expression"); - conditionEl.setAttribute("desc", "condition"); - stmtEl.appendChild(conditionEl); - ((SimpleNode) children[0]).toXML(doc, conditionEl); - - final Element codeEl = doc.createElement("code"); - codeEl.setAttribute("desc", "body"); - stmtEl.appendChild(codeEl); - ((SimpleNode) children[1]).toXML(doc, codeEl); - } - -} -/* - * JavaCC - OriginalChecksum=0d01611f7eb519190d61f4c36d5dc3da (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTWithStatement.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTWithStatement.java deleted file mode 100644 index 36fbc5203..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTWithStatement.java +++ /dev/null @@ -1,66 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTWithStatement.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.objects.Variable; - -public class ASTWithStatement extends SimpleNode { - public ASTWithStatement(int id) { - super(id); - } - - public ASTWithStatement(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - for (final Node child : getChildren()) { - ((SimpleNode) child).organize(obj); - } - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - final Element statEl = doc.createElement("statement"); - statEl.setAttribute("name", "with"); - statEl.setAttribute("coord", getCoords()); - if (!label.isEmpty()) { - statEl.setAttribute("label", label); - } - parent.appendChild(statEl); - - final Element exprEl = doc.createElement("expression"); - statEl.appendChild(exprEl); - ((SimpleNode) children[0]).toXML(doc, exprEl); - final Element codeEl = doc.createElement("code"); - statEl.appendChild(codeEl); - ((SimpleNode) children[1]).toXML(doc, codeEl); - } - - @Override - public Variable lookup(String var) { - return new Variable(var); - } - - @Override - public Variable lookupNoError(String var) { - - Variable retVar = super.lookupNoError(var); - if (retVar == null) { - retVar = new Variable(var); - } - return retVar; - } -} -/* - * JavaCC - OriginalChecksum=78f16403bd7e266f0ec510844f91e919 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTYieldStar.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTYieldStar.java deleted file mode 100644 index 3b7dd86a3..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTYieldStar.java +++ /dev/null @@ -1,16 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTYieldStar.java Version 7.0 */ -/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=true,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ -package org.dojo.jsl.parser.ast; - -public -class ASTYieldStar extends SimpleNode { - public ASTYieldStar(int id) { - super(id); - } - - public ASTYieldStar(LARAEcmaScript p, int id) { - super(p, id); - } - -} -/* JavaCC - OriginalChecksum=323cf70695742d00aedb5b915073d67e (do not edit this line) */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ASTYieldStatement.java b/LARAC/src/org/dojo/jsl/parser/ast/ASTYieldStatement.java deleted file mode 100644 index c943e0559..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ASTYieldStatement.java +++ /dev/null @@ -1,65 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTYieldStatement.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=true,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -package org.dojo.jsl.parser.ast; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ASTYieldStatement extends SimpleNode { - - private boolean hasStar = false; - - public ASTYieldStatement(int id) { - super(id); - } - - public ASTYieldStatement(LARAEcmaScript p, int id) { - super(p, id); - } - - @Override - public Object organize(Object obj) { - var expression = ((SimpleNode) children[0]); - if (expression instanceof ASTYieldStar) { - this.hasStar = true; - expression = ((SimpleNode) children[1]); - } - - // ((SimpleNode) children[0]).organize(obj); - expression.organize(obj); - return obj; - } - - @Override - public void toXML(Document doc, Element parent) { - // Element returnEl = doc.createElement("return"); - // final SimpleNode funDecl = getParentById(LARAEcmaScriptTreeConstants.JJTFUNCTIONDECLARATION); - // final SimpleNode funExpr = getParentById(LARAEcmaScriptTreeConstants.JJTFUNCTIONEXPRESSION); - final Element returnEl = doc.createElement("statement"); - var name = hasStar ? "yield_star" : "yield"; - returnEl.setAttribute("name", name); - /* - if (funDecl == null && funExpr == null) { // IF both are null, mean that - // the yield is somewhere - // inside the - // aspect - returnEl.setAttribute("name", "exit"); - } else { - returnEl.setAttribute("name", "yield"); - } - */ - returnEl.setAttribute("coord", getCoords()); - parent.appendChild(returnEl); - final Element exprEl = doc.createElement("expression"); - returnEl.appendChild(exprEl); - - int childIndex = ((SimpleNode) children[0]) instanceof ASTYieldStar ? 1 : 0; - - ((SimpleNode) children[childIndex]).toXML(doc, exprEl); - // ((SimpleNode) children[0]).toXML(doc, exprEl); - } -} -/* JavaCC - OriginalChecksum=b744cd05342470d303d814d1b3486714 (do not edit this line) */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/JJTLARAEcmaScriptState.java b/LARAC/src/org/dojo/jsl/parser/ast/JJTLARAEcmaScriptState.java deleted file mode 100644 index 94950a62b..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/JJTLARAEcmaScriptState.java +++ /dev/null @@ -1,123 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. JJTLARAEcmaScriptState.java Version 7.0.12 */ -package org.dojo.jsl.parser.ast; - -public class JJTLARAEcmaScriptState { - private java.util.List nodes; - private java.util.List marks; - - private int sp; // number of nodes on stack - private int mk; // current mark - private boolean node_created; - - public JJTLARAEcmaScriptState() { - nodes = new java.util.ArrayList(); - marks = new java.util.ArrayList(); - sp = 0; - mk = 0; - } - - /* Determines whether the current node was actually closed and - pushed. This should only be called in the final user action of a - node scope. */ - public boolean nodeCreated() { - return node_created; - } - - /* Call this to reinitialize the node stack. It is called - automatically by the parser's ReInit() method. */ - public void reset() { - nodes.clear(); - marks.clear(); - sp = 0; - mk = 0; - } - - /* Returns the root node of the AST. It only makes sense to call - this after a successful parse. */ - public Node rootNode() { - return nodes.get(0); - } - - /* Pushes a node on to the stack. */ - public void pushNode(Node n) { - nodes.add(n); - ++sp; - } - - /* Returns the node on the top of the stack, and remove it from the - stack. */ - public Node popNode() { - if (--sp < mk) { - mk = marks.remove(marks.size()-1); - } - return nodes.remove(nodes.size()-1); - } - - /* Returns the node currently on the top of the stack. */ - public Node peekNode() { - return nodes.get(nodes.size()-1); - } - - /* Returns the number of children on the stack in the current node - scope. */ - public int nodeArity() { - return sp - mk; - } - - - public void clearNodeScope(Node n) { - while (sp > mk) { - popNode(); - } - mk = marks.remove(marks.size()-1); - } - - - public void openNodeScope(Node n) { - marks.add(mk); - mk = sp; - n.jjtOpen(); - } - - - /* A definite node is constructed from a specified number of - children. That number of nodes are popped from the stack and - made the children of the definite node. Then the definite node - is pushed on to the stack. */ - public void closeNodeScope(Node n, int num) { - mk = marks.remove(marks.size()-1); - while (num-- > 0) { - Node c = popNode(); - c.jjtSetParent(n); - n.jjtAddChild(c, num); - } - n.jjtClose(); - pushNode(n); - node_created = true; - } - - - /* A conditional node is constructed if its condition is true. All - the nodes that have been pushed since the node was opened are - made children of the conditional node, which is then pushed - on to the stack. If the condition is false the node is not - constructed and they are left on the stack. */ - public void closeNodeScope(Node n, boolean condition) { - if (condition) { - int a = nodeArity(); - mk = marks.remove(marks.size()-1); - while (a-- > 0) { - Node c = popNode(); - c.jjtSetParent(n); - n.jjtAddChild(c, a); - } - n.jjtClose(); - pushNode(n); - node_created = true; - } else { - mk = marks.remove(marks.size()-1); - node_created = false; - } - } -} -/* JavaCC - OriginalChecksum=a1a1e094ffa39c58ec77fb52f6bd1a01 (do not edit this line) */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/JavaCharStream.java b/LARAC/src/org/dojo/jsl/parser/ast/JavaCharStream.java deleted file mode 100644 index 679161c07..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/JavaCharStream.java +++ /dev/null @@ -1,692 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 7.0 */ -/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ -package org.dojo.jsl.parser.ast; - -/** - * An implementation of interface CharStream, where the stream is assumed to - * contain only ASCII characters (with java-like unicode escape processing). - */ - -public -class JavaCharStream -{ - /** Whether parser is static. */ - public static final boolean staticFlag = false; - - static final int hexval(char c) throws java.io.IOException { - switch(c) - { - case '0' : - return 0; - case '1' : - return 1; - case '2' : - return 2; - case '3' : - return 3; - case '4' : - return 4; - case '5' : - return 5; - case '6' : - return 6; - case '7' : - return 7; - case '8' : - return 8; - case '9' : - return 9; - - case 'a' : - case 'A' : - return 10; - case 'b' : - case 'B' : - return 11; - case 'c' : - case 'C' : - return 12; - case 'd' : - case 'D' : - return 13; - case 'e' : - case 'E' : - return 14; - case 'f' : - case 'F' : - return 15; - } - - throw new java.io.IOException(); // Should never come here - } - -/* Position in buffer. */ - public int bufpos = -1; - int bufsize; - int available; - int tokenBegin; - protected int bufline[]; - protected int bufcolumn[]; - - protected int column = 0; - protected int line = 1; - - protected boolean prevCharIsCR = false; - protected boolean prevCharIsLF = false; - - protected java.io.Reader inputStream; - - protected char[] nextCharBuf; - protected char[] buffer; - protected int maxNextCharInd = 0; - protected int nextCharInd = -1; - protected int inBuf = 0; - protected int tabSize = 1; - protected boolean trackLineColumn = true; - - public void setTabSize(int i) { tabSize = i; } - public int getTabSize() { return tabSize; } - - protected void ExpandBuff(boolean wrapAround) - { - char[] newbuffer = new char[bufsize + 2048]; - int newbufline[] = new int[bufsize + 2048]; - int newbufcolumn[] = new int[bufsize + 2048]; - - try - { - if (wrapAround) - { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); - bufcolumn = newbufcolumn; - - bufpos += (bufsize - tokenBegin); - } - else - { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - bufcolumn = newbufcolumn; - - bufpos -= tokenBegin; - } - } - catch (Throwable t) - { - throw new Error(t.getMessage()); - } - - available = (bufsize += 2048); - tokenBegin = 0; - } - - protected void FillBuff() throws java.io.IOException - { - int i; - if (maxNextCharInd == 4096) - maxNextCharInd = nextCharInd = 0; - - try { - if ((i = inputStream.read(nextCharBuf, maxNextCharInd, - 4096 - maxNextCharInd)) == -1) - { - inputStream.close(); - throw new java.io.IOException(); - } - else - maxNextCharInd += i; - return; - } - catch(java.io.IOException e) { - if (bufpos != 0) - { - --bufpos; - backup(0); - } - else - { - bufline[bufpos] = line; - bufcolumn[bufpos] = column; - } - throw e; - } - } - - protected char ReadByte() throws java.io.IOException - { - if (++nextCharInd >= maxNextCharInd) - FillBuff(); - - return nextCharBuf[nextCharInd]; - } - -/* @return starting character for token. */ - public char BeginToken() throws java.io.IOException - { - if (inBuf > 0) - { - --inBuf; - - if (++bufpos == bufsize) - bufpos = 0; - - tokenBegin = bufpos; - return buffer[bufpos]; - } - - tokenBegin = 0; - bufpos = -1; - - return readChar(); - } - - protected void AdjustBuffSize() - { - if (available == bufsize) - { - if (tokenBegin > 2048) - { - bufpos = 0; - available = tokenBegin; - } - else - ExpandBuff(false); - } - else if (available > tokenBegin) - available = bufsize; - else if ((tokenBegin - available) < 2048) - ExpandBuff(true); - else - available = tokenBegin; - } - - protected void UpdateLineColumn(char c) - { - column++; - - if (prevCharIsLF) - { - prevCharIsLF = false; - line += (column = 1); - } - else if (prevCharIsCR) - { - prevCharIsCR = false; - if (c == '\n') - { - prevCharIsLF = true; - } - else - line += (column = 1); - } - - switch (c) - { - case '\r' : - prevCharIsCR = true; - break; - case '\n' : - prevCharIsLF = true; - break; - case '\t' : - column--; - column += (tabSize - (column % tabSize)); - break; - default : - break; - } - - bufline[bufpos] = line; - bufcolumn[bufpos] = column; - } - -/* Read a character. */ - public char readChar() throws java.io.IOException - { - if (inBuf > 0) - { - --inBuf; - - if (++bufpos == bufsize) - bufpos = 0; - - return buffer[bufpos]; - } - - char c; - - if (++bufpos == available) - AdjustBuffSize(); - - if ((buffer[bufpos] = c = ReadByte()) == '\\') - { - if (trackLineColumn) { UpdateLineColumn(c); } - - int backSlashCnt = 1; - - for (;;) // Read all the backslashes - { - if (++bufpos == available) - AdjustBuffSize(); - - try - { - if ((buffer[bufpos] = c = ReadByte()) != '\\') - { - if (trackLineColumn) { UpdateLineColumn(c); } - // found a non-backslash char. - if ((c == 'u') && ((backSlashCnt & 1) == 1)) - { - if (--bufpos < 0) - bufpos = bufsize - 1; - - break; - } - - backup(backSlashCnt); - return '\\'; - } - } - catch(java.io.IOException e) - { - // We are returning one backslash so we should only backup (count-1) - if (backSlashCnt > 1) - backup(backSlashCnt-1); - - return '\\'; - } - - if (trackLineColumn) { UpdateLineColumn(c); } - backSlashCnt++; - } - - // Here, we have seen an odd number of backslash's followed by a 'u' - try - { - while ((c = ReadByte()) == 'u') - ++column; - - buffer[bufpos] = c = (char)(hexval(c) << 12 | - hexval(ReadByte()) << 8 | - hexval(ReadByte()) << 4 | - hexval(ReadByte())); - - column += 4; - } - catch(java.io.IOException e) - { - throw new Error("Invalid escape character at line " + line + - " column " + column + "."); - } - - if (backSlashCnt == 1) - return c; - else - { - backup(backSlashCnt - 1); - return '\\'; - } - } - else - { - UpdateLineColumn(c); - return c; - } - } - - /* - * @deprecated - * @see #getEndColumn - */ - @Deprecated - public int getColumn() { - return bufcolumn[bufpos]; - } - - /* - * @deprecated - * @see #getEndLine - * @return the line number. - */ - @Deprecated - public int getLine() { - return bufline[bufpos]; - } - -/** Get end column. - * @return the end column or -1 - */ - public int getEndColumn() { - return bufcolumn[bufpos]; - } - -/** Get end line. - * @return the end line number or -1 - */ - public int getEndLine() { - return bufline[bufpos]; - } - -/** Get the beginning column. - * @return column of token start */ - public int getBeginColumn() { - return bufcolumn[tokenBegin]; - } - -/** @return line number of token start */ - public int getBeginLine() { - return bufline[tokenBegin]; - } - -/** Retreat. */ - public void backup(int amount) { - - inBuf += amount; - if ((bufpos -= amount) < 0) - bufpos += bufsize; - } - -/** Constructor. - * @param dstream the underlying data source. - * @param startline line number of the first character of the stream, mostly for error messages. - * @param startcolumn column number of the first character of the stream. - * @param buffersize size of the buffer - */ - public JavaCharStream(java.io.Reader dstream, - int startline, int startcolumn, int buffersize) - { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - nextCharBuf = new char[4096]; - } - -/** Constructor. - * @param dstream the underlying data source. - * @param startline line number of the first character of the stream, mostly for error messages. - * @param startcolumn column number of the first character of the stream. - */ - public JavaCharStream(java.io.Reader dstream, - int startline, int startcolumn) - { - this(dstream, startline, startcolumn, 4096); - } - -/** Constructor. - * @param dstream the underlying data source. - * @param startline line number of the first character of the stream, mostly for error messages. - */ - public JavaCharStream(java.io.Reader dstream) - { - this(dstream, 1, 1, 4096); - } -/* Reinitialise. */ - public void ReInit(java.io.Reader dstream, - int startline, int startcolumn, int buffersize) - { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - if (buffer == null || buffersize != buffer.length) - { - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - nextCharBuf = new char[4096]; - } - prevCharIsLF = prevCharIsCR = false; - tokenBegin = inBuf = maxNextCharInd = 0; - nextCharInd = bufpos = -1; - } - -/* Reinitialise. */ - public void ReInit(java.io.Reader dstream, - int startline, int startcolumn) - { - ReInit(dstream, startline, startcolumn, 4096); - } - -/* Reinitialise. */ - public void ReInit(java.io.Reader dstream) - { - ReInit(dstream, 1, 1, 4096); - } -/** Constructor. */ - public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, - int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException - { - this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); - } - -/** Constructor. - * @param dstream the underlying data source. - * @param startline line number of the first character of the stream, mostly for error messages. - * @param startcolumn column number of the first character of the stream. - * @param buffersize size of the buffer - */ - public JavaCharStream(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) - { - this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); - } - -/** Constructor. - * @param dstream the underlying data source. - * @param encoding the character encoding of the data stream. - * @param startline line number of the first character of the stream, mostly for error messages. - * @param startcolumn column number of the first character of the stream. - * @throws UnsupportedEncodingException encoding is invalid or unsupported. - */ - public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, - int startcolumn) throws java.io.UnsupportedEncodingException - { - this(dstream, encoding, startline, startcolumn, 4096); - } - -/** Constructor. - * @param dstream the underlying data source. - * @param startline line number of the first character of the stream, mostly for error messages. - * @param startcolumn column number of the first character of the stream. - */ - public JavaCharStream(java.io.InputStream dstream, int startline, - int startcolumn) - { - this(dstream, startline, startcolumn, 4096); - } - -/** Constructor. - * @param dstream the underlying data source. - * @param encoding the character encoding of the data stream. - * @throws UnsupportedEncodingException encoding is invalid or unsupported. - */ - public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException - { - this(dstream, encoding, 1, 1, 4096); - } - - /** Constructor. - * @param dstream the underlying data source. - */ - public JavaCharStream(java.io.InputStream dstream) - { - this(dstream, 1, 1, 4096); - } - -/** Reinitialise. - * @param dstream the underlying data source. - * @param encoding the character encoding of the data stream. - * @param startline line number of the first character of the stream, mostly for error messages. - * @param startcolumn column number of the first character of the stream. - * @param buffersize size of the buffer - */ - public void ReInit(java.io.InputStream dstream, String encoding, int startline, - int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException - { - ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); - } - -/** Reinitialise. - * @param dstream the underlying data source. - * @param startline line number of the first character of the stream, mostly for error messages. - * @param startcolumn column number of the first character of the stream. - * @param buffersize size of the buffer - */ - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) - { - ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); - } -/** Reinitialise. - * @param dstream the underlying data source. - * @param encoding the character encoding of the data stream. - * @param startline line number of the first character of the stream, mostly for error messages. - * @param startcolumn column number of the first character of the stream. - * @throws UnsupportedEncodingException encoding is invalid or unsupported. - */ - public void ReInit(java.io.InputStream dstream, String encoding, int startline, - int startcolumn) throws java.io.UnsupportedEncodingException - { - ReInit(dstream, encoding, startline, startcolumn, 4096); - } -/** Reinitialise. - * @param dstream the underlying data source. - * @param startline line number of the first character of the stream, mostly for error messages. - * @param startcolumn column number of the first character of the stream. - */ - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn) - { - ReInit(dstream, startline, startcolumn, 4096); - } -/** Reinitialise. - * @param dstream the underlying data source. - * @param encoding the character encoding of the data stream. - * @throws UnsupportedEncodingException encoding is invalid or unsupported. - */ - public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException - { - ReInit(dstream, encoding, 1, 1, 4096); - } - -/** Reinitialise. - * @param dstream the underlying data source. - */ - public void ReInit(java.io.InputStream dstream) - { - ReInit(dstream, 1, 1, 4096); - } - - /** Get the token timage. - * @return token image as String */ - public String GetImage() - { - if (bufpos >= tokenBegin) - return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); - else - return new String(buffer, tokenBegin, bufsize - tokenBegin) + - new String(buffer, 0, bufpos + 1); - } - - /** Get the suffix as an array of characters. - * @param len the length of the array to return. - * @return suffix */ - public char[] GetSuffix(int len) - { - char[] ret = new char[len]; - - if ((bufpos + 1) >= len) - System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); - else - { - System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, - len - bufpos - 1); - System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); - } - - return ret; - } - - /** Set buffers back to null when finished. */ - public void Done() - { - nextCharBuf = null; - buffer = null; - bufline = null; - bufcolumn = null; - } - - /** - * Method to adjust line and column numbers for the start of a token. - * - * @param newLine the new line number. - * @param newCol the new column number. - */ - public void adjustBeginLineColumn(int newLine, int newCol) - { - int start = tokenBegin; - int len; - - if (bufpos >= tokenBegin) - { - len = bufpos - tokenBegin + inBuf + 1; - } - else - { - len = bufsize - tokenBegin + bufpos + 1 + inBuf; - } - - int i = 0, j = 0, k = 0; - int nextColDiff = 0, columnDiff = 0; - - while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) - { - bufline[j] = newLine; - nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; - bufcolumn[j] = newCol + columnDiff; - columnDiff = nextColDiff; - i++; - } - - if (i < len) - { - bufline[j] = newLine++; - bufcolumn[j] = newCol + columnDiff; - - while (i++ < len) - { - if (bufline[j = start % bufsize] != bufline[++start % bufsize]) - bufline[j] = newLine++; - else - bufline[j] = newLine; - } - } - - line = bufline[j]; - column = bufcolumn[j]; - } - boolean getTrackLineColumn() { return trackLineColumn; } - void setTrackLineColumn(boolean tlc) { trackLineColumn = tlc; } - -} -/* JavaCC - OriginalChecksum=7fd6038e4bf0504b4ac40a1960385be2 (do not edit this line) */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScript.html b/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScript.html deleted file mode 100644 index 1c2e7e392..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScript.html +++ /dev/null @@ -1,2007 +0,0 @@ - - - -BNF for LARAEcmaScript.jj - - -

BNF for LARAEcmaScript.jj

-

TOKENS

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-/*****************************************
- * LEXICAL & REGEXP GRAMMARS STARTS HERE *
- *****************************************/
-
-
-/* Section 7 : Lexical Conventions */
-
-/* Section 7.2 : White Space */
-
-
-<DEFAULT,IN_REGEX> SPECIAL : {
-<WHITE_SPACE: <TAB> | <VT> | <FF> | <SP> | <NBSP>>
-| <#TAB: "\t" | "\t">
-| <#VT: "\u000b">
-| <#FF: "\f" | "\f">
-| <#SP: " " | " ">
-| <#NBSP: "\u00a0">
-| <#USP: ["\u2000"] | ["\u2001"] | ["\u2002"] | ["\u2003"] | ["\u2004"] | ["\u2005"] | ["\u2006"] | ["\u2007"] | ["\u2008"] | ["\u2009"] | ["\u200a"] | ["\u200b"] | ["\u3000"]>
-}
-
-   
-
-
-/* Section 7.3 : Line Terminators */
-
-
-<DEFAULT,IN_REGEX> SPECIAL : {
-<LINE_TERMINATOR: <LF> | <CR> | <LS> | <PS>>
-| <#LF: "\n">
-| <#CR: "\r">
-| <#LS: "\u2028">
-| <#PS: "\u2029">
-}
-
-   
-
-
-/* Comments */
-
-
-<DEFAULT,IN_REGEX> MORE : {
-"//" : IN_SINGLE_LINE_COMMENT
-| "/*" : IN_MULTI_LINE_COMMENT
-}
-
-   
-
-
-<IN_SINGLE_LINE_COMMENT> SPECIAL : {
-<SINGLE_LINE_COMMENT: (~["\n","\r"])* ("\n" | "\r" | "\r\n")?> : DEFAULT
-}
-
-   
-
-
-<IN_MULTI_LINE_COMMENT> SPECIAL : {
-<MULTI_LINE_COMMENT: "*/"> : DEFAULT
-}
-
-   
-
-
-<IN_SINGLE_LINE_COMMENT,IN_MULTI_LINE_COMMENT,IN_PATTERN> MORE : {
-<~[]>
-}
-
-   
-
-
-/* Section 7.5.1: Reserved Words */
-
-
-<DEFAULT,IN_REGEX> TOKEN : {
-<INCLUDE: "include"> : DEFAULT
-| <ASPECTDEF: "aspectdef"> : DEFAULT
-| <CODEDEF: "codedef"> : DEFAULT
-| <INPUT: "input"> : DEFAULT
-| <OUTPUT: "output"> : DEFAULT
-| <STATICDECL: "static"> : DEFAULT
-| <SELECT: "select"> : DEFAULT
-| <APPLY: "apply"> : DEFAULT
-| <TO: "to"> : DEFAULT
-| <CALL: "call"> : DEFAULT
-| <RUN: "run"> : DEFAULT
-| <CMD: "cmd"> : DEFAULT
-| <CONDITION: "condition"> : DEFAULT
-| <BEGIN: "begin"> : DEFAULT
-| <INSERT: "insert"> : DEFAULT
-| <EXEC: "exec"> : DEFAULT
-| <OUTPUT_ACT: "out"> : DEFAULT
-| <BEFORE: "before"> : DEFAULT
-| <AFTER: "after"> : DEFAULT
-| <AROUND: "around"> : DEFAULT
-| <REPLACE: "replace"> : DEFAULT
-| <DEFINE: "def"> : DEFAULT
-| <CHECK: "check"> : DEFAULT
-| <INITIALIZE: "initialize"> : DEFAULT
-| <FINALIZE: "finalize"> : DEFAULT
-| <END: "end"> : DEFAULT
-| <DYNAMIC: "dynamic"> : DEFAULT
-| <SEQUENCIAL: "seq"> : DEFAULT
-| <PARALLEL: "par"> : DEFAULT
-| <BREAK: "break"> : DEFAULT
-| <CONTINUE: "continue"> : DEFAULT
-| <DELETE: "delete"> : DEFAULT
-| <ELSE: "else"> : DEFAULT
-| <FOR: "for"> : DEFAULT
-| <FUNCTION: "function"> : DEFAULT
-| <IF: "if"> : DEFAULT
-| <IN: "in"> : DEFAULT
-| <OF: "of"> : DEFAULT
-| <EACH: "each"> : DEFAULT
-| <NEW: "new"> : DEFAULT
-| <RETURN: "return"> : DEFAULT
-| <THIS: "this"> : IN_REGEX
-| <TYPEOF: "typeof"> : DEFAULT
-| <VAR: "var"> : DEFAULT
-| <VOID: "void"> : DEFAULT
-| <WHILE: "while"> : DEFAULT
-| <WITH: "with"> : DEFAULT
-| <CASE: "case"> : DEFAULT
-| <CATCH: "catch"> : DEFAULT
-| <CLASS: "class"> : DEFAULT
-| <CONST: "const"> : DEFAULT
-| <DEBUGGER: "debugger"> : DEFAULT
-| <_DEFAULT: "default"> : DEFAULT
-| <DO: "do"> : DEFAULT
-| <ENUM: "enum"> : DEFAULT
-| <EXTENDS: "extends"> : DEFAULT
-| <FINALLY: "finally"> : DEFAULT
-| <IMPORT: "import"> : DEFAULT
-| <SUPER: "super"> : DEFAULT
-| <SWITCH: "switch"> : DEFAULT
-| <THROW: "throw"> : DEFAULT
-| <TRY: "try"> : DEFAULT
-| <UTF8_BOM: "\u00ef\u00bb\u00bf"> : DEFAULT
-}
-
-   
-
-
-/* JScript .NET Tokens
-
-TOKEN :
-{
-	< BYTE: "byte" >
-	| < SBYTE: "sbyte" >
-	| < SHORT: "short" >
-	| < USHORT: "ushort" >
-	| < UINT: "uint" >
-	| < LONG: "long" >
-	| < ULONG: "ulong" >
-	| < FLOAT: "float" >
-	| < NUMBER: "Number" >
-	| < DOUBLE: "double" >
-	| < DECIMAL: "decimal" >
-	| < BOOLEAN: "boolean" >
-	| < STRING: "String" >
-	| < CHAR: "char" >
-}
-
-*/
-
-
-/* Section 7.7: Punctuators */
-
-
-<DEFAULT,IN_REGEX> TOKEN : {
-<LBRACE: "{"> : DEFAULT
-| <RBRACE: "}"> : IN_REGEX
-| <LPAREN: "("> : DEFAULT
-| <RPAREN: ")"> : IN_REGEX
-| <LBRACKET: "["> : DEFAULT
-| <RBRACKET: "]"> : IN_REGEX
-| <DOT: "."> : DEFAULT
-| <SEMICOLON: ";"> : DEFAULT
-| <COMMA: ","> : DEFAULT
-| <LT: "<"> : DEFAULT
-| <GT: ">"> : DEFAULT
-| <LE: "<="> : DEFAULT
-| <GE: ">="> : DEFAULT
-| <EQ: "=="> : DEFAULT
-| <NE: "!="> : DEFAULT
-| <MATCH: "~="> : DEFAULT
-| <SEQ: "==="> : DEFAULT
-| <SNEQ: "!=="> : DEFAULT
-| <PLUS: "+"> : DEFAULT
-| <MINUS: "-"> : DEFAULT
-| <STAR: "*"> : DEFAULT
-| <REM: "%"> : DEFAULT
-| <INCR: "++"> : IN_REGEX
-| <DECR: "--"> : IN_REGEX
-| <LSHIFT: "<<"> : DEFAULT
-| <RSHIFT: ">>"> : DEFAULT
-| <RUNSHIFT: ">>>"> : DEFAULT
-| <BIT_AND: "&"> : DEFAULT
-| <BIT_OR: "|"> : DEFAULT
-| <XOR: "^"> : DEFAULT
-| <BANG: "!"> : DEFAULT
-| <TILDE: "~"> : IN_REGEX
-| <SC_AND: "&&"> : DEFAULT
-| <SC_OR: "||"> : DEFAULT
-| <HOOK: "?"> : DEFAULT
-| <NATURAL_JOIN: "::"> : DEFAULT
-| <COLON: ":"> : DEFAULT
-| <ASSIGN: "="> : DEFAULT
-| <PLUSASSIGN: "+="> : DEFAULT
-| <MINUSASSIGN: "-="> : DEFAULT
-| <STARASSIGN: "*="> : DEFAULT
-| <REMASSIGN: "%="> : DEFAULT
-| <LSHIFTASSIGN: "<<="> : DEFAULT
-| <RSIGNEDSHIFTASSIGN: ">>="> : DEFAULT
-| <RUNSIGNEDSHIFTASSIGN: ">>>="> : DEFAULT
-| <ANDASSIGN: "&="> : DEFAULT
-| <ORASSIGN: "|="> : DEFAULT
-| <XORASSIGN: "^="> : DEFAULT
-| <INTANCE_OF: "instanceof"> : DEFAULT
-}
-
-   
-
-
-/* Section 7.8.3: Numeric Literals */
-
-
-<DEFAULT,IN_REGEX> TOKEN : {
-<DECIMAL_LITERAL: <DECIMAL_INTEGER_LITERAL> "." (<DECIMAL_DIGITS>)? (<EXPONENT_PART>)? | "." <DECIMAL_DIGITS> (<EXPONENT_PART>)? | <DECIMAL_INTEGER_LITERAL> (<EXPONENT_PART>)?> : IN_REGEX
-| <#NON_ZERO_DIGIT: ["1"-"9"]>
-| <#EXPONENT_PART: ("e" | "E") (["+","-"])? <DECIMAL_DIGITS>>
-}
-
-   
-
-
-<DEFAULT,IN_REGEX> TOKEN : {
-<DECIMAL_INTEGER_LITERAL: "0" | <NON_ZERO_DIGIT> (<DECIMAL_DIGITS>)?> : IN_REGEX
-}
-
-   
-
-
-<DEFAULT,IN_REGEX> TOKEN : {
-<HEX_INTEGER_LITERAL: "0" ["x","X"] (<HEX_DIGIT>)+> : IN_REGEX
-}
-
-   
-
-
-<DEFAULT,IN_REGEX> TOKEN : {
-<DECIMAL_DIGITS: (<DECIMAL_DIGIT>)+> : IN_REGEX
-}
-
-   
-
-
-<DEFAULT> TOKEN : {
-<DECIMAL_DIGIT: ["0"-"9"]>
-}
-
-   
-
-
-/* Section 7.8.1: NULL Literals */
-
-
-<DEFAULT,IN_REGEX> TOKEN : {
-<NULL_LITERAL: "null"> : IN_REGEX
-}
-
-   
-
-
-/* Section 7.8.2: Boolean Literals */
-
-
-<DEFAULT,IN_REGEX> TOKEN : {
-<BOOLEAN_LITERAL: "true" | "false"> : IN_REGEX
-}
-
-   
-
-
-/* Section 7.8.4: String Literals */
-
-
-<DEFAULT,IN_REGEX> TOKEN : {
-<STRING_LITERAL: "\"" (<DOUBLE_STRING_CHARACTERS>)? "\"" | "\'" (<SINGLE_STRING_CHARACTERS>)? "\'"> : IN_REGEX
-| <#DOUBLE_STRING_CHARACTERS: (<DOUBLE_STRING_CHARACTER>)*>
-| <#SINGLE_STRING_CHARACTERS: (<SINGLE_STRING_CHARACTER>)*>
-| <#DOUBLE_STRING_CHARACTER: (~["\"","\\","\n","\r","\u2028","\u2029"])* | "\\" <ESCAPE_SEQUENCE>>
-| <#SINGLE_STRING_CHARACTER: ~["\'","\\","\n","\r","\u2028","\u2029"] | "\\" <ESCAPE_SEQUENCE>>
-| <#ESCAPE_SEQUENCE: <CHARACTER_ESCAPE_SEQUENCE> | "0" | <HEX_ESCAPE_SEQUENCE> | <UNICODE_ESCAPE_SEQUENCE>>
-| <#CHARACTER_ESCAPE_SEQUENCE: <SINGLE_ESCAPE_CHARACTER> | <NON_ESCAPE_CHARACTER>>
-| <#SINGLE_ESCAPE_CHARACTER: ["\'","\"","\\","b","f","n","r","t","v"]>
-| <#NON_ESCAPE_CHARACTER: ~["\n","\r","\u2028","\u2029"] | ~["\'","\"","\\","b","f","n","r","t","v","x","u"] | ~["0"-"9"]>
-}
-
-   
-
-
-<DEFAULT> TOKEN : {
-<HEX_ESCAPE_SEQUENCE: "x" <HEX_DIGIT> <HEX_DIGIT>>
-}
-
-   
-
-
-<DEFAULT,IN_REGEX> TOKEN : {
-<CODE_LITERAL: "%{" (~["}"])* "}" ("}" | ~["}","%"] (~["}"])* "}")* "%"> : DEFAULT
-}
-
-   
-
-
-/*
-TOKEN:
-{
-  < ESCAPE_CHARACTER:
-	  ["'" , "\"" , "\\" , "b" , "f" , "n" , "r" , "t" , "v"]
-	| ["0"-"9"]
-	| "x"
-	| "u"
-  >
-}
-*/
-
-/* Section 7.6: Identifiers */
-
-
-<DEFAULT,IN_REGEX> TOKEN : {
-<LABEL_IDENTIFIER: "#" (<IDENTIFIER_PART>)*> : IN_REGEX
-| <IDENTIFIER_NAME: <DOLLAR_SIGN> (<DOLLAR_SIGN> | "*" | "#" | "^") | (<DOLLAR_SIGN> | <AT_SIGN>)? <IDENTIFIER_START> (<IDENTIFIER_PART>)*> : IN_REGEX
-| <#IDENTIFIER_START: <UNICODE_LETTER> | <UNDER_SCORE> | <UNICODE_ESCAPE_SEQUENCE>>
-| <#IDENTIFIER_PART: <IDENTIFIER_START> | <UNICODE_COMBINING_MARK> | <UNICODE_DIGIT> | <UNICODE_CONNECTOR_PUNCTUATION> | <UNICODE_ESCAPE_SEQUENCE>>
-| <#DOLLAR_SIGN: "$">
-| <#AT_SIGN: "@">
-| <#UNDER_SCORE: "_">
-| <#UNICODE_LETTER: ["A"-"Z"] | ["a"-"z"] | ["A"-"Z"] | ["a"-"z"] | ["\u00aa"] | ["\u00b5"] | ["\u00ba"] | ["\u00c0"-"\u00d6"] | ["\u00d8"-"\u00f6"] | ["\u00f8"-"\u021f"] | ["\u0222"-"\u0233"] | ["\u0250"-"\u02ad"] | ["\u02b0"-"\u02b8"] | ["\u02bb"-"\u02c1"] | ["\u02d0"-"\u02d1"] | ["\u02e0"-"\u02e4"] | ["\u02ee"] | ["\u037a"] | ["\u0386"] | ["\u0388"-"\u038a"] | ["\u038c"] | ["\u038e"-"\u03a1"] | ["\u03a3"-"\u03ce"] | ["\u03d0"-"\u03d7"] | ["\u03da"-"\u03f3"] | ["\u0400"-"\u0481"] | ["\u048c"-"\u04c4"] | ["\u04c7"-"\u04c8"] | ["\u04cb"-"\u04cc"] | ["\u04d0"-"\u04f5"] | ["\u04f8"-"\u04f9"] | ["\u0531"-"\u0556"] | ["\u0559"] | ["\u0561"-"\u0587"] | ["\u05d0"-"\u05ea"] | ["\u05f0"-"\u05f2"] | ["\u0621"-"\u063a"] | ["\u0640"-"\u064a"] | ["\u0671"-"\u06d3"] | ["\u06d5"] | ["\u06e5"-"\u06e6"] | ["\u06fa"-"\u06fc"] | ["\u0710"] | ["\u0712"-"\u072c"] | ["\u0780"-"\u07a5"] | ["\u0905"-"\u0939"] | ["\u093d"] | ["\u0950"] | ["\u0958"-"\u0961"] | ["\u0985"-"\u098c"] | ["\u098f"-"\u0990"] | ["\u0993"-"\u09a8"] | ["\u09aa"-"\u09b0"] | ["\u09b2"] | ["\u09b6"-"\u09b9"] | ["\u09dc"-"\u09dd"] | ["\u09df"-"\u09e1"] | ["\u09f0"-"\u09f1"] | ["\u0a05"-"\u0a0a"] | ["\u0a0f"-"\u0a10"] | ["\u0a13"-"\u0a28"] | ["\u0a2a"-"\u0a30"] | ["\u0a32"-"\u0a33"] | ["\u0a35"-"\u0a36"] | ["\u0a38"-"\u0a39"] | ["\u0a59"-"\u0a5c"] | ["\u0a5e"] | ["\u0a72"-"\u0a74"] | ["\u0a85"-"\u0a8b"] | ["\u0a8d"] | ["\u0a8f"-"\u0a91"] | ["\u0a93"-"\u0aa8"] | ["\u0aaa"-"\u0ab0"] | ["\u0ab2"-"\u0ab3"] | ["\u0ab5"-"\u0ab9"] | ["\u0abd"] | ["\u0ad0"] | ["\u0ae0"] | ["\u0b05"-"\u0b0c"] | ["\u0b0f"-"\u0b10"] | ["\u0b13"-"\u0b28"] | ["\u0b2a"-"\u0b30"] | ["\u0b32"-"\u0b33"] | ["\u0b36"-"\u0b39"] | ["\u0b3d"] | ["\u0b5c"-"\u0b5d"] | ["\u0b5f"-"\u0b61"] | ["\u0b85"-"\u0b8a"] | ["\u0b8e"-"\u0b90"] | ["\u0b92"-"\u0b95"] | ["\u0b99"-"\u0b9a"] | ["\u0b9c"] | ["\u0b9e"-"\u0b9f"] | ["\u0ba3"-"\u0ba4"] | ["\u0ba8"-"\u0baa"] | ["\u0bae"-"\u0bb5"] | ["\u0bb7"-"\u0bb9"] | ["\u0c05"-"\u0c0c"] | ["\u0c0e"-"\u0c10"] | ["\u0c12"-"\u0c28"] | ["\u0c2a"-"\u0c33"] | ["\u0c35"-"\u0c39"] | ["\u0c60"-"\u0c61"] | ["\u0c85"-"\u0c8c"] | ["\u0c8e"-"\u0c90"] | ["\u0c92"-"\u0ca8"] | ["\u0caa"-"\u0cb3"] | ["\u0cb5"-"\u0cb9"] | ["\u0cde"] | ["\u0ce0"-"\u0ce1"] | ["\u0d05"-"\u0d0c"] | ["\u0d0e"-"\u0d10"] | ["\u0d12"-"\u0d28"] | ["\u0d2a"-"\u0d39"] | ["\u0d60"-"\u0d61"] | ["\u0d85"-"\u0d96"] | ["\u0d9a"-"\u0db1"] | ["\u0db3"-"\u0dbb"] | ["\u0dbd"] | ["\u0dc0"-"\u0dc6"] | ["\u0e01"-"\u0e30"] | ["\u0e32"-"\u0e33"] | ["\u0e40"-"\u0e46"] | ["\u0e81"-"\u0e82"] | ["\u0e84"] | ["\u0e87"-"\u0e88"] | ["\u0e8a"] | ["\u0e8d"] | ["\u0e94"-"\u0e97"] | ["\u0e99"-"\u0e9f"] | ["\u0ea1"-"\u0ea3"] | ["\u0ea5"] | ["\u0ea7"] | ["\u0eaa"-"\u0eab"] | ["\u0ead"-"\u0eb0"] | ["\u0eb2"-"\u0eb3"] | ["\u0ebd"-"\u0ec4"] | ["\u0ec6"] | ["\u0edc"-"\u0edd"] | ["\u0f00"] | ["\u0f40"-"\u0f6a"] | ["\u0f88"-"\u0f8b"] | ["\u1000"-"\u1021"] | ["\u1023"-"\u1027"] | ["\u1029"-"\u102a"] | ["\u1050"-"\u1055"] | ["\u10a0"-"\u10c5"] | ["\u10d0"-"\u10f6"] | ["\u1100"-"\u1159"] | ["\u115f"-"\u11a2"] | ["\u11a8"-"\u11f9"] | ["\u1200"-"\u1206"] | ["\u1208"-"\u1246"] | ["\u1248"] | ["\u124a"-"\u124d"] | ["\u1250"-"\u1256"] | ["\u1258"] | ["\u125a"-"\u125d"] | ["\u1260"-"\u1286"] | ["\u1288"] | ["\u128a"-"\u128d"] | ["\u1290"-"\u12ae"] | ["\u12b0"] | ["\u12b2"-"\u12b5"] | ["\u12b8"-"\u12be"] | ["\u12c0"] | ["\u12c2"-"\u12c5"] | ["\u12c8"-"\u12ce"] | ["\u12d0"-"\u12d6"] | ["\u12d8"-"\u12ee"] | ["\u12f0"-"\u130e"] | ["\u1310"] | ["\u1312"-"\u1315"] | ["\u1318"-"\u131e"] | ["\u1320"-"\u1346"] | ["\u1348"-"\u135a"] | ["\u13a0"-"\u13b0"] | ["\u13b1"-"\u13f4"] | ["\u1401"-"\u1676"] | ["\u1681"-"\u169a"] | ["\u16a0"-"\u16ea"] | ["\u1780"-"\u17b3"] | ["\u1820"-"\u1877"] | ["\u1880"-"\u18a8"] | ["\u1e00"-"\u1e9b"] | ["\u1ea0"-"\u1ee0"] | ["\u1ee1"-"\u1ef9"] | ["\u1f00"-"\u1f15"] | ["\u1f18"-"\u1f1d"] | ["\u1f20"-"\u1f39"] | ["\u1f3a"-"\u1f45"] | ["\u1f48"-"\u1f4d"] | ["\u1f50"-"\u1f57"] | ["\u1f59"] | ["\u1f5b"] | ["\u1f5d"] | ["\u1f5f"-"\u1f7d"] | ["\u1f80"-"\u1fb4"] | ["\u1fb6"-"\u1fbc"] | ["\u1fbe"] | ["\u1fc2"-"\u1fc4"] | ["\u1fc6"-"\u1fcc"] | ["\u1fd0"-"\u1fd3"] | ["\u1fd6"-"\u1fdb"] | ["\u1fe0"-"\u1fec"] | ["\u1ff2"-"\u1ff4"] | ["\u1ff6"-"\u1ffc"] | ["\u207f"] | ["\u2102"] | ["\u2107"] | ["\u210a"-"\u2113"] | ["\u2115"] | ["\u2119"-"\u211d"] | ["\u2124"] | ["\u2126"] | ["\u2128"] | ["\u212a"-"\u212d"] | ["\u212f"-"\u2131"] | ["\u2133"-"\u2139"] | ["\u2160"-"\u2183"] | ["\u3005"-"\u3007"] | ["\u3021"-"\u3029"] | ["\u3031"-"\u3035"] | ["\u3038"-"\u303a"] | ["\u3041"-"\u3094"] | ["\u309d"-"\u309e"] | ["\u30a1"-"\u30fa"] | ["\u30fc"-"\u30fe"] | ["\u3105"-"\u312c"] | ["\u3131"-"\u318e"] | ["\u31a0"-"\u31b7"] | ["\u3400"] | ["\u4db5"] | ["\u4e00"] | ["\u9fa5"] | ["\ua000"-"\ua48c"] | ["\uac00"] | ["\ud7a3"] | ["\uf900"-"\ufa2d"] | ["\ufb00"-"\ufb06"] | ["\ufb13"-"\ufb17"] | ["\ufb1d"] | ["\ufb1f"-"\ufb28"] | ["\ufb2a"-"\ufb36"] | ["\ufb38"-"\ufb3c"] | ["\ufb3e"] | ["\ufb40"-"\ufb41"] | ["\ufb43"-"\ufb44"] | ["\ufb46"-"\ufbb1"] | ["\ufbd3"-"\ufd3d"] | ["\ufd50"-"\ufd8f"] | ["\ufd92"-"\ufdc7"] | ["\ufdf0"-"\ufdfb"] | ["\ufe70"-"\ufe72"] | ["\ufe74"] | ["\ufe76"-"\ufefc"] | ["\uff21"-"\uff3a"] | ["\uff41"-"\uff5a"] | ["\uff66"-"\uffbe"] | ["\uffc2"-"\uffc7"] | ["\uffca"-"\uffcf"] | ["\uffd2"-"\uffd7"] | ["\uffda"-"\uffdc"]>
-}
-
-   
-
-
-/*
- * Unicode categories Non-spacing mark (MN) OR Combining spacing mark (MC)
- */
-
-
-<DEFAULT> MORE : {
-<UNICODE_COMBINING_MARK: <MN> | <MC>>
-}
-
-   
-
-
-<DEFAULT> TOKEN : {
-<MC: ["\u0903"] | ["\u093e"] | ["\u093f"] | ["\u0940"] | ["\u0949"] | ["\u094a"] | ["\u094b"] | ["\u094c"] | ["\u0982"] | ["\u0983"] | ["\u09be"] | ["\u09bf"] | ["\u09c0"] | ["\u09c7"] | ["\u09c8"] | ["\u09cb"] | ["\u09cc"] | ["\u09d7"] | ["\u0a03"] | ["\u0a3e"] | ["\u0a3f"] | ["\u0a40"] | ["\u0a83"] | ["\u0abe"] | ["\u0abf"] | ["\u0ac0"] | ["\u0ac9"] | ["\u0acb"] | ["\u0acc"] | ["\u0b02"] | ["\u0b03"] | ["\u0b3e"] | ["\u0b40"] | ["\u0b47"] | ["\u0b48"] | ["\u0b4b"] | ["\u0b4c"] | ["\u0b57"] | ["\u0bbe"] | ["\u0bbf"] | ["\u0bc1"] | ["\u0bc2"] | ["\u0bc6"] | ["\u0bc7"] | ["\u0bc8"] | ["\u0bca"] | ["\u0bcb"] | ["\u0bcc"] | ["\u0bd7"] | ["\u0c01"] | ["\u0c02"] | ["\u0c03"] | ["\u0c41"] | ["\u0c42"] | ["\u0c43"] | ["\u0c44"] | ["\u0c82"] | ["\u0c83"] | ["\u0cbe"] | ["\u0cc0"] | ["\u0cc1"] | ["\u0cc2"] | ["\u0cc3"] | ["\u0cc4"] | ["\u0cc7"] | ["\u0cc8"] | ["\u0cca"] | ["\u0ccb"] | ["\u0cd5"] | ["\u0cd6"] | ["\u0d02"] | ["\u0d03"] | ["\u0d3e"] | ["\u0d3f"] | ["\u0d40"] | ["\u0d46"] | ["\u0d47"] | ["\u0d48"] | ["\u0d4a"] | ["\u0d4b"] | ["\u0d4c"] | ["\u0d57"] | ["\u0d82"] | ["\u0d83"] | ["\u0dcf"] | ["\u0dd0"] | ["\u0dd1"] | ["\u0dd8"] | ["\u0dd9"] | ["\u0dda"] | ["\u0ddb"] | ["\u0ddc"] | ["\u0ddd"] | ["\u0dde"] | ["\u0ddf"] | ["\u0df2"] | ["\u0df3"] | ["\u0f3e"] | ["\u0f3f"] | ["\u0f7f"] | ["\u102c"] | ["\u1031"] | ["\u1038"] | ["\u1056"] | ["\u1057"] | ["\u17b6"] | ["\u17be"] | ["\u17bf"] | ["\u17c0"] | ["\u17c1"] | ["\u17c2"] | ["\u17c3"] | ["\u17c4"] | ["\u17c5"] | ["\u17c7"] | ["\u17c8"] | ["\u1923"] | ["\u1924"] | ["\u1925"] | ["\u1926"] | ["\u1929"] | ["\u192a"] | ["\u192b"] | ["\u1930"] | ["\u1931"] | ["\u1933"] | ["\u1934"] | ["\u1935"] | ["\u1936"] | ["\u1937"] | ["\u1938"] | ["\u19b0"] | ["\u19b1"] | ["\u19b2"] | ["\u19b3"] | ["\u19b4"] | ["\u19b5"] | ["\u19b6"] | ["\u19b7"] | ["\u19b8"] | ["\u19b9"] | ["\u19ba"] | ["\u19bb"] | ["\u19bc"] | ["\u19bd"] | ["\u19be"] | ["\u19bf"] | ["\u19c0"] | ["\u19c8"] | ["\u19c9"] | ["\u1a19"] | ["\u1a1a"] | ["\u1a1b"] | ["\ua802"] | ["\ua823"] | ["\ua824"] | ["\ua827"] | ["\u1d16"] | ["\u1d16"] | ["\u1d16"] | ["\u1d16"] | ["\u1d16"] | ["\u1d17"] | ["\u1d17"] | ["\u1d17"]>
-| <MN: ["\u0300"-"\u034e"] | ["\u0360"-"\u0362"] | ["\u0483"-"\u0486"] | ["\u0591"-"\u05a1"] | ["\u05a3"-"\u05b9"] | ["\u05bb"-"\u05bd"] | ["\u05bf"] | ["\u05c1"-"\u05c2"] | ["\u05c4"] | ["\u064b"-"\u0655"] | ["\u0670"] | ["\u06d6"-"\u06dc"] | ["\u06df"-"\u06e4"] | ["\u06e7"-"\u06e8"] | ["\u06ea"-"\u06ed"] | ["\u0711"] | ["\u0730"-"\u074a"] | ["\u07a6"-"\u07b0"] | ["\u0901"-"\u0903"] | ["\u093c"] | ["\u093e"-"\u094d"] | ["\u0951"-"\u0954"] | ["\u0962"-"\u0963"] | ["\u0981"-"\u0983"] | ["\u09bc"-"\u09c4"] | ["\u09c7"-"\u09c8"] | ["\u09cb"-"\u09cd"] | ["\u09d7"] | ["\u09e2"-"\u09e3"] | ["\u0a02"] | ["\u0a3c"] | ["\u0a3e"-"\u0a42"] | ["\u0a47"-"\u0a48"] | ["\u0a4b"-"\u0a4d"] | ["\u0a70"-"\u0a71"] | ["\u0a81"-"\u0a83"] | ["\u0abc"] | ["\u0abe"-"\u0ac5"] | ["\u0ac7"-"\u0ac9"] | ["\u0acb"-"\u0acd"] | ["\u0b01"-"\u0b03"] | ["\u0b3c"] | ["\u0b3e"-"\u0b43"] | ["\u0b47"-"\u0b48"] | ["\u0b4b"-"\u0b4d"] | ["\u0b56"-"\u0b57"] | ["\u0b82"-"\u0b83"] | ["\u0bbe"-"\u0bc2"] | ["\u0bc6"-"\u0bc8"] | ["\u0bca"-"\u0bcd"] | ["\u0bd7"] | ["\u0c01"-"\u0c03"] | ["\u0c3e"-"\u0c44"] | ["\u0c46"-"\u0c48"] | ["\u0c4a"-"\u0c4d"] | ["\u0c55"-"\u0c56"] | ["\u0c82"-"\u0c83"] | ["\u0cbe"-"\u0cc4"] | ["\u0cc6"-"\u0cc8"] | ["\u0cca"-"\u0ccd"] | ["\u0cd5"-"\u0cd6"] | ["\u0d02"-"\u0d03"] | ["\u0d3e"-"\u0d43"] | ["\u0d46"-"\u0d48"] | ["\u0d4a"-"\u0d4d"] | ["\u0d57"] | ["\u0d82"-"\u0d83"] | ["\u0dca"] | ["\u0dcf"-"\u0dd4"] | ["\u0dd6"] | ["\u0dd8"-"\u0ddf"] | ["\u0df2"-"\u0df3"] | ["\u0e31"] | ["\u0e34"-"\u0e3a"] | ["\u0e47"-"\u0e4e"] | ["\u0eb1"] | ["\u0eb4"-"\u0eb9"] | ["\u0ebb"-"\u0ebc"] | ["\u0ec8"-"\u0ecd"] | ["\u0f18"-"\u0f19"] | ["\u0f35"] | ["\u0f37"] | ["\u0f39"] | ["\u0f3e"-"\u0f3f"] | ["\u0f71"-"\u0f84"] | ["\u0f86"-"\u0f87"] | ["\u0f90"-"\u0f97"] | ["\u0f99"-"\u0fbc"] | ["\u0fc6"] | ["\u102c"-"\u1032"] | ["\u1036"-"\u1039"] | ["\u1056"-"\u1059"] | ["\u17b4"-"\u17d3"] | ["\u18a9"] | ["\u20d0"-"\u20dc"] | ["\u20e1"] | ["\u302a"-"\u302f"] | ["\u3099"-"\u309a"] | ["\ufb1e"] | ["\ufe20"-"\ufe23"]>
-}
-
-   
-
-
-<DEFAULT> TOKEN : {
-<UNICODE_DIGIT: ["0"-"9"] | ["\u0660"-"\u0669"] | ["\u06f0"-"\u06f9"] | ["\u0966"-"\u096f"] | ["\u09e6"-"\u09ef"] | ["\u0a66"-"\u0a6f"] | ["\u0ae6"-"\u0aef"] | ["\u0b66"-"\u0b6f"] | ["\u0be7"-"\u0bef"] | ["\u0c66"-"\u0c6f"] | ["\u0ce6"-"\u0cef"] | ["\u0d66"-"\u0d6f"] | ["\u0e50"-"\u0e59"] | ["\u0ed0"-"\u0ed9"] | ["\u0f20"-"\u0f29"] | ["\u1040"-"\u1049"] | ["\u1369"-"\u1371"] | ["\u17e0"-"\u17e9"] | ["\u1810"-"\u1819"] | ["\uff10"-"\uff19"]>
-}
-
-   
-
-
-<DEFAULT> TOKEN : {
-<UNICODE_CONNECTOR_PUNCTUATION: ["_"] | ["\u203f"-"\u2040"] | ["\u30fb"] | ["\ufe33"-"\ufe34"] | ["\ufe4d"-"\ufe4f"] | ["\uff3f"] | ["\uff65"]>
-}
-
-   
-
-
-<DEFAULT> TOKEN : {
-<UNICODE_ESCAPE_SEQUENCE: "u" <HEX_DIGIT> <HEX_DIGIT> <HEX_DIGIT> <HEX_DIGIT>>
-}
-
-   
-
-
-<DEFAULT> TOKEN : {
-<HEX_DIGIT: ["0"-"9"] | ["a"-"f"] | ["A"-"F"]>
-}
-
-   
-
-
-<IN_REGEX> TOKEN : {
-<SLASHASSIGN: "/="> : DEFAULT
-| <SLASH: "/"> : DEFAULT
-}
-
-   
-
-
-/************************** LARA TOKENS *************************************
-
-TOKEN : /* JP IDENTIFIERS *
-{
-  < JPVAR: "$" ( | )>  :DEFAULT |
-  < #IN_JPVAR:  |  | < END > |  |  |  |  |  >
-}
- /************************** LARA TOKENS *************************************/
-
-/* Section 7.8.5: Regular Expression Literals */
-
-
-<DEFAULT> TOKEN : {
-<REGULAR_EXPRESSION_LITERAL: "/" (~["\n","\r","\\","/","*"] | <BACKSLASH_SEQUENCE>) (~["\n","\r","\\","/"] | <BACKSLASH_SEQUENCE>)* "/" (<IDENTIFIER_PART>)*> : IN_REGEX
-| <#BACKSLASH_SEQUENCE: "\\" ~["\n","\r"]>
-}
-
-   
-
-

NON-TERMINALS

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-/** Get the join point Identifier
-	 * Function that returns the join point identifier, which can any identifier or one of the following reserved words
-	 **/
-
getNoReservedIdentifier::=( <IDENTIFIER_NAME> | <CALL> | <BEGIN> | <END> | <FUNCTION> | <VAR> | <RETURN> | <IF> | <ELSE> | <TO> | <IN> | <INPUT> | <OUTPUT> | <CONDITION> | <_DEFAULT> | <CLASS> )
noReservedIdentifier::=( <IDENTIFIER_NAME> | <CALL> | <BEGIN> | <END> | <FUNCTION> | <VAR> | <RETURN> | <IF> | <ELSE> | <TO> | <IN> | <INPUT> | <OUTPUT> | <CONDITION> | <_DEFAULT> | <CLASS> )
-
-/*****************************************
- * ECMA SYNTACTIC GRAMMARS  STARTS HERE  *
- *****************************************/
-
-/*******************************************************************************
- ************************    LARA SYNTACTIC GRAMMAR    ************************* 
- *******************************************************************************/
-
-        /** LARA Start
-	 * A LARA file can contain zero or more includes and imports, followed by definitions of aspectdefs, codedefs, functions and global variables
-	 **/
-
Start::=( <UTF8_BOM> )? ( Import )* ( AspectDef | CodeDef )* <EOF>
-
-/** Import
-	 * Imports the path to a file that is not in the same path of the invoked LARA file.
-	 * With one import it is possible to import one or every file within a package
-	 **/
-
Import::=<IMPORT> FilePath EndStatement
-
-/** FilePath
-	* gets the path to a file or all the files in the package 
-	**/
-
FilePath::=( Identifier <DOT> )* ( <IDENTIFIER_NAME> | <STAR> )
-
-/** FilePathNoSTar
-	* gets the path to a file in a package
-	**/
-
FilePathNoSTar::=( Identifier <DOT> )+
-
-/** Code Definition
-	 * A parcel of native code or LARA-Code to be used by the insert/output action. To define the target language, one has to define the type of the codedef, such as: codedef, this means that the code to be inserted is written in C language.
-	 * A code definition needs an identifier and its body is code that can contain a tag such as "" to insert information on the code such as: join point property or a variable value. To use those tags, the codedef must have input arguments to refer those to specific values.
-	 **/
-
CodeDef::=<CODEDEF> ( <LT> <IDENTIFIER_NAME> <GT> )? <IDENTIFIER_NAME> ( ( <LPAREN> FormalParameterList <RPAREN> )? ) <CODE_LITERAL> <END>
-
-/** Input arguments
-	 * The arguments to be defined when a "aspect-call" action is stated.
-	 * They can be normal variables or variables referent to a specific join point. The normal variables can have a default value
-	 **/
-
Input::=<INPUT> VariableDeclarationList ( <SEMICOLON> )? <END>
-
-/** Output arguments
-	 * List of normal variables or variables referent to a specific join point. The normal variables can have a default value
-	 **/
-
Output::=<OUTPUT> VariableDeclarationList ( <SEMICOLON> )? <END>
-
-/** Static
-	 * List of static variables and functions, which can be accessed statically in the aspect. The variables values are shared
-	 * between all aspect instances
-	 **/
-
Static::=<STATICDECL> ( VariableStatement | FunctionDeclaration )* <END>
-
-/** Initialize
-	 * Similar to a constructor. A block of JavaScript code to initialize variables, inter alia
-	 **/
-
Initialize::=<INITIALIZE> JavaScript <END>
-
-/** Finalize
-	 * Similar to a destructor. A block of JavaScript code to finalize output variables, inter alia
-	 **/
-
Finalize::=<FINALIZE> JavaScript <END>
-
-/** Check
-	 * Set of conditions to verify input arguments and other important stats that specify if the aspect can be executed
-	 **/
-
Check::=<CHECK> ( LogicalORExpression EndStatement )* <END>
-
-/** Aspect Definition
-	 * The aspect definition can contain outputs and inputs variables, a check to verify those variables, an initializer and a finalizer to deal with information to be handler before and after the aspect, respectively.
-	 * The body of the aspect consists of selects, applies and conditions to apply the aspect in the target program, and afters, befores, function and variable declaration to assist the apply and condition section.
-	 */
-
AspectDef::=<ASPECTDEF> <IDENTIFIER_NAME> ( Input | Output | Static )* ( Initialize )? ( Check )? ( ( Select | Apply | AroundApply | Condition | SourceElement ) )* ( Finalize )? <END>
-
-/** Select
-	 * Pointcut expression to specify which join points are intended to influence.
-	 * It can contain an unique label, so it can be advised, and a pointcut expression
-	 */
-
Select::=( <IDENTIFIER_NAME> <COLON> )? <SELECT> ( Pointcut | FourthSetOp ) <END>
FourthSetOp::=ThirdSetOp ( <PLUS> FourthSetOp )?
ThirdSetOp::=FirstSetOp ( ( <NATURAL_JOIN> | <BIT_AND> ) ThirdSetOp )?
FirstSetOp::=Identifier
|( <LPAREN> FourthSetOp <RPAREN> )
-
-/** Pointcut
-	 * It can contain an identifier for the join point, a join point identifier and a possible property expression. 
-	 * Each join point can have a child, the join point down to its hierarchy
-	 */
-
Pointcut::=( getNoReservedIdentifier | <LPAREN> <IDENTIFIER_NAME> <ASSIGN> getNoReservedIdentifier <RPAREN> ) ( PointcutFilters )? ( <DOT> Pointcut )?
-
-/** Pointcut  properties
-	 * The properties of a pointcut can be declared in three different ways:
-		- it can be any property (*)
-		- a set of properties that will be mapped to the default attribute
-		- a property expression
-	 */
-
PointcutFilters::=<LBRACE> ( <STAR> | ( ( OrFiltersExpr ) | ( ( ConditionalExpression ( <COMMA> ConditionalExpression )* ) ) ) ) <RBRACE>
-
-/** "OR" Property Expr
-	 * In the pointcut properties declaration, the comma is used as an OR operator (similar to ||)
-	 **/
-
OrFiltersExpr::=( ANDFiltersExpr ( <COMMA> ANDFiltersExpr )* )
-
-/** "AND" Property Expression
-	 * To combine properties such as an AND operation, the properties are declared inside brackets, converting the comma (which is the OR operator) into an AND.
-	 */
-
ANDFiltersExpr::=Filter
|<LPAREN> ( Filter ( <COMMA> Filter )* ) <RPAREN>
-
-/** Property
-	 * The property is defined by comparing a join point attribute to a value
-	 **/
-
Filter::=<IDENTIFIER_NAME> ( EqualityOperator | RelationalOperator ) ConditionalExpression
-
-/** Around
-	 * A Statement to occur around an apply
-	 * It contains a list of applies that this statement refers to. The body of this statement is JavaScript, and can be used to prepare information for the applies.
-	 **/
-
AroundApply::=( <IDENTIFIER_NAME> <COLON> )? ( <BEFORE> | <AFTER> ) ( ( Identifier ( ( <COMMA> Identifier )* ) ) )? <DO> JavaScript <END>
-
-/** Apply
-	 * Old Version of apply, only static weaving
-	 * Advice each join point of the related select(s).
-	 * It can contain an unique label and a list of selects to be advised by the apply. If no select is inserted, the last select with no label will be used.
-	 * The body contains JavaScript, in which the actions can be declared
-	 **
-	void Apply() #Apply:
-	{Token name, apply, end;}
-	{
-	  [name={jjtThis.setName(name.image);} ] apply= [To()]
-	  		JavaScript()
-	  end=
-	  { jjtThis.setCoord(apply,end);}
-	}
-	/**/
-
-        /** Apply (Static/Dynamic)
-	 * The new version of the Apply statement: static or dynamic weaving
-	 * Advice each join point of the related select(s).
-	 * It can contain an unique label and a list of selects to be advised by the apply. If no select is inserted, the last select with no label will be used.
-	 * The body contains JavaScript, in which the actions can be declared
-	 **/
-
Apply::=( <IDENTIFIER_NAME> <COLON> )? <APPLY> ( <DYNAMIC> ( <PARALLEL> | <SEQUENCIAL> )? ( <BEFORE> | <AFTER> | <REPLACE> )? )? ( To )? JavaScript <END>
-
-/** To
-	 * list of selects that will be influenced by the apply
-	 **/
-
To::=<TO> FourthSetOp ( <COMMA> FourthSetOp )*
SimpleAction::=( Insert | Define | Perform | OutputAct ) EndStatement
-
-/** Action
-	 * Actions that can be used to influence the join points.
-	 * A join point variable can be used to specify the targeted join point where the action takes place 
-	 **/
-
Action::=( ( ( <IDENTIFIER_NAME> ) ) ( MemberExpressionPart )* <DOT> ) ( Insert | Define | Perform | OutputAct ) EndStatement
-
-/** Call
-	 * Action to invoke an aspect.
-	 * The aspect is called with the input arguments that requires and the call instance can have a reference variable to be used to recover information from the invoked aspect.
-	 **/
-
Call::=<CALL> ( LeftHandSideExpression <COLON> )? ( FilePathNoSTar )? <IDENTIFIER_NAME> ( Arguments )? EndStatement
-
-/** Run
-	 * Execution of an external tool.
-	 **/
-
Run::=<RUN> ( LeftHandSideExpression <COLON> )? ( getNoReservedIdentifier )? Arguments ( <GT> AssignmentExpression )? EndStatement
-
-/** Command
-	 * Execution of a command.
-	 **/
-
Cmd::=( <CMD> | <RUN> <CMD> ) ( LeftHandSideExpression <COLON> )? Arguments ( <GT> AssignmentExpression )? EndStatement
-
-/** OLD CALL **
-	void Call() #Call:
-	{Token aspVarName,aspName,ref, end;}
-	{
-	    [LOOKAHEAD( )
-	   					aspVarName=
-	   							{jjtThis.setAspVarName(aspVarName.image);}]
-   			  [LOOKAHEAD(2)FilePathNoSTar()]aspName=
-		{jjtThis.setAspName(aspName.image);}
-	    	[LOOKAHEAD(Arguments())Arguments()] end=
-	   { jjtThis.setCoord(aspName,end);}
-	}
-	/***/
-
-        /** Insert
-	 * The insertion of code is made by indicating a codedefinition's identifier with the required arguments or writing the desired code, with the possibility of using LARA-code to be defined into the target language, such as insert before %{�}%.
-	 * It is also needed to say if the code is inserted before, after or around the pointcut.
-	 **/
-
Insert::=<INSERT> ( ( ( <LT> <IDENTIFIER_NAME> <GT> )? ( <BEFORE> | <AFTER> | <AROUND> | <REPLACE> ) ( TemplateLiteral | ( ( Identifier ( Arguments )? ) ) ) ) | ( Arguments ) )
-
-/** Perform
-	 * Perform an action over the join point
-	 **/
-
Perform::=<EXEC> getNoReservedIdentifier ( Arguments )?
-
-/** Output
-	 * Similar to Insert, however it is used to output in runtime
-	 **/
-
OutputAct::=<OUTPUT_ACT> ( ( TemplateLiteral | ( ( Identifier ( Arguments )? ) ) ) | Arguments )
-
-/** Define
-	 *  Assign a value to a join point attribute
-	 **/
-
Define::=<DEFINE> ( noReservedIdentifier <ASSIGN> AssignmentExpression | Arguments )
-
-/** Condition
-	 *  Boolean expression that verifies if the apply can take place in a join point
-	 **/
-
Condition::=( <IDENTIFIER_NAME> <COLON> )? <CONDITION> ( <FOR> ( Identifier ( <COMMA> Identifier )* ) )? LogicalORExpression <END>
-
-/*******************************************************************************
- **********************   END OF LARA SYNTACTIC GRAMMAR    ********************* 
- *******************************************************************************/
-
-        /* The following part of the grammar is the EcmaScript grammar created by The Dojo Foundation (2004-2005), and it was partially updated to conform to the requirements of LARA grammar, such as the use of actions and join point variables.
-	**/
-
-        /* Section 11.1: Primary Expressions */
-
PrimaryExpression::="this"
|ObjectLiteral
|ArrayLiteral
|( "(" Expression ")" )
|Identifier
|Literal
-
-/* Section 7.8: Literals */
-
Literal::=( <DECIMAL_LITERAL> | <HEX_INTEGER_LITERAL> | <STRING_LITERAL> | <BOOLEAN_LITERAL> | <NULL_LITERAL> | <REGULAR_EXPRESSION_LITERAL> | <CODE_LITERAL> )
TemplateLiteral::=( <STRING_LITERAL> | <CODE_LITERAL> )
Identifier::=<IDENTIFIER_NAME>
LabelIdentifier::=( <LABEL_IDENTIFIER> | <IDENTIFIER_NAME> )
-
-/* Section 11.1.4: Array Initialiser */
-
ArrayLiteral::="[" ( ( ElisionFirst )? ( ElementList Elision "]" | ( ElementList )? "]" ) )
ElementList::=AssignmentExpression ( Elision AssignmentExpression )*
Elision::=( "," ) ( ( "," )+ )?
ElisionFirst::=( "," ) ( ( "," )+ )?
-
-/* Section 11.1.5: Object Initialiser */
-
ObjectLiteral::=<LBRACE> ( PropertyNameAndValueList )? <RBRACE>
PropertyNameAndValueList::=PropertyNameAndValue ( "," PropertyNameAndValue | "," )*
PropertyNameAndValue::=PropertyName ":" AssignmentExpression
PropertyName::=noReservedIdentifier
|Literal
-
-/* Section 11.2: Left-Hand-Side Expressions */
-
MemberExpression::=( ( FunctionExpression | PrimaryExpression ) ( MemberExpressionPart )* )
|AllocationExpression
MemberExpressionForIn::=( ( FunctionExpression | PrimaryExpression ) ( MemberExpressionPart )* )
AllocationExpression::=( "new" MemberExpression ( ( Arguments ( MemberExpressionPart )* )* ) )
MemberExpressionPart::=( ( "[" Expression "]" ) | ( <LBRACE> Expression <RBRACE> ) )
|( "." ( noReservedIdentifier ) )
CallExpression::=MemberExpression Arguments ( CallExpressionPart )*
CallExpressionForIn::=MemberExpressionForIn Arguments ( CallExpressionPart )*
CallExpressionPart::=Arguments
|( "[" Expression "]" )
|( "." noReservedIdentifier )
Arguments::="(" ( ( NamedArgumentList ) | ArgumentList )? ")"
NamedArgumentList::=NamedArgument ( <COMMA> NamedArgument )*
NamedArgument::=getNoReservedIdentifier <COLON> AssignmentExpression
ArgumentList::=AssignmentExpression ( "," AssignmentExpression )*
LeftHandSideExpression::=CallExpression
|MemberExpression
LeftHandSideExpressionForIn::=CallExpressionForIn
|MemberExpressionForIn
-
-/* Section 11.3 Postfix Expressions */
-
PostfixExpression::=LeftHandSideExpression ( PostfixOperator )?
PostfixOperator::=( "++" | "--" )
-
-/* Section 11.4 Unary Operators */
-
UnaryExpression::=( PostfixExpression | ( UnaryOperator UnaryExpression )+ )
UnaryOperator::=( "delete" | "void" | "typeof" | "++" | "--" | "+" | "-" | "~" | "!" )
-
-/* Section 11.5: Multiplicative Operators */
-
MultiplicativeExpression::=UnaryExpression ( MultiplicativeOperator UnaryExpression )*
MultiplicativeOperator::=( "*" | <SLASH> | "%" )
-
-/* Section 11.6: Additive Operators */
-
AdditiveExpression::=MultiplicativeExpression ( AdditiveOperator MultiplicativeExpression )*
AdditiveOperator::=( "+" | "-" )
-
-/* Section 11.7: Bitwise Shift Operators */
-
ShiftExpression::=AdditiveExpression ( ShiftOperator AdditiveExpression )*
ShiftOperator::=( "<<" | ">>" | ">>>" )
-
-/* Section 11.4: Relational Operators */
-
RelationalExpression::=ShiftExpression ( RelationalOperator ShiftExpression )*
RelationalOperator::=( "<" | ">" | "<=" | ">=" | "instanceof" | "in" )
RelationalExpressionNoIn::=ShiftExpression ( RelationalNoInOperator ShiftExpression )*
RelationalNoInOperator::=( "<" | ">" | "<=" | ">=" | "instanceof" )
-
-/* Section 11.9: Equality Operators */
-
EqualityExpression::=RelationalExpression ( EqualityOperator RelationalExpression )*
EqualityExpressionNoIn::=RelationalExpressionNoIn ( EqualityOperator RelationalExpressionNoIn )*
EqualityOperator::=( "==" | "!=" | "===" | "!==" | <MATCH> )
-
-/* Section 11.10: Binary Bitwise Operators */
-
BitwiseANDExpression::=EqualityExpression ( BitwiseANDOperator EqualityExpression )*
BitwiseANDExpressionNoIn::=EqualityExpressionNoIn ( BitwiseANDOperator EqualityExpressionNoIn )*
BitwiseANDOperator::="&"
BitwiseXORExpression::=BitwiseANDExpression ( BitwiseXOROperator BitwiseANDExpression )*
BitwiseXORExpressionNoIn::=BitwiseANDExpressionNoIn ( BitwiseXOROperator BitwiseANDExpressionNoIn )*
BitwiseXOROperator::="^"
BitwiseORExpression::=BitwiseXORExpression ( BitwiseOROperator BitwiseXORExpression )*
BitwiseORExpressionNoIn::=BitwiseXORExpressionNoIn ( BitwiseOROperator BitwiseXORExpressionNoIn )*
BitwiseOROperator::="|"
-
-/* Section 11.11: Binary Logical Operators */
-
LogicalANDExpression::=BitwiseORExpression ( LogicalANDOperator BitwiseORExpression )*
LogicalANDExpressionNoIn::=BitwiseORExpressionNoIn ( LogicalANDOperator BitwiseORExpressionNoIn )*
LogicalANDOperator::="&&"
LogicalORExpression::=LogicalANDExpression ( LogicalOROperator LogicalANDExpression )*
LogicalORExpressionNoIn::=LogicalANDExpressionNoIn ( LogicalOROperator LogicalANDExpressionNoIn )*
LogicalOROperator::="||"
-
-/* Section 11.12: Conditional Operator */
-
ConditionalExpression::=LogicalORExpression ( "?" AssignmentExpression ":" AssignmentExpression )?
ConditionalExpressionNoIn::=LogicalORExpressionNoIn ( "?" AssignmentExpression ":" AssignmentExpressionNoIn )?
-
-/* Section 11.13: Assignment Operators */
-
AssignmentExpression::=( LeftHandSideExpression AssignmentOperator AssignmentExpression | ConditionalExpression )
AssignmentExpressionNoIn::=( LeftHandSideExpression AssignmentOperator AssignmentExpressionNoIn | ConditionalExpressionNoIn )
AssignmentOperator::=( "=" | "*=" | <SLASHASSIGN> | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" )
-
-/* Section 11.14: Comma Operator */
-
Expression::=AssignmentExpression ( "," AssignmentExpression )*
ExpressionNoIn::=AssignmentExpressionNoIn ( "," AssignmentExpressionNoIn )*
-
-/* Section 12: STATEMENTS */
-
Statement::=BodiedStatement
|SingleStatement
SingleStatement::=( SimpleAction | Action | Call | Cmd | Run | VariableStatement | EmptyStatement | ExpressionStatement | LabelledStatement | ContinueStatement | BreakStatement | ImportStatement | ReturnStatement )
BodiedStatement::=( Block | IfStatement | IterationStatement | SwitchStatement | WithStatement | ThrowStatement | TryStatement )
-
-/* 12.1 Block Statement */
-
Block::=<LBRACE> ( StatementList )? <RBRACE>
StatementList::=( Statement )+
-
-/* Section 12.2: Variable statement */
-
VariableStatement::=<VAR> VariableDeclarationList EndStatement
VariableDeclarationList::=VariableDeclaration ( "," VariableDeclaration )*
VariableDeclarationListNoIn::=VariableDeclarationNoIn ( "," VariableDeclarationNoIn )*
VariableDeclaration::=Identifier ( Initialiser )?
VariableDeclarationNoIn::=Identifier ( InitialiserNoIn )?
Initialiser::="=" AssignmentExpression
InitialiserNoIn::="=" AssignmentExpressionNoIn
-
-/* Section 12.3: Empty Statement */
-
EmptyStatement::=";"
-
-/* Section 12.4: Expression Statement */
-
ExpressionStatement::=Expression EndStatement
-
-/* Section 12.5: The if Statement */
-
IfStatement::="if" "(" Expression ")" Statement ( "else" Statement )?
-
-/* Section 12.6: Iteration Statements */
-
IterationStatement::=DoStatement
|WhileStatement
|ForStatement
DoStatement::=<DO> Statement <WHILE> <LPAREN> Expression <RPAREN> EndStatement
WhileStatement::=<WHILE> <LPAREN> Expression <RPAREN> Statement
ForStatement::=<FOR> ( <EACH> <LPAREN> ( ( "var" VariableDeclarationNoIn <IN> Expression <RPAREN> Statement ) | ( LeftHandSideExpressionForIn <IN> Expression <RPAREN> Statement ) ) | <LPAREN> ( ( ( ExpressionNoIn )? ";" ( Expression )? ";" ( Expression )? ")" Statement ) | ( "var" VariableDeclarationList ";" ( Expression )? ";" ( Expression )? <RPAREN> Statement ) | ( "var" VariableDeclarationNoIn ( <IN> | ( <OF> ) ) Expression <RPAREN> Statement ) | ( LeftHandSideExpressionForIn ( <IN> | ( <OF> ) ) Expression <RPAREN> Statement ) ) )
-
-/* Section 12.7: The continue Statement */
-
ContinueStatement::="continue" ( LabelIdentifier )? EndStatement
-
-/* Section 12.8: The break Statement */
-
BreakStatement::="break" ( LabelIdentifier )? EndStatement
-
-/* Section 12.9 The return Statement */
-
ReturnStatement::="return" ( Expression )? EndStatement
-
-/* Section 12.10: The with Statement */
-
WithStatement::="with" "(" Expression ")" Statement
-
-/* 12.11 The switch Statement */
-
SwitchStatement::="switch" "(" Expression ")" CaseBlock
CaseBlock::=<LBRACE> ( CaseClauses )? ( <RBRACE> | DefaultClause ( CaseClauses )? <RBRACE> )
CaseClauses::=( CaseClause )+
CaseClause::=( ( "case" Expression ":" ) ) ( StatementList )?
DefaultClause::=( ( "default" ":" ) ) ( StatementList )?
-
-/* Section 12.12: Labelled Statements */
-
LabelledStatement::=Identifier ":" Statement
ThrowStatement::="throw" Expression EndStatement
TryStatement::="try" Block ( ( Finally | Catch ( Finally )? ) )
Catch::="catch" "(" Identifier ")" Block
Finally::="finally" Block
-
-/* Section 13: Function Definition */
-
FunctionDeclaration::="function" Identifier ( "(" ( FormalParameterList )? ")" ) FunctionBody
FunctionExpression::="function" ( Identifier )? ( "(" ( FormalParameterList )? ")" ) FunctionBody
FormalParameterList::=( Identifier ) ( "," ( Identifier ) )*
FunctionBody::=<LBRACE> ( SourceElements )? <RBRACE>
-
-/* Section 14: Program *
-
-	ASTProgram Program() #Program :
-	{}
-	{  
-		JavaScript()
-				
-		{ return jjtThis; }
-	}
-	/**/
-
JavaScript::=( SourceElements )?
SourceElements::=( SourceElement )+
SourceElement::=FunctionDeclaration
|Statement
-
-/*
-	 * Grammar for parsing JScript .NET contructs: ( import System; var contents :
-	 * String = reader.ReadToEnd(); ) Refer: src/hostenv_jsc.js
-	 */
-
ImportStatement::="import" Name ( "." "*" )? EndStatement
Name::=<IDENTIFIER_NAME> ( <DOT> <IDENTIFIER_NAME> )*
JScriptVarStatement::=<VAR> JScriptVarDeclarationList EndStatement
JScriptVarDeclarationList::=JScriptVarDeclaration ( <COMMA> JScriptVarDeclaration )*
JScriptVarDeclaration::=Identifier ":" <IDENTIFIER_NAME> ( Initialiser )?
EndStatement::=<SEMICOLON>
error_skipto::=java code
error_noSkip::=java code
- - diff --git a/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScript.java b/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScript.java deleted file mode 100644 index 486b6e925..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScript.java +++ /dev/null @@ -1,14549 +0,0 @@ -/* LARAEcmaScript.java */ -/* Generated By:JJTree&JavaCC: Do not edit this line. LARAEcmaScript.java */ -package org.dojo.jsl.parser.ast; - -import java.io.*; -import java.util.*; -import java.io.File; -import java.io.FileReader; -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import larac.utils.output.ErrorMsg; -import larac.objects.Enums.Types; -import larac.exceptions.ParseExceptionData; -import larac.exceptions.StopParseException; - -public class LARAEcmaScript extends LARAParserBase/*@bgen(jjtree)*/implements LARAEcmaScriptTreeConstants, LARAEcmaScriptConstants {/*@bgen(jjtree)*/ - protected JJTLARAEcmaScriptState jjtree = new JJTLARAEcmaScriptState();private static final int MAX_EXCEPTION_TOKEN_SIZE = 6; - private static final int MAXIMUM_SYNTAX_EXCEPTIONS = 5; - - public File inputAspectFile = null; - public FileReader inputAspectFr = null; - public BufferedReader inputAspectBr = null; - public List exceptions = new ArrayList() ; - private int exprBraceCount = 0; - - public ASTExpressionStatement parseExpression(String expression) throws ParseException{ - return ParseExpression(); - } - - public ASTStart parse() throws ParseException{ - this.exceptions = new ArrayList(); - - return this.Start(); - } - - /* Old Code */ - @Deprecated - public static ASTStart parseFile(String fileName){ - return parseFile(new File(fileName)); - } - @Deprecated - public static ASTStart parseFile(File laraFile){ - ASTStart start = null; - File inputAspectFile = laraFile; - FileReader inputAspectFr = null; - BufferedReader inputAspectBr = null; - try{ - inputAspectFr = new FileReader(inputAspectFile); - inputAspectBr = new BufferedReader(inputAspectFr); - LARAEcmaScript aspectParser = new LARAEcmaScript(inputAspectBr); - start = aspectParser.Start(); - } - catch (Exception e) - { - try { - if(inputAspectFr != null) - inputAspectFr.close(); - if(inputAspectBr != null) - inputAspectBr.close(); - } catch (IOException e1) { - throw new RuntimeException(e1); - } - } - - try { - if(inputAspectFr != null) - inputAspectFr.close(); - if(inputAspectBr != null) - inputAspectBr.close(); - - } catch (IOException e1) { - throw new RuntimeException(e1); - } - return start; - } - -/** Function that returns the join point identifier, which can be any identifier - or one of the following reserved words - **/ - final public Token getNoReservedIdentifier() throws ParseException {Token t; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ - t = jj_consume_token(IDENTIFIER_NAME); - break; - } - case CALL:{ - t = jj_consume_token(CALL); - break; - } - case BEGIN:{ - t = jj_consume_token(BEGIN); - break; - } - case END:{ - t = jj_consume_token(END); - break; - } - case FUNCTION:{ - t = jj_consume_token(FUNCTION); - break; - } - case FUNCTION_GEN:{ - t = jj_consume_token(FUNCTION_GEN); - break; - } - case VAR:{ - t = jj_consume_token(VAR); - break; - } - case RETURN:{ - t = jj_consume_token(RETURN); - break; - } - case YIELD:{ - t = jj_consume_token(YIELD); - break; - } - case IF:{ - t = jj_consume_token(IF); - break; - } - case ELSE:{ - t = jj_consume_token(ELSE); - break; - } - case TO:{ - t = jj_consume_token(TO); - break; - } - case IN:{ - t = jj_consume_token(IN); - break; - } - case SWITCH:{ - t = jj_consume_token(SWITCH); - break; - } - case CASE:{ - t = jj_consume_token(CASE); - break; - } - case INPUT:{ - t = jj_consume_token(INPUT); - break; - } - case OUTPUT:{ - t = jj_consume_token(OUTPUT); - break; - } - case CONDITION:{ - t = jj_consume_token(CONDITION); - break; - } - case _DEFAULT:{ - t = jj_consume_token(_DEFAULT); - break; - } - case CLASS:{ - t = jj_consume_token(CLASS); - break; - } - case INTANCE_OF:{ - t = jj_consume_token(INTANCE_OF); - break; - } - case BEFORE:{ - t = jj_consume_token(BEFORE); - break; - } - case AFTER:{ - t = jj_consume_token(AFTER); - break; - } - case AROUND:{ - t = jj_consume_token(AROUND); - break; - } - case FOR:{ - t = jj_consume_token(FOR); - break; - } - case WHILE:{ - t = jj_consume_token(WHILE); - break; - } - case DO:{ - t = jj_consume_token(DO); - break; - } - case INCLUDE:{ - t = jj_consume_token(INCLUDE); - break; - } - case REPLACE:{ - t = jj_consume_token(REPLACE); - break; - } - case CHECK:{ - t = jj_consume_token(CHECK); - break; - } - case APPLY:{ - t = jj_consume_token(APPLY); - break; - } - default: - jj_la1[0] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -{if ("" != null) return t;} - throw new Error("Missing return statement in function"); -} - - final public void noReservedIdentifier() throws ParseException {/*@bgen(jjtree) Identifier */ - ASTIdentifier jjtn000 = new ASTIdentifier(JJTIDENTIFIER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token t; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ - t = jj_consume_token(IDENTIFIER_NAME); - break; - } - case CALL:{ - t = jj_consume_token(CALL); - break; - } - case BEGIN:{ - t = jj_consume_token(BEGIN); - break; - } - case END:{ - t = jj_consume_token(END); - break; - } - case FUNCTION:{ - t = jj_consume_token(FUNCTION); - break; - } - case FUNCTION_GEN:{ - t = jj_consume_token(FUNCTION_GEN); - break; - } - case VAR:{ - t = jj_consume_token(VAR); - break; - } - case RETURN:{ - t = jj_consume_token(RETURN); - break; - } - case YIELD:{ - t = jj_consume_token(YIELD); - break; - } - case IF:{ - t = jj_consume_token(IF); - break; - } - case ELSE:{ - t = jj_consume_token(ELSE); - break; - } - case TO:{ - t = jj_consume_token(TO); - break; - } - case IN:{ - t = jj_consume_token(IN); - break; - } - case SWITCH:{ - t = jj_consume_token(SWITCH); - break; - } - case CASE:{ - t = jj_consume_token(CASE); - break; - } - case INPUT:{ - t = jj_consume_token(INPUT); - break; - } - case OUTPUT:{ - t = jj_consume_token(OUTPUT); - break; - } - case CONDITION:{ - t = jj_consume_token(CONDITION); - break; - } - case _DEFAULT:{ - t = jj_consume_token(_DEFAULT); - break; - } - case CLASS:{ - t = jj_consume_token(CLASS); - break; - } - case INTANCE_OF:{ - t = jj_consume_token(INTANCE_OF); - break; - } - case BEFORE:{ - t = jj_consume_token(BEFORE); - break; - } - case AFTER:{ - t = jj_consume_token(AFTER); - break; - } - case AROUND:{ - t = jj_consume_token(AROUND); - break; - } - case FOR:{ - t = jj_consume_token(FOR); - break; - } - case WHILE:{ - t = jj_consume_token(WHILE); - break; - } - case DO:{ - t = jj_consume_token(DO); - break; - } - case INCLUDE:{ - t = jj_consume_token(INCLUDE); - break; - } - case DELETE:{ - t = jj_consume_token(DELETE); - break; - } - case REPLACE:{ - t = jj_consume_token(REPLACE); - break; - } - case CHECK:{ - t = jj_consume_token(CHECK); - break; - } - case APPLY:{ - t = jj_consume_token(APPLY); - break; - } - default: - jj_la1[1] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.setName(t.image);jjtn000.jjtSetValue(t.image); - //jjtThis.setCoord(t,t); - - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/***************************************** - * ECMA SYNTACTIC GRAMMARS STARTS HERE * - *****************************************/ - -/******************************************************************************* - ************************ LARA SYNTACTIC GRAMMAR ************************* - *******************************************************************************/ - - /** - * A LARA file can contain zero or more includes and imports, followed by definitions of aspectdefs, - * codedefs, functions and global variables - **/ - final public ASTStart Start() throws ParseException {/*@bgen(jjtree) Start */ - ASTStart jjtn000 = new ASTStart(JJTSTART); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - label_1: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IMPORT:{ - ; - break; - } - default: - jj_la1[2] = jj_gen; - break label_1; - } - Import(); - } - label_2: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ASPECTDEF: - case CODEDEF: - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case VAR: - case LBRACE: - case LPAREN: - case LBRACKET: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - ; - break; - } - default: - jj_la1[3] = jj_gen; - break label_2; - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ASPECTDEF:{ - AspectDef(); - break; - } - case CODEDEF:{ - CodeDef(); - break; - } - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case VAR: - case LBRACE: - case LPAREN: - case LBRACKET: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - Declaration(); - break; - } - default: - jj_la1[4] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - jj_consume_token(0); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -{if ("" != null) return jjtn000;} - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } - throw new Error("Missing return statement in function"); -} - - final public void Declaration() throws ParseException { - if (jj_2_1(2147483647)) { - GeneratorFunctionDeclaration(); - } else if (jj_2_2(2147483647)) { - FunctionDeclaration(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VAR:{ - VariableStatement(); - break; - } - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case LBRACE: - case LPAREN: - case LBRACKET: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ -ASTAssignmentExpression jjtn001 = new ASTAssignmentExpression(JJTASSIGNMENTEXPRESSION); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - LeftHandSideExpression(); - AssignmentOperator(); - AssignmentExpression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ - jj_consume_token(SEMICOLON); - break; - } - default: - jj_la1[5] = jj_gen; - ; - } - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - break; - } - default: - jj_la1[6] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } -} - -/** - * The path to a file that is not in the same path of the invoked LARA file. With one import it is - * possible to import one or every file within a package - **/ - final public void Import() throws ParseException {/*@bgen(jjtree) Import */ - ASTImport jjtn000 = new ASTImport(JJTIMPORT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token t; Token begin; Token end; - try { - begin = jj_consume_token(IMPORT); - t = FilePath(); - end = EndStatement(); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.jjtSetValue(t.image); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** FilePath - * gets the path to a file or all the files in the package - **/ - final public Token FilePath() throws ParseException {Token t; - label_3: - while (true) { - if (jj_2_3(2)) { - ; - } else { - break label_3; - } - Identifier(); - jj_consume_token(DOT); - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ - t = jj_consume_token(IDENTIFIER_NAME); - break; - } - case STAR:{ - t = jj_consume_token(STAR); - break; - } - default: - jj_la1[7] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -{if ("" != null) return t;} - throw new Error("Missing return statement in function"); -} - -/** FilePathNoSTar - * gets the path to a file in a package - **/ - final public void FilePathNoSTar() throws ParseException {/*@bgen(jjtree) FilePath */ - ASTFilePath jjtn000 = new ASTFilePath(JJTFILEPATH); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - label_4: - while (true) { - Identifier(); - jj_consume_token(DOT); - if (jj_2_4(2)) { - ; - } else { - break label_4; - } - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** - * Code Definition A parcel of native code or LARA-Code to be used by the insert/output action. To define the target - * language, one has to define the type of the codedef, such as: codedef, this means that the code to be inserted - * is written in C language. A code definition needs an identifier and its body is code that can contain a tag such - * as "
" to insert information on the code such as: join point property or a variable value. To use those tags, - * the codedef must have input arguments to refer those to specific values. - **/ - final public void CodeDef() throws ParseException {/*@bgen(jjtree) CodeDef */ - ASTCodeDef jjtn000 = new ASTCodeDef(JJTCODEDEF); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token name, code, language, begin, end; - try { -jjtn000.setLanguage("native"); - begin = jj_consume_token(CODEDEF); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LT:{ - jj_consume_token(LT); - language = jj_consume_token(IDENTIFIER_NAME); - jj_consume_token(GT); -jjtn000.setLanguage(language.image); - break; - } - default: - jj_la1[8] = jj_gen; - ; - } - name = jj_consume_token(IDENTIFIER_NAME); -jjtn000.setName(name.image); -ASTFormalParameterList jjtn001 = new ASTFormalParameterList(JJTFORMALPARAMETERLIST); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ - jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ - FormalParameterList(); - break; - } - default: - jj_la1[9] = jj_gen; - ; - } - jj_consume_token(RPAREN); - break; - } - default: - jj_la1[10] = jj_gen; - ; - } - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 0); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - code = jj_consume_token(CODE_LITERAL); -String simpleCode = code.image.substring(2,code.image.length()-2); - jjtn000.setCode(simpleCode); - end = jj_consume_token(END); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** - * Input arguments The arguments to be defined when a "aspect-call" action is stated. They can be normal variables - * or variables referent to a specific join point. The normal variables can have a default value - **/ - final public void Input() throws ParseException {/*@bgen(jjtree) Input */ - ASTInput jjtn000 = new ASTInput(JJTINPUT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin, end; - try { - begin = jj_consume_token(INPUT); - VariableDeclarationList(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ - jj_consume_token(SEMICOLON); - break; - } - default: - jj_la1[11] = jj_gen; - ; - } - end = jj_consume_token(END); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** - * Output arguments List of normal variables or variables referent to a specific join point. The normal variables - * can have a default value - **/ - final public void Output() throws ParseException {/*@bgen(jjtree) Output */ - ASTOutput jjtn000 = new ASTOutput(JJTOUTPUT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin, end; - try { - begin = jj_consume_token(OUTPUT); - VariableDeclarationList(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ - jj_consume_token(SEMICOLON); - break; - } - default: - jj_la1[12] = jj_gen; - ; - } - end = jj_consume_token(END); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** - * Static List of static variables and functions, which can be accessed statically in the aspect. The variables - * values are shared between all aspect instances - **/ - final public void Static() throws ParseException {/*@bgen(jjtree) Static */ - ASTStatic jjtn000 = new ASTStatic(JJTSTATIC); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(STATICDECL); - label_5: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FUNCTION: - case FUNCTION_GEN: - case VAR:{ - ; - break; - } - default: - jj_la1[13] = jj_gen; - break label_5; - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VAR:{ - VariableStatement(); - break; - } - case FUNCTION_GEN:{ - GeneratorFunctionDeclaration(); - break; - } - case FUNCTION:{ - FunctionDeclaration(); - break; - } - default: - jj_la1[14] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - jj_consume_token(END); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** Initialize - * Similar to a constructor. A block of JavaScript code to initialize variables, inter alia - **/ - final public void Initialize() throws ParseException {/*@bgen(jjtree) Initialize */ - ASTInitialize jjtn000 = new ASTInitialize(JJTINITIALIZE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(INITIALIZE); - JavaScript(); - jj_consume_token(END); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** Finalize - * Similar to a destructor. A block of JavaScript code to finalize output variables, inter alia - **/ - final public void Finalize() throws ParseException {/*@bgen(jjtree) Finalize */ - ASTFinalize jjtn000 = new ASTFinalize(JJTFINALIZE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(FINALIZE); - JavaScript(); - jj_consume_token(END); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** Check - * Set of conditions to verify input arguments and other important stats that specify if the aspect can be executed - **/ - final public void Check() throws ParseException {/*@bgen(jjtree) Check */ - ASTCheck jjtn000 = new ASTCheck(JJTCHECK); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(CHECK); - LogicalORExpression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ - EndStatement(); - label_6: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE: - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case TYPEOF: - case VOID: - case LBRACE: - case LPAREN: - case LBRACKET: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - ; - break; - } - default: - jj_la1[15] = jj_gen; - break label_6; - } - LogicalORExpression(); - EndStatement(); - } - break; - } - default: - jj_la1[16] = jj_gen; - ; - } - jj_consume_token(END); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** Aspect Definition - * The aspect definition can contain outputs and inputs variables, a check to verify those variables, an initializer and a finalizer to deal with information to be handler before and after the aspect, respectively. - * The body of the aspect consists of selects, applies and conditions to apply the aspect in the target program, and afters, befores, function and variable declaration to assist the apply and condition section. - */ - final public void AspectDef() throws ParseException {/*@bgen(jjtree) AspectDef */ - ASTAspectDef jjtn000 = new ASTAspectDef(JJTASPECTDEF); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token aspName, begin, end; - try { - begin = jj_consume_token(ASPECTDEF); - aspName = jj_consume_token(IDENTIFIER_NAME); - label_7: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INPUT: - case OUTPUT: - case STATICDECL:{ - ; - break; - } - default: - jj_la1[17] = jj_gen; - break label_7; - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INPUT:{ - Input(); - break; - } - case OUTPUT:{ - Output(); - break; - } - case STATICDECL:{ - Static(); - break; - } - default: - jj_la1[18] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INITIALIZE:{ - Initialize(); - break; - } - default: - jj_la1[19] = jj_gen; - ; - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CHECK:{ - Check(); - break; - } - default: - jj_la1[20] = jj_gen; - ; - } - label_8: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SELECT: - case APPLY: - case CALL: - case RUN: - case CMD: - case CONDITION: - case INSERT: - case EXEC: - case OUTPUT_ACT: - case BEFORE: - case AFTER: - case REPLACE: - case DEFINE: - case BREAK: - case CONTINUE: - case DELETE: - case FOR: - case FUNCTION: - case FUNCTION_GEN: - case IF: - case NEW: - case RETURN: - case YIELD: - case THIS: - case TYPEOF: - case VAR: - case VOID: - case WHILE: - case WITH: - case DO: - case IMPORT: - case SWITCH: - case THROW: - case TRY: - case LBRACE: - case LPAREN: - case LBRACKET: - case SEMICOLON: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - ; - break; - } - default: - jj_la1[21] = jj_gen; - break label_8; - } - if (jj_2_5(2147483647)) { - Select(); - } else if (jj_2_6(2147483647)) { - Apply(); - } else if (jj_2_7(2147483647)) { - AroundApply(); - } else if (jj_2_8(2147483647)) { - Condition(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CALL: - case RUN: - case CMD: - case INSERT: - case EXEC: - case OUTPUT_ACT: - case REPLACE: - case DEFINE: - case BREAK: - case CONTINUE: - case DELETE: - case FOR: - case FUNCTION: - case FUNCTION_GEN: - case IF: - case NEW: - case RETURN: - case YIELD: - case THIS: - case TYPEOF: - case VAR: - case VOID: - case WHILE: - case WITH: - case DO: - case IMPORT: - case SWITCH: - case THROW: - case TRY: - case LBRACE: - case LPAREN: - case LBRACKET: - case SEMICOLON: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - SourceElement(); - break; - } - default: - jj_la1[22] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FINALIZE:{ - Finalize(); - break; - } - default: - jj_la1[23] = jj_gen; - ; - } - end = jj_consume_token(END); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.setName(aspName.image); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** Select - * Pointcut expression to specify which join points are intended to influence. - * It can contain an unique label, so it can be advised, and a pointcut expression - */ - final public void Select() throws ParseException {/*@bgen(jjtree) Select */ - ASTSelect jjtn000 = new ASTSelect(JJTSELECT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token name, begin, end; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ - name = jj_consume_token(IDENTIFIER_NAME); -jjtn000.setName(name.image); - jj_consume_token(COLON); - break; - } - default: - jj_la1[24] = jj_gen; - ; - } - begin = jj_consume_token(SELECT); - if (jj_2_9(2147483647)) { - Pointcut(); - } else if (jj_2_10(2)) { - FourthSetOp(); - } else { - jj_consume_token(-1); - throw new ParseException(); - } - end = jj_consume_token(END); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void FourthSetOp() throws ParseException {/*@bgen(jjtree) #Join(> 1) */ - ASTJoin jjtn000 = new ASTJoin(JJTJOIN); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token joinType; - try { - ThirdSetOp(); - if (jj_2_11(2)) { - joinType = jj_consume_token(PLUS); - FourthSetOp(); -jjtn000.jjtSetValue(joinType.image); - } else { - ; - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void ThirdSetOp() throws ParseException {/*@bgen(jjtree) #Join(> 1) */ - ASTJoin jjtn000 = new ASTJoin(JJTJOIN); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token joinType; - try { - FirstSetOp(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BIT_AND: - case NATURAL_JOIN:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case NATURAL_JOIN:{ - joinType = jj_consume_token(NATURAL_JOIN); - break; - } - case BIT_AND:{ - joinType = jj_consume_token(BIT_AND); - break; - } - default: - jj_la1[25] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - ThirdSetOp(); -jjtn000.jjtSetValue(joinType.image); - break; - } - default: - jj_la1[26] = jj_gen; - ; - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void FirstSetOp() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ - Identifier(); - break; - } - case LPAREN:{ - jj_consume_token(LPAREN); - FourthSetOp(); - jj_consume_token(RPAREN); - break; - } - default: - jj_la1[27] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -} - -/** Pointcut - * It can contain an identifier for the join point, a join point identifier and a possible property expression. - * Each join point can have a child, the join point down to its hierarchy - */ - final public void Pointcut() throws ParseException {/*@bgen(jjtree) Pointcut */ - ASTPointcut jjtn000 = new ASTPointcut(JJTPOINTCUT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token joinPoint,reference;String referenceStr; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ - jj_consume_token(LPAREN); - //e.g.: ($l1=loop){...} - - reference = jj_consume_token(IDENTIFIER_NAME); - jj_consume_token(ASSIGN); - joinPoint = getNoReservedIdentifier(); -referenceStr = reference.image; - jj_consume_token(RPAREN); - break; - } - default: - jj_la1[28] = jj_gen; - if (jj_2_12(2147483647)) { - //e.g.: $l1=loop{...} - reference = jj_consume_token(IDENTIFIER_NAME); - jj_consume_token(ASSIGN); - joinPoint = getNoReservedIdentifier(); -referenceStr = reference.image; - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INCLUDE: - case INPUT: - case OUTPUT: - case APPLY: - case TO: - case CALL: - case CONDITION: - case BEGIN: - case BEFORE: - case AFTER: - case AROUND: - case REPLACE: - case CHECK: - case END: - case ELSE: - case FOR: - case FUNCTION: - case FUNCTION_GEN: - case IF: - case IN: - case RETURN: - case YIELD: - case VAR: - case WHILE: - case CASE: - case CLASS: - case _DEFAULT: - case DO: - case SWITCH: - case INTANCE_OF: - case IDENTIFIER_NAME:{ - joinPoint = getNoReservedIdentifier(); -referenceStr = "$"+joinPoint.image; - break; - } - default: - jj_la1[29] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } -jjtn000.jjtSetValue(joinPoint.image); - jjtn000.setReference(referenceStr); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LBRACE:{ - PointcutFilters(); - break; - } - default: - jj_la1[30] = jj_gen; - ; - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ - jj_consume_token(DOT); - Pointcut(); - break; - } - default: - jj_la1[31] = jj_gen; - ; - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** Pointcut properties - * The properties of a pointcut can be declared in three different ways: - - it can be any property (*) - - a set of properties that will be mapped to the default attribute - - a property expression - */ - final public void PointcutFilters() throws ParseException { - jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ - jj_consume_token(STAR); - break; - } - case DELETE: - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case TYPEOF: - case VOID: - case LBRACE: - case LPAREN: - case LBRACKET: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ -ASTPointcutFilters jjtn002 = new ASTPointcutFilters(JJTPOINTCUTFILTERS); - boolean jjtc002 = true; - jjtree.openNodeScope(jjtn002); - jjtn002.jjtSetFirstToken(getToken(1)); - try { - if (jj_2_13(2147483647)) { - OrFiltersExpr(); -jjtree.closeNodeScope(jjtn002, true); - jjtc002 = false; - jjtn002.jjtSetLastToken(getToken(0)); -jjtn002.setFullSpecified(true); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE: - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case TYPEOF: - case VOID: - case LBRACE: - case LPAREN: - case LBRACKET: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ -ASTOrFiltersExpr jjtn001 = new ASTOrFiltersExpr(JJTORFILTERSEXPR); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - ConditionalExpression(); - label_9: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - ; - break; - } - default: - jj_la1[32] = jj_gen; - break label_9; - } - jj_consume_token(COMMA); - ConditionalExpression(); - } - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -jjtree.closeNodeScope(jjtn002, true); - jjtc002 = false; - jjtn002.jjtSetLastToken(getToken(0)); -jjtn002.setFullSpecified(false); - break; - } - default: - jj_la1[33] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } catch (Throwable jjte002) { -if (jjtc002) { - jjtree.clearNodeScope(jjtn002); - jjtc002 = false; - } else { - jjtree.popNode(); - } - if (jjte002 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte002;} - } - if (jjte002 instanceof ParseException) { - {if (true) throw (ParseException)jjte002;} - } - {if (true) throw (Error)jjte002;} - } finally { -if (jjtc002) { - jjtree.closeNodeScope(jjtn002, true); - jjtn002.jjtSetLastToken(getToken(0)); - } - } - break; - } - default: - jj_la1[34] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - jj_consume_token(RBRACE); -} - -/** "OR" Property Expr - * In the pointcut properties declaration, the comma is used as an OR operator (similar to ||) - **/ - final public void OrFiltersExpr() throws ParseException { -ASTOrFiltersExpr jjtn001 = new ASTOrFiltersExpr(JJTORFILTERSEXPR); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - ANDFiltersExpr(); - label_10: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - ; - break; - } - default: - jj_la1[35] = jj_gen; - break label_10; - } - jj_consume_token(COMMA); - ANDFiltersExpr(); - } - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -} - -/** "AND" Property Expression - * To combine properties such as an AND operation, the properties are declared inside brackets, converting the comma (which is the OR operator) into an AND. - */ - final public void ANDFiltersExpr() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ - Filter(); - break; - } - case LPAREN:{ - jj_consume_token(LPAREN); -ASTANDFiltersExpr jjtn001 = new ASTANDFiltersExpr(JJTANDFILTERSEXPR); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - Filter(); - label_11: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - ; - break; - } - default: - jj_la1[36] = jj_gen; - break label_11; - } - jj_consume_token(COMMA); - Filter(); - } - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - jj_consume_token(RPAREN); - break; - } - default: - jj_la1[37] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -} - -/** Property - * The property is defined by comparing a join point attribute to a value - **/ - final public void Filter() throws ParseException {/*@bgen(jjtree) Filter */ - ASTFilter jjtn000 = new ASTFilter(JJTFILTER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token prop,op; - try { - prop = jj_consume_token(IDENTIFIER_NAME); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case EQ: - case NE: - case MATCH: - case SEQ: - case SNEQ:{ - EqualityOperator(); - break; - } - case IN: - case LT: - case GT: - case LE: - case GE: - case INTANCE_OF:{ - RelationalOperator(); - break; - } - default: - jj_la1[38] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - ConditionalExpression(); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.setProp(prop.image); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** Around - * A Statement to occur around an apply - * It contains a list of applies that this statement refers to. The body of this statement is JavaScript, and can be used to prepare information for the applies. - **/ - final public void AroundApply() throws ParseException {/*@bgen(jjtree) AroundApply */ - ASTAroundApply jjtn000 = new ASTAroundApply(JJTAROUNDAPPLY); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token name,when, end; - String label = ""; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ - name = jj_consume_token(IDENTIFIER_NAME); - jj_consume_token(COLON); -label = name.image; - break; - } - default: - jj_la1[39] = jj_gen; - ; - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BEFORE:{ - when = jj_consume_token(BEFORE); - break; - } - case AFTER:{ - when = jj_consume_token(AFTER); - break; - } - default: - jj_la1[40] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ -ASTApplies jjtn001 = new ASTApplies(JJTAPPLIES); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - Identifier(); - label_12: - while (true) { - if (jj_2_14(2)) { - ; - } else { - break label_12; - } - jj_consume_token(COMMA); - Identifier(); - } - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - break; - } - default: - jj_la1[41] = jj_gen; - ; - } - jj_consume_token(DO); - JavaScript(); -jjtn000.setName(label); - jjtn000.setWhen(when.image); - end = jj_consume_token(END); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** Apply - * Old Version of apply, only static weaving - * Advice each join point of the related select(s). - * It can contain an unique label and a list of selects to be advised by the apply. If no select is inserted, the last select with no label will be used. - * The body contains JavaScript, in which the actions can be declared - ** - void Apply() #Apply: - {Token name, apply, end;} - { - [name={jjtThis.setName(name.image);} ] apply= [To()] - JavaScript() - end= - { jjtThis.setCoord(apply,end);} - } - /**/ - - /** Apply (Static/Dynamic) - * The new version of the Apply statement: static or dynamic weaving - * Advice each join point of the related select(s). - * It can contain an unique label and a list of selects to be advised by the apply. If no select is inserted, the last select with no label will be used. - * The body contains JavaScript, in which the actions can be declared - **/ - final public void Apply() throws ParseException {/*@bgen(jjtree) Apply */ - ASTApply jjtn000 = new ASTApply(JJTAPPLY); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token name, apply, end; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ - name = jj_consume_token(IDENTIFIER_NAME); -jjtn000.setName(name.image); - jj_consume_token(COLON); - break; - } - default: - jj_la1[42] = jj_gen; - ; - } - apply = jj_consume_token(APPLY); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DYNAMIC:{ - jj_consume_token(DYNAMIC); -jjtn000.setDynamic(true); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEQUENCIAL: - case PARALLEL:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PARALLEL:{ - jj_consume_token(PARALLEL); -jjtn000.setConcurrent(true); - break; - } - case SEQUENCIAL:{ - jj_consume_token(SEQUENCIAL); -jjtn000.setConcurrent(false); - break; - } - default: - jj_la1[43] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - break; - } - default: - jj_la1[44] = jj_gen; - ; - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BEFORE: - case AFTER:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BEFORE:{ - jj_consume_token(BEFORE); -jjtn000.setTrigger("before"); - break; - } - case AFTER:{ - jj_consume_token(AFTER); -jjtn000.setTrigger("after"); - break; - } - default: - jj_la1[45] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - break; - } - default: - jj_la1[46] = jj_gen; - ; - } - break; - } - default: - jj_la1[47] = jj_gen; - ; - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case TO:{ - To(); - break; - } - default: - jj_la1[48] = jj_gen; - ; - } - JavaScript(); - end = jj_consume_token(END); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** To - * list of selects that will be influenced by the apply - **/ - final public void To() throws ParseException {/*@bgen(jjtree) To */ - ASTTo jjtn000 = new ASTTo(JJTTO); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(TO); - FourthSetOp(); - label_13: - while (true) { - if (jj_2_15(2147483647)) { - ; - } else { - break label_13; - } - jj_consume_token(COMMA); - FourthSetOp(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void SimpleAction() throws ParseException {/*@bgen(jjtree) Action */ - ASTAction jjtn000 = new ASTAction(JJTACTION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token t; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INSERT: - case REPLACE:{ - Insert(); - break; - } - case DEFINE:{ - Define(); - break; - } - case EXEC:{ - Perform(); - break; - } - case OUTPUT_ACT:{ - OutputAct(); - break; - } - default: - jj_la1[49] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - EndStatement(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** Action - * Actions that can be used to influence the join points. - * A join point variable can be used to specify the targeted join point where the action takes place - **/ - final public void Action() throws ParseException {Token t; -ASTAction jjtn003 = new ASTAction(JJTACTION); - boolean jjtc003 = true; - jjtree.openNodeScope(jjtn003); - jjtn003.jjtSetFirstToken(getToken(1)); - try { -ASTCompositeReference jjtn002 = new ASTCompositeReference(JJTCOMPOSITEREFERENCE); - boolean jjtc002 = true; - jjtree.openNodeScope(jjtn002); - jjtn002.jjtSetFirstToken(getToken(1)); - try { -ASTIdentifier jjtn001 = new ASTIdentifier(JJTIDENTIFIER); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - t = jj_consume_token(IDENTIFIER_NAME); -jjtree.closeNodeScope(jjtn001, true); - jjtc001 = false; - jjtn001.jjtSetLastToken(getToken(0)); -jjtn001.setName(t.image);jjtn001.jjtSetValue(t.image); - //jjtThis.setCoord(t,t); - - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - label_14: - while (true) { - if (jj_2_16(2147483647)) { - ; - } else { - break label_14; - } - MemberExpressionPart(); - } - jj_consume_token(DOT); - } catch (Throwable jjte002) { -if (jjtc002) { - jjtree.clearNodeScope(jjtn002); - jjtc002 = false; - } else { - jjtree.popNode(); - } - if (jjte002 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte002;} - } - if (jjte002 instanceof ParseException) { - {if (true) throw (ParseException)jjte002;} - } - {if (true) throw (Error)jjte002;} - } finally { -if (jjtc002) { - jjtree.closeNodeScope(jjtn002, jjtree.nodeArity() > 1); - jjtn002.jjtSetLastToken(getToken(0)); - } - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INSERT: - case REPLACE:{ - Insert(); - break; - } - case DEFINE:{ - Define(); - break; - } - case EXEC:{ - Perform(); - break; - } - case OUTPUT_ACT:{ - OutputAct(); - break; - } - default: - jj_la1[50] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte003) { -if (jjtc003) { - jjtree.clearNodeScope(jjtn003); - jjtc003 = false; - } else { - jjtree.popNode(); - } - if (jjte003 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte003;} - } - if (jjte003 instanceof ParseException) { - {if (true) throw (ParseException)jjte003;} - } - {if (true) throw (Error)jjte003;} - } finally { -if (jjtc003) { - jjtree.closeNodeScope(jjtn003, true); - jjtn003.jjtSetLastToken(getToken(0)); - } - } - EndStatement(); -} - - final public void ActionOnAssign() throws ParseException {/*@bgen(jjtree) Action */ - ASTAction jjtn000 = new ASTAction(JJTACTION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token t; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ -ASTCompositeReference jjtn002 = new ASTCompositeReference(JJTCOMPOSITEREFERENCE); - boolean jjtc002 = true; - jjtree.openNodeScope(jjtn002); - jjtn002.jjtSetFirstToken(getToken(1)); - try { -ASTIdentifier jjtn001 = new ASTIdentifier(JJTIDENTIFIER); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - t = jj_consume_token(IDENTIFIER_NAME); -jjtree.closeNodeScope(jjtn001, true); - jjtc001 = false; - jjtn001.jjtSetLastToken(getToken(0)); -jjtn001.setName(t.image);jjtn001.jjtSetValue(t.image); - //jjtThis.setCoord(t,t); - - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - label_15: - while (true) { - if (jj_2_17(2147483647)) { - ; - } else { - break label_15; - } - MemberExpressionPart(); - } - jj_consume_token(DOT); - } catch (Throwable jjte002) { -if (jjtc002) { - jjtree.clearNodeScope(jjtn002); - jjtc002 = false; - } else { - jjtree.popNode(); - } - if (jjte002 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte002;} - } - if (jjte002 instanceof ParseException) { - {if (true) throw (ParseException)jjte002;} - } - {if (true) throw (Error)jjte002;} - } finally { -if (jjtc002) { - jjtree.closeNodeScope(jjtn002, jjtree.nodeArity() > 1); - jjtn002.jjtSetLastToken(getToken(0)); - } - } - break; - } - default: - jj_la1[51] = jj_gen; - ; - } - ExecOnAssign(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** Call - * Action to invoke an aspect. - * The aspect is called with the input arguments that requires and the call instance can have a reference variable to be used to recover information from the invoked aspect. - **/ - final public void Call() throws ParseException {/*@bgen(jjtree) Call */ - ASTCall jjtn000 = new ASTCall(JJTCALL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token aspVarName,aspName,ref, end; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CALL:{ - jj_consume_token(CALL); - if (jj_2_18(2147483647)) { - LeftHandSideExpression(); - jj_consume_token(COLON); - } else { - ; - } - break; - } - case VAR:{ - jj_consume_token(VAR); - Identifier(); - jj_consume_token(ASSIGN); - jj_consume_token(CALL); - break; - } - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case LBRACE: - case LPAREN: - case LBRACKET: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - LeftHandSideExpression(); - jj_consume_token(ASSIGN); - jj_consume_token(CALL); - break; - } - default: - jj_la1[52] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - if (jj_2_19(2)) { - FilePathNoSTar(); - } else { - ; - } - aspName = jj_consume_token(IDENTIFIER_NAME); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ - Arguments(); - break; - } - default: - jj_la1[53] = jj_gen; - ; - } - end = EndStatement(); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.setAspName(aspName.image); - // jjtThis.setCoord(aspName,end); - - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** Run - * Execution of an external tool. - **/ - final public void Run() throws ParseException {/*@bgen(jjtree) Run */ - ASTRun jjtn000 = new ASTRun(JJTRUN); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token run, toolName, end; - try { - run = jj_consume_token(RUN); - if (jj_2_20(2147483647)) { - LeftHandSideExpression(); - jj_consume_token(COLON); - } else { - ; - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INCLUDE: - case INPUT: - case OUTPUT: - case APPLY: - case TO: - case CALL: - case CONDITION: - case BEGIN: - case BEFORE: - case AFTER: - case AROUND: - case REPLACE: - case CHECK: - case END: - case ELSE: - case FOR: - case FUNCTION: - case FUNCTION_GEN: - case IF: - case IN: - case RETURN: - case YIELD: - case VAR: - case WHILE: - case CASE: - case CLASS: - case _DEFAULT: - case DO: - case SWITCH: - case INTANCE_OF: - case IDENTIFIER_NAME:{ - toolName = getNoReservedIdentifier(); -jjtn000.setToolName(toolName.image); - break; - } - default: - jj_la1[54] = jj_gen; - ; - } - Arguments(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GT:{ - jj_consume_token(GT); - AssignmentExpression(); - break; - } - default: - jj_la1[55] = jj_gen; - ; - } - end = EndStatement(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** Command - * Execution of a command. - **/ - final public void Cmd() throws ParseException {/*@bgen(jjtree) Cmd */ - ASTCmd jjtn000 = new ASTCmd(JJTCMD); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token cmd, toolName, end; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CMD:{ - cmd = jj_consume_token(CMD); - break; - } - case RUN:{ - cmd = jj_consume_token(RUN); - jj_consume_token(CMD); -jjtn000.setNewVersion(true); - break; - } - default: - jj_la1[56] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - if (jj_2_21(2147483647)) { - LeftHandSideExpression(); - jj_consume_token(COLON); - } else { - ; - } - Arguments(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GT:{ - jj_consume_token(GT); - AssignmentExpression(); - break; - } - default: - jj_la1[57] = jj_gen; - ; - } - end = EndStatement(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** OLD CALL ** - void Call() #Call: - {Token aspVarName,aspName,ref, end;} - { - [LOOKAHEAD( ) - aspVarName= - {jjtThis.setAspVarName(aspVarName.image);}] - [LOOKAHEAD(2)FilePathNoSTar()]aspName= - {jjtThis.setAspName(aspName.image);} - [LOOKAHEAD(Arguments())Arguments()] end= - // { jjtThis.setCoord(aspName,end);} - } - /***/ - - /** Insert - * The insertion of code is made by indicating a codedefinition's identifier with the required arguments or writing the desired code, with the possibility of using LARA-code to be defined into the target language, such as insert before %{�}%. - * It is also needed to say if the code is inserted before, after or around the pointcut. - **/ - final public void Insert() throws ParseException {/*@bgen(jjtree) Insert */ - ASTInsert jjtn000 = new ASTInsert(JJTINSERT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token when,language, begin, end; - try { -jjtn000.setLanguage("native"); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INSERT:{ - begin = jj_consume_token(INSERT); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BEFORE: - case AFTER: - case AROUND: - case REPLACE: - case LT:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LT:{ - jj_consume_token(LT); - language = jj_consume_token(IDENTIFIER_NAME); - jj_consume_token(GT); -jjtn000.setLanguage(language.image); - break; - } - default: - jj_la1[58] = jj_gen; - ; - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BEFORE:{ - when = jj_consume_token(BEFORE); - break; - } - case AFTER:{ - when = jj_consume_token(AFTER); - break; - } - case AROUND:{ - when = jj_consume_token(AROUND); - break; - } - case REPLACE:{ - when = jj_consume_token(REPLACE); - break; - } - default: - jj_la1[59] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - ConditionalExpression(); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.setWhen(when.image); - break; - } - case LPAREN:{ - Arguments(); - break; - } - default: - jj_la1[60] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - break; - } - case REPLACE:{ - begin = jj_consume_token(REPLACE); - ConditionalExpression(); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.setWhen(begin.image); - break; - } - default: - jj_la1[61] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** Perform - * Perform an action over the join point - **/ - final public void Perform() throws ParseException {/*@bgen(jjtree) Perform */ - ASTPerform jjtn000 = new ASTPerform(JJTPERFORM); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token action, begin, end, t; - try { - begin = jj_consume_token(EXEC); - if (jj_2_22(2147483647)) { - t = jj_consume_token(IDENTIFIER_NAME); - jj_consume_token(COLON); -jjtn000.setVariable(t.image); - } else { - ; - } - action = getNoReservedIdentifier(); -jjtn000.setAction(action.image); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN: - case STRING_LITERAL: - case CODE_LITERAL:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STRING_LITERAL: - case CODE_LITERAL:{ -ASTFunctionCallParameters jjtn001 = new ASTFunctionCallParameters(JJTFUNCTIONCALLPARAMETERS); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - TemplateLiteral(); - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - break; - } - case LPAREN:{ - Arguments(); - break; - } - default: - jj_la1[62] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - break; - } - default: - jj_la1[63] = jj_gen; - ; - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** Perform - * Perform an action over the join point - **/ - final public void ExecOnAssign() throws ParseException {/*@bgen(jjtree) Perform */ - ASTPerform jjtn000 = new ASTPerform(JJTPERFORM); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token action, begin, end, t; - try { - jj_consume_token(EXEC); - //[LOOKAHEAD(< IDENTIFIER_NAME > < COLON > ) t=< IDENTIFIER_NAME > < COLON >{jjtThis.setVariable(t.image);} ] - action = getNoReservedIdentifier(); -jjtn000.setAction(action.image); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STRING_LITERAL: - case CODE_LITERAL:{ -ASTFunctionCallParameters jjtn001 = new ASTFunctionCallParameters(JJTFUNCTIONCALLPARAMETERS); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - TemplateLiteral(); - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - break; - } - case LPAREN:{ - Arguments(); - break; - } - default: - jj_la1[64] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -// void CodeLiteralOnlyArgument() #FunctionCallParameters: {} -// { -// TemplateLiteral() -// } - - /** Output - * Similar to Insert, however it is used to output in runtime - **/ - final public void OutputAct() throws ParseException {/*@bgen(jjtree) OutputAct */ - ASTOutputAct jjtn000 = new ASTOutputAct(JJTOUTPUTACT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { - begin = jj_consume_token(OUTPUT_ACT); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STRING_LITERAL: - case CODE_LITERAL:{ - TemplateLiteral(); - break; - } - case IDENTIFIER_NAME:{ -ASTCompositeReference jjtn001 = new ASTCompositeReference(JJTCOMPOSITEREFERENCE); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - Identifier(); - if (jj_2_23(2147483647)) { - Arguments(); - } else { - ; - } - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - break; - } - default: - jj_la1[65] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - break; - } - case LPAREN:{ - Arguments(); - break; - } - default: - jj_la1[66] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** Define - * Assign a value to a join point attribute - **/ - final public void Define() throws ParseException {/*@bgen(jjtree) Define */ - ASTDefine jjtn000 = new ASTDefine(JJTDEFINE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { - begin = jj_consume_token(DEFINE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INCLUDE: - case INPUT: - case OUTPUT: - case APPLY: - case TO: - case CALL: - case CONDITION: - case BEGIN: - case BEFORE: - case AFTER: - case AROUND: - case REPLACE: - case CHECK: - case END: - case DELETE: - case ELSE: - case FOR: - case FUNCTION: - case FUNCTION_GEN: - case IF: - case IN: - case RETURN: - case YIELD: - case VAR: - case WHILE: - case CASE: - case CLASS: - case _DEFAULT: - case DO: - case SWITCH: - case INTANCE_OF: - case IDENTIFIER_NAME:{ - noReservedIdentifier(); - jj_consume_token(ASSIGN); - AssignmentExpression(); - break; - } - case LPAREN:{ - Arguments(); - break; - } - default: - jj_la1[67] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/** Condition - * Boolean expression that verifies if the apply can take place in a join point - **/ - final public void Condition() throws ParseException {/*@bgen(jjtree) Condition */ - ASTCondition jjtn000 = new ASTCondition(JJTCONDITION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token t,begin, end; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ - t = jj_consume_token(IDENTIFIER_NAME); - jj_consume_token(COLON); -jjtn000.jjtSetValue(t.image); - break; - } - default: - jj_la1[68] = jj_gen; - ; - } - begin = jj_consume_token(CONDITION); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FOR:{ - jj_consume_token(FOR); -ASTFor jjtn001 = new ASTFor(JJTFOR); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - Identifier(); - label_16: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - ; - break; - } - default: - jj_la1[69] = jj_gen; - break label_16; - } - jj_consume_token(COMMA); - Identifier(); - } - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - break; - } - default: - jj_la1[70] = jj_gen; - ; - } - LogicalORExpression(); - end = jj_consume_token(END); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/******************************************************************************* - ********************** END OF LARA SYNTACTIC GRAMMAR ********************* - *******************************************************************************/ - - /* The following part of the grammar is the EcmaScript grammar created by The Dojo Foundation (2004-2005), and it was partially updated to conform to the requirements of LARA grammar, such as the use of actions and join point variables. - **/ - - /* Section 11.1: Primary Expressions */ - final public - void PrimaryExpression() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case THIS:{ - This(); - break; - } - case LBRACE:{ - ObjectLiteral(); - break; - } - case LBRACKET:{ - ArrayLiteral(); - break; - } - case LPAREN:{ - ParenExpression(); - break; - } - case IDENTIFIER_NAME:{ - Identifier(); - break; - } - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case REGULAR_EXPRESSION_LITERAL:{ - Literal(); - break; - } - default: - jj_la1[71] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -} - - final public void This() throws ParseException {/*@bgen(jjtree) ThisReference */ - ASTThisReference jjtn000 = new ASTThisReference(JJTTHISREFERENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { -ASTThisReference jjtn001 = new ASTThisReference(JJTTHISREFERENCE); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(THIS); - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void ParenExpression() throws ParseException {/*@bgen(jjtree) ParenExpression */ - ASTParenExpression jjtn000 = new ASTParenExpression(JJTPARENEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(LPAREN); - Expression(); - jj_consume_token(RPAREN); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 7.8: Literals */ - final public - void Literal() throws ParseException {/*@bgen(jjtree) Literal */ - ASTLiteral jjtn000 = new ASTLiteral(JJTLITERAL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token t; - Map objLiteral; - List arrayLiteral; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DECIMAL_LITERAL:{ - t = jj_consume_token(DECIMAL_LITERAL); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.setDecimalValue(t.image); - if(t.image.contains(".")) - jjtn000.setType(Types.Float); - else jjtn000.setType(Types.Int); - break; - } - case HEX_INTEGER_LITERAL:{ - t = jj_consume_token(HEX_INTEGER_LITERAL); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.setHexValue(t.image); - jjtn000.setType(Types.Int); - break; - } - case STRING_LITERAL:{ - t = jj_consume_token(STRING_LITERAL); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.setStringValue(t.image); - jjtn000.setType(Types.String); - break; - } - case BOOLEAN_LITERAL:{ - t = jj_consume_token(BOOLEAN_LITERAL); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.setBooleanValue(t.image); - jjtn000.setType(Types.Boolean); - break; - } - case NULL_LITERAL:{ - t = jj_consume_token(NULL_LITERAL); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.setNullValue(); - jjtn000.setType(Types.Null); - break; - } - case REGULAR_EXPRESSION_LITERAL:{ - t = jj_consume_token(REGULAR_EXPRESSION_LITERAL); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.setRegexValue(t.image); - jjtn000.setType(Types.RegEx); - break; - } - case CODE_LITERAL:{ - t = jj_consume_token(CODE_LITERAL); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.setCodeValue(t.image); - jjtn000.setType(Types.Code); - break; - } - default: - jj_la1[72] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void TemplateLiteral() throws ParseException {/*@bgen(jjtree) Literal */ - ASTLiteral jjtn000 = new ASTLiteral(JJTLITERAL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token t; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STRING_LITERAL:{ - t = jj_consume_token(STRING_LITERAL); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.setStringValue(t.image); - jjtn000.setType(Types.String); - break; - } - case CODE_LITERAL:{ - t = jj_consume_token(CODE_LITERAL); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.setCodeValue(t.image); - jjtn000.setType(Types.Code); - break; - } - default: - jj_la1[73] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void Identifier() throws ParseException {/*@bgen(jjtree) Identifier */ - ASTIdentifier jjtn000 = new ASTIdentifier(JJTIDENTIFIER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token t; - try { - t = jj_consume_token(IDENTIFIER_NAME); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.setName(t.image);jjtn000.jjtSetValue(t.image); - /*{jjtThis.setCoord(t,t); }*/ - - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void LabelIdentifier() throws ParseException {/*@bgen(jjtree) Identifier */ - ASTIdentifier jjtn000 = new ASTIdentifier(JJTIDENTIFIER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token t; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LABEL_IDENTIFIER:{ - t = jj_consume_token(LABEL_IDENTIFIER); - break; - } - case IDENTIFIER_NAME:{ - t = jj_consume_token(IDENTIFIER_NAME); - break; - } - default: - jj_la1[74] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.setName(t.image);jjtn000.jjtSetValue(t.image); - /*{jjtThis.setCoord(t,t); }*/ - - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 11.1.4: Array Initialiser */ - final public - void ArrayLiteral() throws ParseException {/*@bgen(jjtree) ArrayLiteral */ - ASTArrayLiteral jjtn000 = new ASTArrayLiteral(JJTARRAYLITERAL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(LBRACKET); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - ElisionFirst(); - break; - } - default: - jj_la1[75] = jj_gen; - ; - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE: - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case TYPEOF: - case VOID: - case LBRACE: - case LPAREN: - case LBRACKET: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - ElementList(); - break; - } - default: - jj_la1[76] = jj_gen; - ; - } - jj_consume_token(RBRACKET); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void ElementList() throws ParseException { - AssignmentExpression(); - label_17: - while (true) { - if (jj_2_24(2)) { - ; - } else { - break label_17; - } - Elision(); - AssignmentExpression(); - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - Elision(); - break; - } - default: - jj_la1[77] = jj_gen; - ; - } -} - - final public void Elision() throws ParseException { - jj_consume_token(COMMA); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ -ASTEmptyPositions jjtn001 = new ASTEmptyPositions(JJTEMPTYPOSITIONS); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - label_18: - while (true) { - jj_consume_token(COMMA); -jjtn001.inc(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - ; - break; - } - default: - jj_la1[78] = jj_gen; - break label_18; - } - } - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - break; - } - default: - jj_la1[79] = jj_gen; - ; - } -} - - final public void ElisionFirst() throws ParseException {/*@bgen(jjtree) EmptyPositions */ - ASTEmptyPositions jjtn000 = new ASTEmptyPositions(JJTEMPTYPOSITIONS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(COMMA); -jjtn000.inc(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - label_19: - while (true) { - jj_consume_token(COMMA); -jjtn000.inc(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - ; - break; - } - default: - jj_la1[80] = jj_gen; - break label_19; - } - } - break; - } - default: - jj_la1[81] = jj_gen; - ; - } - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 11.1.5: Object Initialiser */ - final public - void ObjectLiteral() throws ParseException {/*@bgen(jjtree) ObjectLiteral */ - ASTObjectLiteral jjtn000 = new ASTObjectLiteral(JJTOBJECTLITERAL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(LBRACE); -exprBraceCount++; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INCLUDE: - case INPUT: - case OUTPUT: - case APPLY: - case TO: - case CALL: - case CONDITION: - case BEGIN: - case BEFORE: - case AFTER: - case AROUND: - case REPLACE: - case CHECK: - case END: - case DELETE: - case ELSE: - case FOR: - case FUNCTION: - case FUNCTION_GEN: - case IF: - case IN: - case RETURN: - case YIELD: - case VAR: - case WHILE: - case CASE: - case CLASS: - case _DEFAULT: - case DO: - case SWITCH: - case INTANCE_OF: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - PropertyNameAndValueList(); - break; - } - default: - jj_la1[82] = jj_gen; - ; - } - jj_consume_token(RBRACE); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -exprBraceCount--; - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void PropertyNameAndValueList() throws ParseException { - PropertyNameAndValue(); - label_20: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - ; - break; - } - default: - jj_la1[83] = jj_gen; - break label_20; - } - if (jj_2_25(2147483647)) { - jj_consume_token(COMMA); - PropertyNameAndValue(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - jj_consume_token(COMMA); - break; - } - default: - jj_la1[84] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } -} - - final public void PropertyNameAndValue() throws ParseException {/*@bgen(jjtree) LiteralField */ - ASTLiteralField jjtn000 = new ASTLiteralField(JJTLITERALFIELD); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - PropertyName(); - jj_consume_token(COLON); - AssignmentExpression(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void PropertyName() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INCLUDE: - case INPUT: - case OUTPUT: - case APPLY: - case TO: - case CALL: - case CONDITION: - case BEGIN: - case BEFORE: - case AFTER: - case AROUND: - case REPLACE: - case CHECK: - case END: - case DELETE: - case ELSE: - case FOR: - case FUNCTION: - case FUNCTION_GEN: - case IF: - case IN: - case RETURN: - case YIELD: - case VAR: - case WHILE: - case CASE: - case CLASS: - case _DEFAULT: - case DO: - case SWITCH: - case INTANCE_OF: - case IDENTIFIER_NAME:{ - noReservedIdentifier(); - break; - } - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case REGULAR_EXPRESSION_LITERAL:{ - Literal(); - break; - } - default: - jj_la1[85] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -} - -/* Section 11.2: Left-Hand-Side Expressions */ - final public - void MemberExpression() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FUNCTION: - case FUNCTION_GEN: - case THIS: - case LBRACE: - case LPAREN: - case LBRACKET: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ -ASTCompositeReference jjtn001 = new ASTCompositeReference(JJTCOMPOSITEREFERENCE); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - if (jj_2_26(2147483647)) { - GeneratorFunctionExpression(); - } else if (jj_2_27(2147483647)) { - FunctionExpression(); - } else if (jj_2_28(2147483647)) { - ArrowFunctionExpression(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case THIS: - case LBRACE: - case LPAREN: - case LBRACKET: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - PrimaryExpression(); - break; - } - default: - jj_la1[86] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - label_21: - while (true) { - if (jj_2_29(2)) { - ; - } else { - break label_21; - } - MemberExpressionPart(); - } - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - break; - } - case NEW:{ - AllocationExpression(); - break; - } - default: - jj_la1[87] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -} - - final public void MemberExpressionForIn() throws ParseException { -ASTCompositeReference jjtn001 = new ASTCompositeReference(JJTCOMPOSITEREFERENCE); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - if (jj_2_30(2147483647)) { - GeneratorFunctionExpression(); - } else if (jj_2_31(2147483647)) { - FunctionExpression(); - } else if (jj_2_32(2147483647)) { - ArrowFunctionExpression(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case THIS: - case LBRACE: - case LPAREN: - case LBRACKET: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - PrimaryExpression(); - break; - } - default: - jj_la1[88] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - label_22: - while (true) { - if (jj_2_33(2)) { - ; - } else { - break label_22; - } - MemberExpressionPart(); - } - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -} - - final public void AllocationExpression() throws ParseException {/*@bgen(jjtree) AllocationExpression */ - ASTAllocationExpression jjtn000 = new ASTAllocationExpression(JJTALLOCATIONEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { -ASTCompositeReference jjtn001 = new ASTCompositeReference(JJTCOMPOSITEREFERENCE); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(NEW); - MemberExpression(); - label_23: - while (true) { - if (jj_2_34(2147483647)) { - ; - } else { - break label_23; - } - Arguments(); - label_24: - while (true) { - if (jj_2_35(2)) { - ; - } else { - break label_24; - } - MemberExpressionPart(); - } - } - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void MemberExpressionPart() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LBRACE: - case LBRACKET:{ -ASTPropertyValueReference jjtn001 = new ASTPropertyValueReference(JJTPROPERTYVALUEREFERENCE); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LBRACKET:{ - jj_consume_token(LBRACKET); - Expression(); - jj_consume_token(RBRACKET); - break; - } - case LBRACE:{ - jj_consume_token(LBRACE); -exprBraceCount++; - Expression(); - jj_consume_token(RBRACE); -jjtree.closeNodeScope(jjtn001, true); - jjtc001 = false; - jjtn001.jjtSetLastToken(getToken(0)); -exprBraceCount--; - break; - } - default: - jj_la1[89] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - break; - } - case DOT:{ -ASTPropertyIdentifierReference jjtn002 = new ASTPropertyIdentifierReference(JJTPROPERTYIDENTIFIERREFERENCE); - boolean jjtc002 = true; - jjtree.openNodeScope(jjtn002); - jjtn002.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(DOT); - noReservedIdentifier(); - } catch (Throwable jjte002) { -if (jjtc002) { - jjtree.clearNodeScope(jjtn002); - jjtc002 = false; - } else { - jjtree.popNode(); - } - if (jjte002 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte002;} - } - if (jjte002 instanceof ParseException) { - {if (true) throw (ParseException)jjte002;} - } - {if (true) throw (Error)jjte002;} - } finally { -if (jjtc002) { - jjtree.closeNodeScope(jjtn002, true); - jjtn002.jjtSetLastToken(getToken(0)); - } - } - break; - } - default: - jj_la1[90] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -} - - final public void CallExpression() throws ParseException {/*@bgen(jjtree) #CompositeReference(> 1) */ - ASTCompositeReference jjtn000 = new ASTCompositeReference(JJTCOMPOSITEREFERENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - MemberExpression(); - Arguments(); - label_25: - while (true) { - if (jj_2_36(2)) { - ; - } else { - break label_25; - } - CallExpressionPart(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void CallExpressionForIn() throws ParseException {/*@bgen(jjtree) #CompositeReference(> 1) */ - ASTCompositeReference jjtn000 = new ASTCompositeReference(JJTCOMPOSITEREFERENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - MemberExpressionForIn(); - Arguments(); - label_26: - while (true) { - if (jj_2_37(2)) { - ; - } else { - break label_26; - } - CallExpressionPart(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void CallExpressionPart() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ - Arguments(); - break; - } - case LBRACKET:{ -ASTPropertyValueReference jjtn001 = new ASTPropertyValueReference(JJTPROPERTYVALUEREFERENCE); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(LBRACKET); - Expression(); - jj_consume_token(RBRACKET); - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - break; - } - case DOT:{ -ASTPropertyIdentifierReference jjtn002 = new ASTPropertyIdentifierReference(JJTPROPERTYIDENTIFIERREFERENCE); - boolean jjtc002 = true; - jjtree.openNodeScope(jjtn002); - jjtn002.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(DOT); - noReservedIdentifier(); - } catch (Throwable jjte002) { -if (jjtc002) { - jjtree.clearNodeScope(jjtn002); - jjtc002 = false; - } else { - jjtree.popNode(); - } - if (jjte002 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte002;} - } - if (jjte002 instanceof ParseException) { - {if (true) throw (ParseException)jjte002;} - } - {if (true) throw (Error)jjte002;} - } finally { -if (jjtc002) { - jjtree.closeNodeScope(jjtn002, true); - jjtn002.jjtSetLastToken(getToken(0)); - } - } - break; - } - default: - jj_la1[91] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -} - - final public void Arguments() throws ParseException {/*@bgen(jjtree) FunctionCallParameters */ - ASTFunctionCallParameters jjtn000 = new ASTFunctionCallParameters(JJTFUNCTIONCALLPARAMETERS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INCLUDE: - case INPUT: - case OUTPUT: - case APPLY: - case TO: - case CALL: - case CONDITION: - case BEGIN: - case BEFORE: - case AFTER: - case AROUND: - case REPLACE: - case CHECK: - case END: - case DELETE: - case ELSE: - case FOR: - case FUNCTION: - case FUNCTION_GEN: - case IF: - case IN: - case NEW: - case RETURN: - case YIELD: - case THIS: - case TYPEOF: - case VAR: - case VOID: - case WHILE: - case CASE: - case CLASS: - case _DEFAULT: - case DO: - case SWITCH: - case LBRACE: - case LPAREN: - case LBRACKET: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case INTANCE_OF: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - if (jj_2_38(2147483647)) { - NamedArgumentList(); -jjtn000.areNamed = true; - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE: - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case TYPEOF: - case VOID: - case LBRACE: - case LPAREN: - case LBRACKET: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - ArgumentList(); - break; - } - default: - jj_la1[92] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - break; - } - default: - jj_la1[93] = jj_gen; - ; - } - jj_consume_token(RPAREN); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void NamedArgumentList() throws ParseException { - NamedArgument(); - label_27: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - ; - break; - } - default: - jj_la1[94] = jj_gen; - break label_27; - } - jj_consume_token(COMMA); - NamedArgument(); - } -} - - final public void NamedArgument() throws ParseException {/*@bgen(jjtree) NamedArgument */ - ASTNamedArgument jjtn000 = new ASTNamedArgument(JJTNAMEDARGUMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token argument; - try { - argument = getNoReservedIdentifier(); -jjtn000.jjtSetValue(argument.image); - jj_consume_token(COLON); - AssignmentExpression(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void ArgumentList() throws ParseException { - AssignmentExpression(); - label_28: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - ; - break; - } - default: - jj_la1[95] = jj_gen; - break label_28; - } - jj_consume_token(COMMA); - AssignmentExpression(); - } -} - - final public void LeftHandSideExpression() throws ParseException { - if (jj_2_39(2147483647)) { - CallExpression(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case LBRACE: - case LPAREN: - case LBRACKET: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - MemberExpression(); - break; - } - default: - jj_la1[96] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } -} - - final public void LeftHandSideExpressionForIn() throws ParseException { - if (jj_2_40(2147483647)) { - CallExpressionForIn(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FUNCTION: - case FUNCTION_GEN: - case THIS: - case LBRACE: - case LPAREN: - case LBRACKET: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - MemberExpressionForIn(); - break; - } - default: - jj_la1[97] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } -} - -/* Section 11.3 Postfix Expressions */ - final public - void PostfixExpression() throws ParseException {/*@bgen(jjtree) #PostfixExpression(> 1) */ - ASTPostfixExpression jjtn000 = new ASTPostfixExpression(JJTPOSTFIXEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - LeftHandSideExpression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INCR: - case DECR:{ - PostfixOperator(); - break; - } - default: - jj_la1[98] = jj_gen; - ; - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void PostfixOperator() throws ParseException {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token op; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INCR:{ - op = jj_consume_token(INCR); - break; - } - case DECR:{ - op = jj_consume_token(DECR); - break; - } - default: - jj_la1[99] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.jjtSetValue(op.image); - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 11.4 Unary Operators */ - final public - void UnaryExpression() throws ParseException {/*@bgen(jjtree) #UnaryExpression(> 1) */ - ASTUnaryExpression jjtn000 = new ASTUnaryExpression(JJTUNARYEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case LBRACE: - case LPAREN: - case LBRACKET: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - PostfixExpression(); - break; - } - case DELETE: - case TYPEOF: - case VOID: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE:{ - UnaryOperator(); - UnaryExpression(); - break; - } - default: - jj_la1[100] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void UnaryOperator() throws ParseException {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token op; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE:{ - op = jj_consume_token(DELETE); - break; - } - case VOID:{ - op = jj_consume_token(VOID); - break; - } - case TYPEOF:{ - op = jj_consume_token(TYPEOF); - break; - } - case INCR:{ - op = jj_consume_token(INCR); - break; - } - case DECR:{ - op = jj_consume_token(DECR); - break; - } - case PLUS:{ - op = jj_consume_token(PLUS); - break; - } - case MINUS:{ - op = jj_consume_token(MINUS); - break; - } - case TILDE:{ - op = jj_consume_token(TILDE); - break; - } - case BANG:{ - op = jj_consume_token(BANG); - break; - } - default: - jj_la1[101] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.jjtSetValue(op.image); - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 11.5: Multiplicative Operators */ - final public - - void MultiplicativeExpression() throws ParseException {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - UnaryExpression(); - label_29: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR: - case REM: - case SLASH:{ - ; - break; - } - default: - jj_la1[102] = jj_gen; - break label_29; - } - MultiplicativeOperator(); - UnaryExpression(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void MultiplicativeOperator() throws ParseException {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token op; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ - op = jj_consume_token(STAR); - break; - } - case SLASH:{ - op = jj_consume_token(SLASH); - break; - } - case REM:{ - op = jj_consume_token(REM); - break; - } - default: - jj_la1[103] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.jjtSetValue(op.image); - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 11.6: Additive Operators */ - final public - void AdditiveExpression() throws ParseException {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - MultiplicativeExpression(); - label_30: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PLUS: - case MINUS:{ - ; - break; - } - default: - jj_la1[104] = jj_gen; - break label_30; - } - AdditiveOperator(); - MultiplicativeExpression(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void AdditiveOperator() throws ParseException {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token op; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PLUS:{ - op = jj_consume_token(PLUS); - break; - } - case MINUS:{ - op = jj_consume_token(MINUS); - break; - } - default: - jj_la1[105] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.jjtSetValue(op.image); - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 11.7: Bitwise Shift Operators */ - final public - void ShiftExpression() throws ParseException {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - AdditiveExpression(); - label_31: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LSHIFT: - case RSHIFT: - case RUNSHIFT:{ - ; - break; - } - default: - jj_la1[106] = jj_gen; - break label_31; - } - ShiftOperator(); - AdditiveExpression(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void ShiftOperator() throws ParseException {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token op; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LSHIFT:{ - op = jj_consume_token(LSHIFT); - break; - } - case RSHIFT:{ - op = jj_consume_token(RSHIFT); - break; - } - case RUNSHIFT:{ - op = jj_consume_token(RUNSHIFT); - break; - } - default: - jj_la1[107] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.jjtSetValue(op.image); - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 11.4: Relational Operators */ - final public - void RelationalExpression() throws ParseException {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - ShiftExpression(); - label_32: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IN: - case LT: - case GT: - case LE: - case GE: - case INTANCE_OF:{ - ; - break; - } - default: - jj_la1[108] = jj_gen; - break label_32; - } - RelationalOperator(); - ShiftExpression(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void RelationalOperator() throws ParseException {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token op; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LT:{ - op = jj_consume_token(LT); - break; - } - case GT:{ - op = jj_consume_token(GT); - break; - } - case LE:{ - op = jj_consume_token(LE); - break; - } - case GE:{ - op = jj_consume_token(GE); - break; - } - case INTANCE_OF:{ - op = jj_consume_token(INTANCE_OF); - break; - } - case IN:{ - op = jj_consume_token(IN); - break; - } - default: - jj_la1[109] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.jjtSetValue(op.image); - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void RelationalExpressionNoIn() throws ParseException {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - ShiftExpression(); - label_33: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LT: - case GT: - case LE: - case GE: - case INTANCE_OF:{ - ; - break; - } - default: - jj_la1[110] = jj_gen; - break label_33; - } - RelationalNoInOperator(); - ShiftExpression(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void RelationalNoInOperator() throws ParseException {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token op; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LT:{ - op = jj_consume_token(LT); - break; - } - case GT:{ - op = jj_consume_token(GT); - break; - } - case LE:{ - op = jj_consume_token(LE); - break; - } - case GE:{ - op = jj_consume_token(GE); - break; - } - case INTANCE_OF:{ - op = jj_consume_token(INTANCE_OF); - break; - } - default: - jj_la1[111] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.jjtSetValue(op.image); - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 11.9: Equality Operators */ - final public - void EqualityExpression() throws ParseException {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - RelationalExpression(); - label_34: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case EQ: - case NE: - case MATCH: - case SEQ: - case SNEQ:{ - ; - break; - } - default: - jj_la1[112] = jj_gen; - break label_34; - } - EqualityOperator(); - RelationalExpression(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void EqualityExpressionNoIn() throws ParseException {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - RelationalExpressionNoIn(); - label_35: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case EQ: - case NE: - case MATCH: - case SEQ: - case SNEQ:{ - ; - break; - } - default: - jj_la1[113] = jj_gen; - break label_35; - } - EqualityOperator(); - RelationalExpressionNoIn(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void EqualityOperator() throws ParseException {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token op; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case EQ:{ - op = jj_consume_token(EQ); - break; - } - case NE:{ - op = jj_consume_token(NE); - break; - } - case SEQ:{ - op = jj_consume_token(SEQ); - break; - } - case SNEQ:{ - op = jj_consume_token(SNEQ); - break; - } - case MATCH:{ - op = jj_consume_token(MATCH); - break; - } - default: - jj_la1[114] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.jjtSetValue(op.image); - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 11.10: Binary Bitwise Operators */ - final public - void BitwiseANDExpression() throws ParseException {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - EqualityExpression(); - label_36: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BIT_AND:{ - ; - break; - } - default: - jj_la1[115] = jj_gen; - break label_36; - } - BitwiseANDOperator(); - EqualityExpression(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void BitwiseANDExpressionNoIn() throws ParseException {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - EqualityExpressionNoIn(); - label_37: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BIT_AND:{ - ; - break; - } - default: - jj_la1[116] = jj_gen; - break label_37; - } - BitwiseANDOperator(); - EqualityExpressionNoIn(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void BitwiseANDOperator() throws ParseException {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token op; - try { - op = jj_consume_token(BIT_AND); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.jjtSetValue(op.image); - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void BitwiseXORExpression() throws ParseException {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - BitwiseANDExpression(); - label_38: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case XOR:{ - ; - break; - } - default: - jj_la1[117] = jj_gen; - break label_38; - } - BitwiseXOROperator(); - BitwiseANDExpression(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void BitwiseXORExpressionNoIn() throws ParseException {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - BitwiseANDExpressionNoIn(); - label_39: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case XOR:{ - ; - break; - } - default: - jj_la1[118] = jj_gen; - break label_39; - } - BitwiseXOROperator(); - BitwiseANDExpressionNoIn(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void BitwiseXOROperator() throws ParseException {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token op; - try { - op = jj_consume_token(XOR); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.jjtSetValue(op.image); - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void BitwiseORExpression() throws ParseException {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - BitwiseXORExpression(); - label_40: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BIT_OR:{ - ; - break; - } - default: - jj_la1[119] = jj_gen; - break label_40; - } - BitwiseOROperator(); - BitwiseXORExpression(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void BitwiseORExpressionNoIn() throws ParseException {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - BitwiseXORExpressionNoIn(); - label_41: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BIT_OR:{ - ; - break; - } - default: - jj_la1[120] = jj_gen; - break label_41; - } - BitwiseOROperator(); - BitwiseXORExpressionNoIn(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void BitwiseOROperator() throws ParseException {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token op; - try { - op = jj_consume_token(BIT_OR); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.jjtSetValue(op.image); - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 11.11: Binary Logical Operators */ - final public - void LogicalANDExpression() throws ParseException {/*@bgen(jjtree) #AndExpressionSequence(> 1) */ - ASTAndExpressionSequence jjtn000 = new ASTAndExpressionSequence(JJTANDEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - BitwiseORExpression(); - label_42: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SC_AND:{ - ; - break; - } - default: - jj_la1[121] = jj_gen; - break label_42; - } - LogicalANDOperator(); - BitwiseORExpression(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void LogicalANDExpressionNoIn() throws ParseException {/*@bgen(jjtree) #AndExpressionSequence(> 1) */ - ASTAndExpressionSequence jjtn000 = new ASTAndExpressionSequence(JJTANDEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - BitwiseORExpressionNoIn(); - label_43: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SC_AND:{ - ; - break; - } - default: - jj_la1[122] = jj_gen; - break label_43; - } - LogicalANDOperator(); - BitwiseORExpressionNoIn(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void LogicalANDOperator() throws ParseException {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token op; - try { - op = jj_consume_token(SC_AND); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.jjtSetValue(op.image); - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void LogicalORExpression() throws ParseException {/*@bgen(jjtree) #OrExpressionSequence(> 1) */ - ASTOrExpressionSequence jjtn000 = new ASTOrExpressionSequence(JJTOREXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - LogicalANDExpression(); - label_44: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SC_OR:{ - ; - break; - } - default: - jj_la1[123] = jj_gen; - break label_44; - } - LogicalOROperator(); - LogicalANDExpression(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void LogicalORExpressionNoIn() throws ParseException {/*@bgen(jjtree) #OrExpressionSequence(> 1) */ - ASTOrExpressionSequence jjtn000 = new ASTOrExpressionSequence(JJTOREXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - LogicalANDExpressionNoIn(); - label_45: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SC_OR:{ - ; - break; - } - default: - jj_la1[124] = jj_gen; - break label_45; - } - LogicalOROperator(); - LogicalANDExpressionNoIn(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void LogicalOROperator() throws ParseException {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token op; - try { - op = jj_consume_token(SC_OR); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.jjtSetValue(op.image); - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 11.12: Conditional Operator */ - final public - void ConditionalExpression() throws ParseException {/*@bgen(jjtree) #ConditionalExpression(> 1) */ - ASTConditionalExpression jjtn000 = new ASTConditionalExpression(JJTCONDITIONALEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - LogicalORExpression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case HOOK:{ - jj_consume_token(HOOK); - AssignmentExpression(); - jj_consume_token(COLON); - AssignmentExpression(); - break; - } - default: - jj_la1[125] = jj_gen; - ; - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void ConditionalExpressionNoIn() throws ParseException {/*@bgen(jjtree) #ConditionalExpression(> 1) */ - ASTConditionalExpression jjtn000 = new ASTConditionalExpression(JJTCONDITIONALEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - LogicalORExpressionNoIn(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case HOOK:{ - jj_consume_token(HOOK); - AssignmentExpression(); - jj_consume_token(COLON); - AssignmentExpressionNoIn(); - break; - } - default: - jj_la1[126] = jj_gen; - ; - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 11.13: Assignment Operators */ - final public - void AssignmentExpression() throws ParseException {/*@bgen(jjtree) #AssignmentExpression(> 1) */ - ASTAssignmentExpression jjtn000 = new ASTAssignmentExpression(JJTASSIGNMENTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - if (jj_2_42(2147483647)) { - LeftHandSideExpression(); - AssignmentOperator(); - if (jj_2_41(2147483647)) { - ActionOnAssign(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE: - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case TYPEOF: - case VOID: - case LBRACE: - case LPAREN: - case LBRACKET: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - AssignmentExpression(); - break; - } - default: - jj_la1[127] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE: - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case TYPEOF: - case VOID: - case LBRACE: - case LPAREN: - case LBRACKET: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - ConditionalExpression(); - break; - } - default: - jj_la1[128] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void AssignmentExpressionNoIn() throws ParseException {/*@bgen(jjtree) #AssignmentExpression(> 1) */ - ASTAssignmentExpression jjtn000 = new ASTAssignmentExpression(JJTASSIGNMENTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - if (jj_2_44(2147483647)) { - LeftHandSideExpression(); - AssignmentOperator(); - if (jj_2_43(2147483647)) { - ActionOnAssign(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE: - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case TYPEOF: - case VOID: - case LBRACE: - case LPAREN: - case LBRACKET: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - AssignmentExpressionNoIn(); - break; - } - default: - jj_la1[129] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE: - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case TYPEOF: - case VOID: - case LBRACE: - case LPAREN: - case LBRACKET: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - ConditionalExpressionNoIn(); - break; - } - default: - jj_la1[130] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void AssignmentOperator() throws ParseException {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token op; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ASSIGN:{ - op = jj_consume_token(ASSIGN); - break; - } - case STARASSIGN:{ - op = jj_consume_token(STARASSIGN); - break; - } - case SLASHASSIGN:{ - op = jj_consume_token(SLASHASSIGN); - break; - } - case REMASSIGN:{ - op = jj_consume_token(REMASSIGN); - break; - } - case PLUSASSIGN:{ - op = jj_consume_token(PLUSASSIGN); - break; - } - case MINUSASSIGN:{ - op = jj_consume_token(MINUSASSIGN); - break; - } - case LSHIFTASSIGN:{ - op = jj_consume_token(LSHIFTASSIGN); - break; - } - case RSIGNEDSHIFTASSIGN:{ - op = jj_consume_token(RSIGNEDSHIFTASSIGN); - break; - } - case RUNSIGNEDSHIFTASSIGN:{ - op = jj_consume_token(RUNSIGNEDSHIFTASSIGN); - break; - } - case ANDASSIGN:{ - op = jj_consume_token(ANDASSIGN); - break; - } - case XORASSIGN:{ - op = jj_consume_token(XORASSIGN); - break; - } - case ORASSIGN:{ - op = jj_consume_token(ORASSIGN); - break; - } - default: - jj_la1[131] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -jjtn000.jjtSetValue(op.image); - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 11.14: Comma Operator */ - final public - void Expression() throws ParseException {/*@bgen(jjtree) #ExpressionList(> 1) */ - ASTExpressionList jjtn000 = new ASTExpressionList(JJTEXPRESSIONLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - AssignmentExpression(); - label_46: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - ; - break; - } - default: - jj_la1[132] = jj_gen; - break label_46; - } - jj_consume_token(COMMA); - AssignmentExpression(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void ExpressionNoIn() throws ParseException { - AssignmentExpressionNoIn(); - label_47: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - ; - break; - } - default: - jj_la1[133] = jj_gen; - break label_47; - } - jj_consume_token(COMMA); - AssignmentExpressionNoIn(); - } -} - -/* Section 12: STATEMENTS */ - final public - void Statement() throws ParseException {{exprBraceCount =0;} - if (jj_2_45(2)) { - BodiedStatement(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CALL: - case RUN: - case CMD: - case INSERT: - case EXEC: - case OUTPUT_ACT: - case REPLACE: - case DEFINE: - case BREAK: - case CONTINUE: - case DELETE: - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case RETURN: - case YIELD: - case THIS: - case TYPEOF: - case VAR: - case VOID: - case IMPORT: - case LBRACE: - case LPAREN: - case LBRACKET: - case SEMICOLON: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - SingleStatement(); - break; - } - default: - jj_la1[134] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } -} - - final public void SingleStatement() throws ParseException { - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INSERT: - case EXEC: - case OUTPUT_ACT: - case REPLACE: - case DEFINE:{ - SimpleAction(); - break; - } - default: - jj_la1[135] = jj_gen; - if (jj_2_46(2147483647)) { - Action(); - } else if (jj_2_47(2147483647)) { - Call(); - } else if (jj_2_48(2147483647)) { - Cmd(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case RUN:{ - Run(); - break; - } - default: - jj_la1[136] = jj_gen; - if (jj_2_49(2147483647)) { - VariableStatement(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ - EmptyStatement(); - break; - } - default: - jj_la1[137] = jj_gen; - if (jj_2_50(2147483647)) { - ExpressionStatement(); - } else if (jj_2_51(2147483647)) { - LabelledStatement(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CONTINUE:{ - ContinueStatement(); - break; - } - case YIELD:{ - YieldStatement(); - break; - } - case BREAK:{ - BreakStatement(); - break; - } - case IMPORT:{ - ImportStatement(); - break; - } - case RETURN:{ - ReturnStatement(); - break; - } - default: - jj_la1[138] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } - } - } - } - } - } catch (ParseException e) { -error_skipto(e,SEMICOLON); - } catch (TokenMgrError error) { -exceptions.add(error); - if (exceptions.size() >= MAXIMUM_SYNTAX_EXCEPTIONS) { - Exception e = new larac.exceptions.LARACompilerException("Lexer problems", error); - error_skipto(new ParseException(error.getMessage()), SEMICOLON); - } - -// error_skipto(new ParseException(e.getMessage()),SEMICOLON); -// Exception e = new larac.exceptions.LARACompilerException("Lexer problems",error); -// exceptions.add(error); -// throw ; - - } -} - - final public void BodiedStatement() throws ParseException { - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LBRACE:{ - Block(); - break; - } - case IF:{ - IfStatement(); - break; - } - case FOR: - case WHILE: - case DO:{ - IterationStatement(); - break; - } - case SWITCH:{ - SwitchStatement(); - break; - } - case WITH:{ - WithStatement(); - break; - } - case THROW:{ - ThrowStatement(); - break; - } - case TRY:{ - TryStatement(); - break; - } - default: - jj_la1[139] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch (ParseException e) { -error_skipto(e,LBRACE); - } -} - -/* 12.1 Block Statement */ - final public - void Block() throws ParseException {/*@bgen(jjtree) Block */ - ASTBlock jjtn000 = new ASTBlock(JJTBLOCK); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin, end; - try { - begin = jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CALL: - case RUN: - case CMD: - case INSERT: - case EXEC: - case OUTPUT_ACT: - case REPLACE: - case DEFINE: - case BREAK: - case CONTINUE: - case DELETE: - case FOR: - case FUNCTION: - case FUNCTION_GEN: - case IF: - case NEW: - case RETURN: - case YIELD: - case THIS: - case TYPEOF: - case VAR: - case VOID: - case WHILE: - case WITH: - case DO: - case IMPORT: - case SWITCH: - case THROW: - case TRY: - case LBRACE: - case LPAREN: - case LBRACKET: - case SEMICOLON: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - StatementList(); - break; - } - default: - jj_la1[140] = jj_gen; - ; - } - end = jj_consume_token(RBRACE); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void StatementList() throws ParseException {/*@bgen(jjtree) #StatementList(> 1) */ - ASTStatementList jjtn000 = new ASTStatementList(JJTSTATEMENTLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - label_48: - while (true) { - Statement(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CALL: - case RUN: - case CMD: - case INSERT: - case EXEC: - case OUTPUT_ACT: - case REPLACE: - case DEFINE: - case BREAK: - case CONTINUE: - case DELETE: - case FOR: - case FUNCTION: - case FUNCTION_GEN: - case IF: - case NEW: - case RETURN: - case YIELD: - case THIS: - case TYPEOF: - case VAR: - case VOID: - case WHILE: - case WITH: - case DO: - case IMPORT: - case SWITCH: - case THROW: - case TRY: - case LBRACE: - case LPAREN: - case LBRACKET: - case SEMICOLON: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - ; - break; - } - default: - jj_la1[141] = jj_gen; - break label_48; - } - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 12.2: Variable statement */ - final public - void VariableStatement() throws ParseException {/*@bgen(jjtree) VariableStatement */ - ASTVariableStatement jjtn000 = new ASTVariableStatement(JJTVARIABLESTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin, end; - try { - begin = jj_consume_token(VAR); - VariableDeclarationList(); - end = EndStatement(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void VariableDeclarationList() throws ParseException {/*@bgen(jjtree) #VariableDeclarationList(> 1) */ - ASTVariableDeclarationList jjtn000 = new ASTVariableDeclarationList(JJTVARIABLEDECLARATIONLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - VariableDeclaration(); - label_49: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - ; - break; - } - default: - jj_la1[142] = jj_gen; - break label_49; - } - jj_consume_token(COMMA); - VariableDeclaration(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void VariableDeclarationListNoIn() throws ParseException {/*@bgen(jjtree) #VariableDeclarationList(> 1) */ - ASTVariableDeclarationList jjtn000 = new ASTVariableDeclarationList(JJTVARIABLEDECLARATIONLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - VariableDeclarationNoIn(); - label_50: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - ; - break; - } - default: - jj_la1[143] = jj_gen; - break label_50; - } - jj_consume_token(COMMA); - VariableDeclarationNoIn(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void VariableDeclaration() throws ParseException {/*@bgen(jjtree) VariableDeclaration */ - ASTVariableDeclaration jjtn000 = new ASTVariableDeclaration(JJTVARIABLEDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token type; - try { - Identifier(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COLON:{ - jj_consume_token(COLON); - type = getNoReservedIdentifier(); -jjtn000.setType(type.image); - break; - } - default: - jj_la1[144] = jj_gen; - ; - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ASSIGN:{ - Initialiser(); - break; - } - default: - jj_la1[145] = jj_gen; - ; - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void VariableDeclarationNoIn() throws ParseException { - Identifier(); -ASTEmptyExpression jjtn001 = new ASTEmptyExpression(JJTEMPTYEXPRESSION); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ASSIGN:{ - InitialiserNoIn(); - break; - } - default: - jj_la1[146] = jj_gen; - ; - } - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree . nodeArity ( ) == 0); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -} - - final public void Initialiser() throws ParseException { - jj_consume_token(ASSIGN); - if (jj_2_52(2147483647)) { - ActionOnAssign(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE: - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case TYPEOF: - case VOID: - case LBRACE: - case LPAREN: - case LBRACKET: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - AssignmentExpression(); - break; - } - default: - jj_la1[147] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } -} - - final public void InitialiserNoIn() throws ParseException { - jj_consume_token(ASSIGN); - AssignmentExpressionNoIn(); -} - -/* Section 12.3: Empty Statement */ - final public - void EmptyStatement() throws ParseException {/*@bgen(jjtree) EmptyStatement */ - ASTEmptyStatement jjtn000 = new ASTEmptyStatement(JJTEMPTYSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(SEMICOLON); - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 12.4: Expression Statement */ - final public - void ExpressionStatement() throws ParseException {/*@bgen(jjtree) ExpressionStatement */ - ASTExpressionStatement jjtn000 = new ASTExpressionStatement(JJTEXPRESSIONSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - Expression(); - EndStatement(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public ASTExpressionStatement ParseExpression() throws ParseException {/*@bgen(jjtree) ExpressionStatement */ - ASTExpressionStatement jjtn000 = new ASTExpressionStatement(JJTEXPRESSIONSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - if (jj_2_53(2147483647)) { - CallExpression(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case LBRACE: - case LPAREN: - case LBRACKET: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - MemberExpression(); - break; - } - default: - jj_la1[148] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - jj_consume_token(0); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); -{if ("" != null) return jjtn000;} - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } - throw new Error("Missing return statement in function"); -} - -/* Section 12.5: The if Statement */ - final public - void IfStatement() throws ParseException {/*@bgen(jjtree) IfStatement */ - ASTIfStatement jjtn000 = new ASTIfStatement(JJTIFSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { - begin = jj_consume_token(IF); - jj_consume_token(LPAREN); - Expression(); - jj_consume_token(RPAREN); - Statement(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ELSE:{ - jj_consume_token(ELSE); - Statement(); - break; - } - default: - jj_la1[149] = jj_gen; - ; - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 12.6: Iteration Statements */ - final public void IterationStatement() throws ParseException {Token begin;Token end; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DO:{ - DoStatement(); - break; - } - case WHILE:{ - WhileStatement(); - break; - } - case FOR:{ - ForStatement(); - break; - } - default: - jj_la1[150] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -} - - final public void DoStatement() throws ParseException {/*@bgen(jjtree) DoStatement */ - ASTDoStatement jjtn000 = new ASTDoStatement(JJTDOSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin, end; - try { - begin = jj_consume_token(DO); - Statement(); - end = jj_consume_token(WHILE); - jj_consume_token(LPAREN); - Expression(); - jj_consume_token(RPAREN); - EndStatement(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void WhileStatement() throws ParseException {/*@bgen(jjtree) WhileStatement */ - ASTWhileStatement jjtn000 = new ASTWhileStatement(JJTWHILESTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { - begin = jj_consume_token(WHILE); - jj_consume_token(LPAREN); - Expression(); - jj_consume_token(RPAREN); - Statement(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void ForStatement() throws ParseException {Token begin;boolean isEach = false; - begin = jj_consume_token(FOR); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case EACH:{ - jj_consume_token(EACH); - jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VAR:{ -ASTForVarInStatement jjtn001 = new ASTForVarInStatement(JJTFORVARINSTATEMENT); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(VAR); - VariableDeclarationNoIn(); - jj_consume_token(IN); - Expression(); - jj_consume_token(RPAREN); - Statement(); -jjtree.closeNodeScope(jjtn001, true); - jjtc001 = false; - jjtn001.jjtSetLastToken(getToken(0)); -jjtn001.setEach(true); - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - break; - } - case FUNCTION: - case FUNCTION_GEN: - case THIS: - case LBRACE: - case LPAREN: - case LBRACKET: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ -ASTForInStatement jjtn002 = new ASTForInStatement(JJTFORINSTATEMENT); - boolean jjtc002 = true; - jjtree.openNodeScope(jjtn002); - jjtn002.jjtSetFirstToken(getToken(1)); - try { - LeftHandSideExpressionForIn(); - jj_consume_token(IN); - Expression(); - jj_consume_token(RPAREN); - Statement(); -jjtree.closeNodeScope(jjtn002, true); - jjtc002 = false; - jjtn002.jjtSetLastToken(getToken(0)); -jjtn002.setEach(true); - } catch (Throwable jjte002) { -if (jjtc002) { - jjtree.clearNodeScope(jjtn002); - jjtc002 = false; - } else { - jjtree.popNode(); - } - if (jjte002 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte002;} - } - if (jjte002 instanceof ParseException) { - {if (true) throw (ParseException)jjte002;} - } - {if (true) throw (Error)jjte002;} - } finally { -if (jjtc002) { - jjtree.closeNodeScope(jjtn002, true); - jjtn002.jjtSetLastToken(getToken(0)); - } - } - break; - } - default: - jj_la1[151] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - break; - } - case LPAREN:{ - jj_consume_token(LPAREN); - if (jj_2_54(2147483647)) { -ASTForStatement jjtn009 = new ASTForStatement(JJTFORSTATEMENT); - boolean jjtc009 = true; - jjtree.openNodeScope(jjtn009); - jjtn009.jjtSetFirstToken(getToken(1)); - try { -ASTEmptyExpression jjtn004 = new ASTEmptyExpression(JJTEMPTYEXPRESSION); - boolean jjtc004 = true; - jjtree.openNodeScope(jjtn004); - jjtn004.jjtSetFirstToken(getToken(1)); - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE: - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case TYPEOF: - case VOID: - case LBRACE: - case LPAREN: - case LBRACKET: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ -ASTPreAssignmentList jjtn003 = new ASTPreAssignmentList(JJTPREASSIGNMENTLIST); - boolean jjtc003 = true; - jjtree.openNodeScope(jjtn003); - jjtn003.jjtSetFirstToken(getToken(1)); - try { - ExpressionNoIn(); - } catch (Throwable jjte003) { -if (jjtc003) { - jjtree.clearNodeScope(jjtn003); - jjtc003 = false; - } else { - jjtree.popNode(); - } - if (jjte003 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte003;} - } - if (jjte003 instanceof ParseException) { - {if (true) throw (ParseException)jjte003;} - } - {if (true) throw (Error)jjte003;} - } finally { -if (jjtc003) { - jjtree.closeNodeScope(jjtn003, true); - jjtn003.jjtSetLastToken(getToken(0)); - } - } - break; - } - default: - jj_la1[152] = jj_gen; - ; - } - } catch (Throwable jjte004) { -if (jjtc004) { - jjtree.clearNodeScope(jjtn004); - jjtc004 = false; - } else { - jjtree.popNode(); - } - if (jjte004 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte004;} - } - if (jjte004 instanceof ParseException) { - {if (true) throw (ParseException)jjte004;} - } - {if (true) throw (Error)jjte004;} - } finally { -if (jjtc004) { - jjtree.closeNodeScope(jjtn004, jjtree . nodeArity ( ) == 0); - jjtn004.jjtSetLastToken(getToken(0)); - } - } - jj_consume_token(SEMICOLON); -ASTEmptyExpression jjtn006 = new ASTEmptyExpression(JJTEMPTYEXPRESSION); - boolean jjtc006 = true; - jjtree.openNodeScope(jjtn006); - jjtn006.jjtSetFirstToken(getToken(1)); - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE: - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case TYPEOF: - case VOID: - case LBRACE: - case LPAREN: - case LBRACKET: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ -ASTForConditionList jjtn005 = new ASTForConditionList(JJTFORCONDITIONLIST); - boolean jjtc005 = true; - jjtree.openNodeScope(jjtn005); - jjtn005.jjtSetFirstToken(getToken(1)); - try { - Expression(); - } catch (Throwable jjte005) { -if (jjtc005) { - jjtree.clearNodeScope(jjtn005); - jjtc005 = false; - } else { - jjtree.popNode(); - } - if (jjte005 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte005;} - } - if (jjte005 instanceof ParseException) { - {if (true) throw (ParseException)jjte005;} - } - {if (true) throw (Error)jjte005;} - } finally { -if (jjtc005) { - jjtree.closeNodeScope(jjtn005, true); - jjtn005.jjtSetLastToken(getToken(0)); - } - } - break; - } - default: - jj_la1[153] = jj_gen; - ; - } - } catch (Throwable jjte006) { -if (jjtc006) { - jjtree.clearNodeScope(jjtn006); - jjtc006 = false; - } else { - jjtree.popNode(); - } - if (jjte006 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte006;} - } - if (jjte006 instanceof ParseException) { - {if (true) throw (ParseException)jjte006;} - } - {if (true) throw (Error)jjte006;} - } finally { -if (jjtc006) { - jjtree.closeNodeScope(jjtn006, jjtree . nodeArity ( ) == 0); - jjtn006.jjtSetLastToken(getToken(0)); - } - } - jj_consume_token(SEMICOLON); -ASTEmptyExpression jjtn008 = new ASTEmptyExpression(JJTEMPTYEXPRESSION); - boolean jjtc008 = true; - jjtree.openNodeScope(jjtn008); - jjtn008.jjtSetFirstToken(getToken(1)); - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE: - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case TYPEOF: - case VOID: - case LBRACE: - case LPAREN: - case LBRACKET: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ -ASTPostAssignmentList jjtn007 = new ASTPostAssignmentList(JJTPOSTASSIGNMENTLIST); - boolean jjtc007 = true; - jjtree.openNodeScope(jjtn007); - jjtn007.jjtSetFirstToken(getToken(1)); - try { - Expression(); - } catch (Throwable jjte007) { -if (jjtc007) { - jjtree.clearNodeScope(jjtn007); - jjtc007 = false; - } else { - jjtree.popNode(); - } - if (jjte007 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte007;} - } - if (jjte007 instanceof ParseException) { - {if (true) throw (ParseException)jjte007;} - } - {if (true) throw (Error)jjte007;} - } finally { -if (jjtc007) { - jjtree.closeNodeScope(jjtn007, true); - jjtn007.jjtSetLastToken(getToken(0)); - } - } - break; - } - default: - jj_la1[154] = jj_gen; - ; - } - } catch (Throwable jjte008) { -if (jjtc008) { - jjtree.clearNodeScope(jjtn008); - jjtc008 = false; - } else { - jjtree.popNode(); - } - if (jjte008 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte008;} - } - if (jjte008 instanceof ParseException) { - {if (true) throw (ParseException)jjte008;} - } - {if (true) throw (Error)jjte008;} - } finally { -if (jjtc008) { - jjtree.closeNodeScope(jjtn008, jjtree . nodeArity ( ) == 0); - jjtn008.jjtSetLastToken(getToken(0)); - } - } - jj_consume_token(RPAREN); - Statement(); - } catch (Throwable jjte009) { -if (jjtc009) { - jjtree.clearNodeScope(jjtn009); - jjtc009 = false; - } else { - jjtree.popNode(); - } - if (jjte009 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte009;} - } - if (jjte009 instanceof ParseException) { - {if (true) throw (ParseException)jjte009;} - } - {if (true) throw (Error)jjte009;} - } finally { -if (jjtc009) { - jjtree.closeNodeScope(jjtn009, true); - jjtn009.jjtSetLastToken(getToken(0)); - } - } - } else if (jj_2_55(2147483647)) { -ASTForVarStatement jjtn015 = new ASTForVarStatement(JJTFORVARSTATEMENT); - boolean jjtc015 = true; - jjtree.openNodeScope(jjtn015); - jjtn015.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(VAR); -ASTPreAssignmentList jjtn010 = new ASTPreAssignmentList(JJTPREASSIGNMENTLIST); - boolean jjtc010 = true; - jjtree.openNodeScope(jjtn010); - jjtn010.jjtSetFirstToken(getToken(1)); - try { - VariableDeclarationList(); - } catch (Throwable jjte010) { -if (jjtc010) { - jjtree.clearNodeScope(jjtn010); - jjtc010 = false; - } else { - jjtree.popNode(); - } - if (jjte010 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte010;} - } - if (jjte010 instanceof ParseException) { - {if (true) throw (ParseException)jjte010;} - } - {if (true) throw (Error)jjte010;} - } finally { -if (jjtc010) { - jjtree.closeNodeScope(jjtn010, true); - jjtn010.jjtSetLastToken(getToken(0)); - } - } - jj_consume_token(SEMICOLON); -ASTEmptyExpression jjtn012 = new ASTEmptyExpression(JJTEMPTYEXPRESSION); - boolean jjtc012 = true; - jjtree.openNodeScope(jjtn012); - jjtn012.jjtSetFirstToken(getToken(1)); - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE: - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case TYPEOF: - case VOID: - case LBRACE: - case LPAREN: - case LBRACKET: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ -ASTForConditionList jjtn011 = new ASTForConditionList(JJTFORCONDITIONLIST); - boolean jjtc011 = true; - jjtree.openNodeScope(jjtn011); - jjtn011.jjtSetFirstToken(getToken(1)); - try { - Expression(); - } catch (Throwable jjte011) { -if (jjtc011) { - jjtree.clearNodeScope(jjtn011); - jjtc011 = false; - } else { - jjtree.popNode(); - } - if (jjte011 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte011;} - } - if (jjte011 instanceof ParseException) { - {if (true) throw (ParseException)jjte011;} - } - {if (true) throw (Error)jjte011;} - } finally { -if (jjtc011) { - jjtree.closeNodeScope(jjtn011, true); - jjtn011.jjtSetLastToken(getToken(0)); - } - } - break; - } - default: - jj_la1[155] = jj_gen; - ; - } - } catch (Throwable jjte012) { -if (jjtc012) { - jjtree.clearNodeScope(jjtn012); - jjtc012 = false; - } else { - jjtree.popNode(); - } - if (jjte012 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte012;} - } - if (jjte012 instanceof ParseException) { - {if (true) throw (ParseException)jjte012;} - } - {if (true) throw (Error)jjte012;} - } finally { -if (jjtc012) { - jjtree.closeNodeScope(jjtn012, jjtree . nodeArity ( ) == 0); - jjtn012.jjtSetLastToken(getToken(0)); - } - } - jj_consume_token(SEMICOLON); -ASTEmptyExpression jjtn014 = new ASTEmptyExpression(JJTEMPTYEXPRESSION); - boolean jjtc014 = true; - jjtree.openNodeScope(jjtn014); - jjtn014.jjtSetFirstToken(getToken(1)); - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE: - case FUNCTION: - case FUNCTION_GEN: - case NEW: - case THIS: - case TYPEOF: - case VOID: - case LBRACE: - case LPAREN: - case LBRACKET: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ -ASTPostAssignmentList jjtn013 = new ASTPostAssignmentList(JJTPOSTASSIGNMENTLIST); - boolean jjtc013 = true; - jjtree.openNodeScope(jjtn013); - jjtn013.jjtSetFirstToken(getToken(1)); - try { - Expression(); - } catch (Throwable jjte013) { -if (jjtc013) { - jjtree.clearNodeScope(jjtn013); - jjtc013 = false; - } else { - jjtree.popNode(); - } - if (jjte013 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte013;} - } - if (jjte013 instanceof ParseException) { - {if (true) throw (ParseException)jjte013;} - } - {if (true) throw (Error)jjte013;} - } finally { -if (jjtc013) { - jjtree.closeNodeScope(jjtn013, true); - jjtn013.jjtSetLastToken(getToken(0)); - } - } - break; - } - default: - jj_la1[156] = jj_gen; - ; - } - } catch (Throwable jjte014) { -if (jjtc014) { - jjtree.clearNodeScope(jjtn014); - jjtc014 = false; - } else { - jjtree.popNode(); - } - if (jjte014 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte014;} - } - if (jjte014 instanceof ParseException) { - {if (true) throw (ParseException)jjte014;} - } - {if (true) throw (Error)jjte014;} - } finally { -if (jjtc014) { - jjtree.closeNodeScope(jjtn014, jjtree . nodeArity ( ) == 0); - jjtn014.jjtSetLastToken(getToken(0)); - } - } - jj_consume_token(RPAREN); - Statement(); - } catch (Throwable jjte015) { -if (jjtc015) { - jjtree.clearNodeScope(jjtn015); - jjtc015 = false; - } else { - jjtree.popNode(); - } - if (jjte015 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte015;} - } - if (jjte015 instanceof ParseException) { - {if (true) throw (ParseException)jjte015;} - } - {if (true) throw (Error)jjte015;} - } finally { -if (jjtc015) { - jjtree.closeNodeScope(jjtn015, true); - jjtn015.jjtSetLastToken(getToken(0)); - } - } - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VAR:{ -ASTForVarInStatement jjtn016 = new ASTForVarInStatement(JJTFORVARINSTATEMENT); - boolean jjtc016 = true; - jjtree.openNodeScope(jjtn016); - jjtn016.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(VAR); - VariableDeclarationNoIn(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IN:{ - jj_consume_token(IN); - break; - } - case OF:{ - jj_consume_token(OF); -isEach = true; - break; - } - default: - jj_la1[157] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - Expression(); - jj_consume_token(RPAREN); - Statement(); -jjtree.closeNodeScope(jjtn016, true); - jjtc016 = false; - jjtn016.jjtSetLastToken(getToken(0)); -jjtn016.setEach(isEach); - } catch (Throwable jjte016) { -if (jjtc016) { - jjtree.clearNodeScope(jjtn016); - jjtc016 = false; - } else { - jjtree.popNode(); - } - if (jjte016 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte016;} - } - if (jjte016 instanceof ParseException) { - {if (true) throw (ParseException)jjte016;} - } - {if (true) throw (Error)jjte016;} - } finally { -if (jjtc016) { - jjtree.closeNodeScope(jjtn016, true); - jjtn016.jjtSetLastToken(getToken(0)); - } - } - break; - } - case FUNCTION: - case FUNCTION_GEN: - case THIS: - case LBRACE: - case LPAREN: - case LBRACKET: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ -ASTForInStatement jjtn017 = new ASTForInStatement(JJTFORINSTATEMENT); - boolean jjtc017 = true; - jjtree.openNodeScope(jjtn017); - jjtn017.jjtSetFirstToken(getToken(1)); - try { - LeftHandSideExpressionForIn(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IN:{ - jj_consume_token(IN); - break; - } - case OF:{ - jj_consume_token(OF); -isEach = true; - break; - } - default: - jj_la1[158] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - Expression(); - jj_consume_token(RPAREN); - Statement(); -jjtree.closeNodeScope(jjtn017, true); - jjtc017 = false; - jjtn017.jjtSetLastToken(getToken(0)); -jjtn017.setEach(isEach); - } catch (Throwable jjte017) { -if (jjtc017) { - jjtree.clearNodeScope(jjtn017); - jjtc017 = false; - } else { - jjtree.popNode(); - } - if (jjte017 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte017;} - } - if (jjte017 instanceof ParseException) { - {if (true) throw (ParseException)jjte017;} - } - {if (true) throw (Error)jjte017;} - } finally { -if (jjtc017) { - jjtree.closeNodeScope(jjtn017, true); - jjtn017.jjtSetLastToken(getToken(0)); - } - } - break; - } - default: - jj_la1[159] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - break; - } - default: - jj_la1[160] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -} - -/* Section 12.7: The continue Statement */ - final public - void ContinueStatement() throws ParseException {/*@bgen(jjtree) ContinueStatement */ - ASTContinueStatement jjtn000 = new ASTContinueStatement(JJTCONTINUESTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { - begin = jj_consume_token(CONTINUE); - if (jj_2_56(2147483647)) { - LabelIdentifier(); - } else { - ; - } - EndStatement(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 12.8: The break Statement */ - final public - void BreakStatement() throws ParseException {/*@bgen(jjtree) BreakStatement */ - ASTBreakStatement jjtn000 = new ASTBreakStatement(JJTBREAKSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { - begin = jj_consume_token(BREAK); - if (jj_2_57(2147483647)) { - LabelIdentifier(); - } else { - ; - } - EndStatement(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 12.9 The return Statement */ - final public - void ReturnStatement() throws ParseException {/*@bgen(jjtree) ReturnStatement */ - ASTReturnStatement jjtn000 = new ASTReturnStatement(JJTRETURNSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(RETURN); -ASTEmptyExpression jjtn001 = new ASTEmptyExpression(JJTEMPTYEXPRESSION); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - if (jj_2_58(2147483647)) { - Expression(); - } else { - ; - } - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree . nodeArity ( ) == 0); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - EndStatement(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Custom */ - final public void YieldStatement() throws ParseException {/*@bgen(jjtree) YieldStatement */ - ASTYieldStatement jjtn000 = new ASTYieldStatement(JJTYIELDSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { - begin = jj_consume_token(YIELD); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ - YieldStar(); - break; - } - default: - jj_la1[161] = jj_gen; - ; - } -ASTEmptyExpression jjtn001 = new ASTEmptyExpression(JJTEMPTYEXPRESSION); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - if (jj_2_59(2147483647)) { - Expression(); - } else { - ; - } - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree . nodeArity ( ) == 0); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - EndStatement(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void YieldStar() throws ParseException {/*@bgen(jjtree) YieldStar */ - ASTYieldStar jjtn000 = new ASTYieldStar(JJTYIELDSTAR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(STAR); - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 12.10: The with Statement */ - final public - void WithStatement() throws ParseException {/*@bgen(jjtree) WithStatement */ - ASTWithStatement jjtn000 = new ASTWithStatement(JJTWITHSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(WITH); - jj_consume_token(LPAREN); - Expression(); - jj_consume_token(RPAREN); - Statement(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* 12.11 The switch Statement */ - final public - void SwitchStatement() throws ParseException {/*@bgen(jjtree) SwitchStatement */ - ASTSwitchStatement jjtn000 = new ASTSwitchStatement(JJTSWITCHSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { - begin = jj_consume_token(SWITCH); - jj_consume_token(LPAREN); - Expression(); - jj_consume_token(RPAREN); - CaseBlock(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void CaseBlock() throws ParseException {/*@bgen(jjtree) CaseGroups */ - ASTCaseGroups jjtn000 = new ASTCaseGroups(JJTCASEGROUPS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin,end; - try { - begin = jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CASE:{ - CaseClauses(); - break; - } - default: - jj_la1[162] = jj_gen; - ; - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case RBRACE:{ - end = jj_consume_token(RBRACE); - break; - } - case _DEFAULT:{ - DefaultClause(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CASE:{ - CaseClauses(); - break; - } - default: - jj_la1[163] = jj_gen; - ; - } - end = jj_consume_token(RBRACE); - break; - } - default: - jj_la1[164] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void CaseClauses() throws ParseException { - label_51: - while (true) { - CaseClause(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CASE:{ - ; - break; - } - default: - jj_la1[165] = jj_gen; - break label_51; - } - } -} - - final public void CaseClause() throws ParseException {/*@bgen(jjtree) CaseGroup */ - ASTCaseGroup jjtn000 = new ASTCaseGroup(JJTCASEGROUP); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { -ASTCaseGuard jjtn001 = new ASTCaseGuard(JJTCASEGUARD); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - begin = jj_consume_token(CASE); - Expression(); - jj_consume_token(COLON); - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CALL: - case RUN: - case CMD: - case INSERT: - case EXEC: - case OUTPUT_ACT: - case REPLACE: - case DEFINE: - case BREAK: - case CONTINUE: - case DELETE: - case FOR: - case FUNCTION: - case FUNCTION_GEN: - case IF: - case NEW: - case RETURN: - case YIELD: - case THIS: - case TYPEOF: - case VAR: - case VOID: - case WHILE: - case WITH: - case DO: - case IMPORT: - case SWITCH: - case THROW: - case TRY: - case LBRACE: - case LPAREN: - case LBRACKET: - case SEMICOLON: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - StatementList(); - break; - } - default: - jj_la1[166] = jj_gen; - ; - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void DefaultClause() throws ParseException {/*@bgen(jjtree) CaseGroup */ - ASTCaseGroup jjtn000 = new ASTCaseGroup(JJTCASEGROUP); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { -ASTCaseGuard jjtn001 = new ASTCaseGuard(JJTCASEGUARD); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - begin = jj_consume_token(_DEFAULT); - jj_consume_token(COLON); - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CALL: - case RUN: - case CMD: - case INSERT: - case EXEC: - case OUTPUT_ACT: - case REPLACE: - case DEFINE: - case BREAK: - case CONTINUE: - case DELETE: - case FOR: - case FUNCTION: - case FUNCTION_GEN: - case IF: - case NEW: - case RETURN: - case YIELD: - case THIS: - case TYPEOF: - case VAR: - case VOID: - case WHILE: - case WITH: - case DO: - case IMPORT: - case SWITCH: - case THROW: - case TRY: - case LBRACE: - case LPAREN: - case LBRACKET: - case SEMICOLON: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - StatementList(); - break; - } - default: - jj_la1[167] = jj_gen; - ; - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 12.12: Labelled Statements */ - final public - void LabelledStatement() throws ParseException {/*@bgen(jjtree) LabelledStatement */ - ASTLabelledStatement jjtn000 = new ASTLabelledStatement(JJTLABELLEDSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - Identifier(); - jj_consume_token(COLON); - Statement(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void ThrowStatement() throws ParseException {/*@bgen(jjtree) ThrowStatement */ - ASTThrowStatement jjtn000 = new ASTThrowStatement(JJTTHROWSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { - begin = jj_consume_token(THROW); - Expression(); - EndStatement(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void TryStatement() throws ParseException {/*@bgen(jjtree) TryStatement */ - ASTTryStatement jjtn000 = new ASTTryStatement(JJTTRYSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { - begin = jj_consume_token(TRY); - Block(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FINALLY:{ - Finally(); - break; - } - case CATCH:{ - Catch(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FINALLY:{ - Finally(); - break; - } - default: - jj_la1[168] = jj_gen; - ; - } - break; - } - default: - jj_la1[169] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void Catch() throws ParseException {/*@bgen(jjtree) CatchClause */ - ASTCatchClause jjtn000 = new ASTCatchClause(JJTCATCHCLAUSE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { - begin = jj_consume_token(CATCH); - jj_consume_token(LPAREN); - Identifier(); - jj_consume_token(RPAREN); - Block(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void Finally() throws ParseException {/*@bgen(jjtree) FinallyClause */ - ASTFinallyClause jjtn000 = new ASTFinallyClause(JJTFINALLYCLAUSE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { - begin = jj_consume_token(FINALLY); - Block(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 13: Function Definition */ - final public - void FunctionDeclaration() throws ParseException {/*@bgen(jjtree) FunctionDeclaration */ - ASTFunctionDeclaration jjtn000 = new ASTFunctionDeclaration(JJTFUNCTIONDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { - begin = jj_consume_token(FUNCTION); - Identifier(); -ASTFormalParameterList jjtn001 = new ASTFormalParameterList(JJTFORMALPARAMETERLIST); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ - FormalParameterList(); - break; - } - default: - jj_la1[170] = jj_gen; - ; - } - jj_consume_token(RPAREN); - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - FunctionBody(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void GeneratorFunctionDeclaration() throws ParseException {/*@bgen(jjtree) GeneratorFunctionDeclaration */ - ASTGeneratorFunctionDeclaration jjtn000 = new ASTGeneratorFunctionDeclaration(JJTGENERATORFUNCTIONDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { - begin = jj_consume_token(FUNCTION_GEN); - Identifier(); -ASTFormalParameterList jjtn001 = new ASTFormalParameterList(JJTFORMALPARAMETERLIST); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ - FormalParameterList(); - break; - } - default: - jj_la1[171] = jj_gen; - ; - } - jj_consume_token(RPAREN); - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - FunctionBody(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void ArrowFunctionBody() throws ParseException {/*@bgen(jjtree) Block */ - ASTBlock jjtn000 = new ASTBlock(JJTBLOCK); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(LBRACE); - label_52: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CALL: - case RUN: - case CMD: - case INSERT: - case EXEC: - case OUTPUT_ACT: - case REPLACE: - case DEFINE: - case BREAK: - case CONTINUE: - case DELETE: - case FOR: - case FUNCTION: - case FUNCTION_GEN: - case IF: - case NEW: - case RETURN: - case YIELD: - case THIS: - case TYPEOF: - case VAR: - case VOID: - case WHILE: - case WITH: - case DO: - case IMPORT: - case SWITCH: - case THROW: - case TRY: - case LBRACE: - case LPAREN: - case LBRACKET: - case SEMICOLON: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - ; - break; - } - default: - jj_la1[172] = jj_gen; - break label_52; - } - Statement(); - } - jj_consume_token(RBRACE); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void ArrowFunctionExpression() throws ParseException {/*@bgen(jjtree) ArrowFunctionExpression */ - ASTArrowFunctionExpression jjtn000 = new ASTArrowFunctionExpression(JJTARROWFUNCTIONEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { -ASTFormalParameterList jjtn001 = new ASTFormalParameterList(JJTFORMALPARAMETERLIST); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ - jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ - FormalParameterList(); - break; - } - default: - jj_la1[173] = jj_gen; - ; - } - jj_consume_token(RPAREN); - break; - } - case IDENTIFIER_NAME:{ - Identifier(); - break; - } - default: - jj_la1[174] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - jj_consume_token(ARROW); - if (jj_2_60(2147483647)) { - ArrowFunctionBody(); - } else if (jj_2_61(2147483647)) { - ExpressionNoIn(); - } else { - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void FunctionExpression() throws ParseException {/*@bgen(jjtree) FunctionExpression */ - ASTFunctionExpression jjtn000 = new ASTFunctionExpression(JJTFUNCTIONEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { - begin = jj_consume_token(FUNCTION); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ - Identifier(); - break; - } - default: - jj_la1[175] = jj_gen; - ; - } -ASTFormalParameterList jjtn001 = new ASTFormalParameterList(JJTFORMALPARAMETERLIST); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ - FormalParameterList(); - break; - } - default: - jj_la1[176] = jj_gen; - ; - } - jj_consume_token(RPAREN); - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - FunctionBody(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void GeneratorFunctionExpression() throws ParseException {/*@bgen(jjtree) GeneratorFunctionExpression */ - ASTGeneratorFunctionExpression jjtn000 = new ASTGeneratorFunctionExpression(JJTGENERATORFUNCTIONEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1));Token begin; - try { - begin = jj_consume_token(FUNCTION_GEN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ - Identifier(); - break; - } - default: - jj_la1[177] = jj_gen; - ; - } -ASTFormalParameterList jjtn001 = new ASTFormalParameterList(JJTFORMALPARAMETERLIST); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IDENTIFIER_NAME:{ - FormalParameterList(); - break; - } - default: - jj_la1[178] = jj_gen; - ; - } - jj_consume_token(RPAREN); - } catch (Throwable jjte001) { -if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte001;} - } - if (jjte001 instanceof ParseException) { - {if (true) throw (ParseException)jjte001;} - } - {if (true) throw (Error)jjte001;} - } finally { -if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } - FunctionBody(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void FormalParameterList() throws ParseException { - Identifier(); - label_53: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - ; - break; - } - default: - jj_la1[179] = jj_gen; - break label_53; - } - jj_consume_token(COMMA); - Identifier(); - } -} - - final public void FunctionBody() throws ParseException {/*@bgen(jjtree) Block */ - ASTBlock jjtn000 = new ASTBlock(JJTBLOCK); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CALL: - case RUN: - case CMD: - case INSERT: - case EXEC: - case OUTPUT_ACT: - case REPLACE: - case DEFINE: - case BREAK: - case CONTINUE: - case DELETE: - case FOR: - case FUNCTION: - case FUNCTION_GEN: - case IF: - case NEW: - case RETURN: - case YIELD: - case THIS: - case TYPEOF: - case VAR: - case VOID: - case WHILE: - case WITH: - case DO: - case IMPORT: - case SWITCH: - case THROW: - case TRY: - case LBRACE: - case LPAREN: - case LBRACKET: - case SEMICOLON: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - SourceElements(); - break; - } - default: - jj_la1[180] = jj_gen; - ; - } - jj_consume_token(RBRACE); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - -/* Section 14: Program * - - ASTProgram Program() #Program : - {} - { - JavaScript() - - { return jjtThis; } - } - /**/ - final public - void JavaScript() throws ParseException {/*@bgen(jjtree) JavaScript */ - ASTJavaScript jjtn000 = new ASTJavaScript(JJTJAVASCRIPT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CALL: - case RUN: - case CMD: - case INSERT: - case EXEC: - case OUTPUT_ACT: - case REPLACE: - case DEFINE: - case BREAK: - case CONTINUE: - case DELETE: - case FOR: - case FUNCTION: - case FUNCTION_GEN: - case IF: - case NEW: - case RETURN: - case YIELD: - case THIS: - case TYPEOF: - case VAR: - case VOID: - case WHILE: - case WITH: - case DO: - case IMPORT: - case SWITCH: - case THROW: - case TRY: - case LBRACE: - case LPAREN: - case LBRACKET: - case SEMICOLON: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - SourceElements(); - break; - } - default: - jj_la1[181] = jj_gen; - ; - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void SourceElements() throws ParseException { - label_54: - while (true) { - SourceElement(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CALL: - case RUN: - case CMD: - case INSERT: - case EXEC: - case OUTPUT_ACT: - case REPLACE: - case DEFINE: - case BREAK: - case CONTINUE: - case DELETE: - case FOR: - case FUNCTION: - case FUNCTION_GEN: - case IF: - case NEW: - case RETURN: - case YIELD: - case THIS: - case TYPEOF: - case VAR: - case VOID: - case WHILE: - case WITH: - case DO: - case IMPORT: - case SWITCH: - case THROW: - case TRY: - case LBRACE: - case LPAREN: - case LBRACKET: - case SEMICOLON: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - ; - break; - } - default: - jj_la1[182] = jj_gen; - break label_54; - } - } -} - - final public void SourceElement() throws ParseException { - if (jj_2_62(2147483647)) { - GeneratorFunctionDeclaration(); - } else if (jj_2_63(2147483647)) { - FunctionDeclaration(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CALL: - case RUN: - case CMD: - case INSERT: - case EXEC: - case OUTPUT_ACT: - case REPLACE: - case DEFINE: - case BREAK: - case CONTINUE: - case DELETE: - case FOR: - case FUNCTION: - case FUNCTION_GEN: - case IF: - case NEW: - case RETURN: - case YIELD: - case THIS: - case TYPEOF: - case VAR: - case VOID: - case WHILE: - case WITH: - case DO: - case IMPORT: - case SWITCH: - case THROW: - case TRY: - case LBRACE: - case LPAREN: - case LBRACKET: - case SEMICOLON: - case PLUS: - case MINUS: - case INCR: - case DECR: - case BANG: - case TILDE: - case DECIMAL_LITERAL: - case HEX_INTEGER_LITERAL: - case NULL_LITERAL: - case BOOLEAN_LITERAL: - case STRING_LITERAL: - case CODE_LITERAL: - case IDENTIFIER_NAME: - case REGULAR_EXPRESSION_LITERAL:{ - Statement(); - break; - } - default: - jj_la1[183] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } -} - -/* - * Grammar for parsing JScript .NET contructs: ( import System; var contents : - * String = reader.ReadToEnd(); ) Refer: src/hostenv_jsc.js - */ - final public - void ImportStatement() throws ParseException { - jj_consume_token(IMPORT); - Name(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ - jj_consume_token(DOT); - jj_consume_token(STAR); - break; - } - default: - jj_la1[184] = jj_gen; - ; - } - EndStatement(); -} - - final public void Name() throws ParseException { - jj_consume_token(IDENTIFIER_NAME); - label_55: - while (true) { - if (jj_2_64(2)) { - ; - } else { - break label_55; - } - jj_consume_token(DOT); - jj_consume_token(IDENTIFIER_NAME); - } -} - - final public void JScriptVarStatement() throws ParseException {/*@bgen(jjtree) VariableStatement */ - ASTVariableStatement jjtn000 = new ASTVariableStatement(JJTVARIABLESTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - jj_consume_token(VAR); - JScriptVarDeclarationList(); - EndStatement(); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void JScriptVarDeclarationList() throws ParseException {/*@bgen(jjtree) #VariableDeclarationList(> 1) */ - ASTVariableDeclarationList jjtn000 = new ASTVariableDeclarationList(JJTVARIABLEDECLARATIONLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - JScriptVarDeclaration(); - label_56: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - ; - break; - } - default: - jj_la1[185] = jj_gen; - break label_56; - } - jj_consume_token(COMMA); - JScriptVarDeclaration(); - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public void JScriptVarDeclaration() throws ParseException {/*@bgen(jjtree) VariableDeclaration */ - ASTVariableDeclaration jjtn000 = new ASTVariableDeclaration(JJTVARIABLEDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); - try { - Identifier(); - jj_consume_token(COLON); - jj_consume_token(IDENTIFIER_NAME); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ASSIGN:{ - Initialiser(); - break; - } - default: - jj_la1[186] = jj_gen; - ; - } - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -} - - final public Token EndStatement() throws ParseException {Token end; - try { - end = jj_consume_token(SEMICOLON); -{if ("" != null) return end;} - } catch (ParseException e) { -if(e.expectedTokenSet.size() > MAX_EXCEPTION_TOKEN_SIZE - || (e.expectedTokenSet.size() == 1 && e.expectedTokenSet.get(0).equals(";"))){ - - Token foundToken = getToken(1); - String line = "at line " + e.currentToken.beginLine + ", column " + e.currentToken.beginColumn; - String message = line+": did you forget a ';'?"; - if (foundToken != null){ - message+=" (possible errant token: "+ foundToken + ")"; - } - e = new ParseException(message); - SimpleNode currNode = getCurrentNode(); - exceptions.add(e); - ParseExceptionData excData = new ParseExceptionData(e); - if (currNode != null){ - currNode.setExceptionData(excData); - } - }else{ - error_skipto(e, SEMICOLON); - } - - // - - } -{if ("" != null) return new Token(SEMICOLON);} - throw new Error("Missing return statement in function"); -} - - void error_skipto(ParseException e, int kind) throws ParseException {// ParseException e = generateParseException(); // generate the exception object. -// System.out.println(e.toString()); // print the error message - exceptions.add(e); - SimpleNode currNode = getCurrentNode(); - ParseExceptionData excData = new ParseExceptionData(e); - excData.setSkippedToToken(kind); - Token t = null; -// int braceCount = 0; - skipper: do { - Token test = getToken(1); -// System.out.println(exprBraceCount); - if(test == null || test.kind == END) - { -// System.out.println("I'm breaking here with:"+test); - break; - } - switch(test.kind) - { - case RBRACE: - exprBraceCount--; - if(exprBraceCount < 0) - break skipper; - break; - } - - - t = getNextToken(); - - if(t != null) - excData.addSkippedToken(t); -// System.out.println("Skipped: "+t+" token("+test+")"); - } while (t != null && (t.kind != kind && t.kind != EOF)); - // The above loop consumes tokens all the way up to a token of -// "kind". We use a do-while loop rather than a while because the -// current token is the one immediately before the erroneous token -// (in our case the token immediately before what should have been -// "if"/"while". - - if (currNode != null){ - currNode.setExceptionData(excData); - } - if(t == null || t.kind == EOF){ - throw new StopParseException(); - } - } - - void error_noSkip(ParseException e) throws ParseException {System.out.println("--------------NO SKIP-----------------"); -// ParseException e = generateParseException(); // generate the exception object. -// System.out.println(e.toString()); // print the error message - SimpleNode currNode = getCurrentNode(); - ParseExceptionData excData = new ParseExceptionData(e); - if (currNode != null){ - currNode.setExceptionData(excData); - } - } - - private boolean jj_2_1(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_1()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(0, xla); } - } - - private boolean jj_2_2(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_2()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(1, xla); } - } - - private boolean jj_2_3(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_3()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(2, xla); } - } - - private boolean jj_2_4(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_4()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(3, xla); } - } - - private boolean jj_2_5(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_5()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(4, xla); } - } - - private boolean jj_2_6(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_6()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(5, xla); } - } - - private boolean jj_2_7(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_7()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(6, xla); } - } - - private boolean jj_2_8(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_8()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(7, xla); } - } - - private boolean jj_2_9(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_9()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(8, xla); } - } - - private boolean jj_2_10(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_10()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(9, xla); } - } - - private boolean jj_2_11(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_11()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(10, xla); } - } - - private boolean jj_2_12(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_12()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(11, xla); } - } - - private boolean jj_2_13(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_13()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(12, xla); } - } - - private boolean jj_2_14(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_14()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(13, xla); } - } - - private boolean jj_2_15(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_15()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(14, xla); } - } - - private boolean jj_2_16(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_16()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(15, xla); } - } - - private boolean jj_2_17(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_17()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(16, xla); } - } - - private boolean jj_2_18(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_18()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(17, xla); } - } - - private boolean jj_2_19(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_19()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(18, xla); } - } - - private boolean jj_2_20(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_20()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(19, xla); } - } - - private boolean jj_2_21(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_21()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(20, xla); } - } - - private boolean jj_2_22(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_22()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(21, xla); } - } - - private boolean jj_2_23(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_23()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(22, xla); } - } - - private boolean jj_2_24(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_24()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(23, xla); } - } - - private boolean jj_2_25(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_25()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(24, xla); } - } - - private boolean jj_2_26(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_26()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(25, xla); } - } - - private boolean jj_2_27(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_27()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(26, xla); } - } - - private boolean jj_2_28(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_28()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(27, xla); } - } - - private boolean jj_2_29(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_29()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(28, xla); } - } - - private boolean jj_2_30(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_30()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(29, xla); } - } - - private boolean jj_2_31(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_31()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(30, xla); } - } - - private boolean jj_2_32(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_32()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(31, xla); } - } - - private boolean jj_2_33(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_33()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(32, xla); } - } - - private boolean jj_2_34(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_34()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(33, xla); } - } - - private boolean jj_2_35(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_35()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(34, xla); } - } - - private boolean jj_2_36(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_36()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(35, xla); } - } - - private boolean jj_2_37(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_37()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(36, xla); } - } - - private boolean jj_2_38(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_38()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(37, xla); } - } - - private boolean jj_2_39(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_39()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(38, xla); } - } - - private boolean jj_2_40(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_40()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(39, xla); } - } - - private boolean jj_2_41(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_41()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(40, xla); } - } - - private boolean jj_2_42(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_42()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(41, xla); } - } - - private boolean jj_2_43(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_43()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(42, xla); } - } - - private boolean jj_2_44(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_44()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(43, xla); } - } - - private boolean jj_2_45(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_45()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(44, xla); } - } - - private boolean jj_2_46(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_46()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(45, xla); } - } - - private boolean jj_2_47(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_47()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(46, xla); } - } - - private boolean jj_2_48(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_48()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(47, xla); } - } - - private boolean jj_2_49(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_49()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(48, xla); } - } - - private boolean jj_2_50(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_50()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(49, xla); } - } - - private boolean jj_2_51(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_51()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(50, xla); } - } - - private boolean jj_2_52(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_52()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(51, xla); } - } - - private boolean jj_2_53(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_53()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(52, xla); } - } - - private boolean jj_2_54(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_54()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(53, xla); } - } - - private boolean jj_2_55(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_55()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(54, xla); } - } - - private boolean jj_2_56(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_56()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(55, xla); } - } - - private boolean jj_2_57(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_57()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(56, xla); } - } - - private boolean jj_2_58(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_58()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(57, xla); } - } - - private boolean jj_2_59(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_59()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(58, xla); } - } - - private boolean jj_2_60(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_60()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(59, xla); } - } - - private boolean jj_2_61(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_61()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(60, xla); } - } - - private boolean jj_2_62(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_62()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(61, xla); } - } - - private boolean jj_2_63(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_63()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(62, xla); } - } - - private boolean jj_2_64(int xla) - { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_64()); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(63, xla); } - } - - private boolean jj_3R_ForStatement_2931_134_384() - { - if (jj_3R_Expression_2691_17_88()) return true; - return false; - } - - private boolean jj_3R_ForStatement_2930_134_383() - { - if (jj_3R_Expression_2691_17_88()) return true; - return false; - } - - private boolean jj_3R_Elision_2279_18_101() - { - Token xsp; - if (jj_3R_Elision_2278_19_146()) return true; - while (true) { - xsp = jj_scanpos; - if (jj_3R_Elision_2278_19_146()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_Elision_2278_19_146() - { - if (jj_scan_token(COMMA)) return true; - return false; - } - - private boolean jj_3R_ThrowStatement_3045_17_164() - { - if (jj_scan_token(THROW)) return true; - if (jj_3R_Expression_2691_17_88()) return true; - if (jj_3R_EndStatement_3225_17_128()) return true; - return false; - } - - private boolean jj_3R_Elision_2277_17_71() - { - if (jj_scan_token(COMMA)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Elision_2279_18_101()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_ForStatement_2926_134_382() - { - if (jj_3R_Expression_2691_17_88()) return true; - return false; - } - - private boolean jj_3R_ForStatement_2925_134_381() - { - if (jj_3R_Expression_2691_17_88()) return true; - return false; - } - - private boolean jj_3R_LabelledStatement_3039_17_288() - { - if (jj_3R_Identifier_2221_11_57()) return true; - if (jj_scan_token(COLON)) return true; - if (jj_3R_Statement_2709_25_172()) return true; - return false; - } - - private boolean jj_3R_ArrayLiteral_2250_35_281() - { - if (jj_3R_ElementList_2262_17_302()) return true; - return false; - } - - private boolean jj_3R_ElementList_2269_14_336() - { - if (jj_3R_Elision_2277_17_71()) return true; - return false; - } - - private boolean jj_3R_ArrayLiteral_2248_34_280() - { - if (jj_3R_ElisionFirst_2285_17_301()) return true; - return false; - } - - private boolean jj_3R_DefaultClause_3029_17_355() - { - if (jj_scan_token(_DEFAULT)) return true; - if (jj_scan_token(COLON)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_DefaultClause_3029_58_371()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_ElementList_2262_17_302() - { - if (jj_3R_AssignmentExpression_2663_17_72()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_24()) { jj_scanpos = xsp; break; } - } - xsp = jj_scanpos; - if (jj_3R_ElementList_2269_14_336()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3_24() - { - if (jj_3R_Elision_2277_17_71()) return true; - if (jj_3R_AssignmentExpression_2663_17_72()) return true; - return false; - } - - private boolean jj_3R_CaseBlock_3006_36_337() - { - if (jj_3R_CaseClauses_3016_17_354()) return true; - return false; - } - - private boolean jj_3R_CaseClause_3022_17_387() - { - if (jj_scan_token(CASE)) return true; - if (jj_3R_Expression_2691_17_88()) return true; - if (jj_scan_token(COLON)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_CaseClause_3022_68_394()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_CaseClauses_3016_19_370() - { - if (jj_3R_CaseClause_3022_17_387()) return true; - return false; - } - - private boolean jj_3_59() - { - if (jj_3R_Expression_2691_17_88()) return true; - return false; - } - - private boolean jj_3R_CaseClauses_3016_17_354() - { - Token xsp; - if (jj_3R_CaseClauses_3016_19_370()) return true; - while (true) { - xsp = jj_scanpos; - if (jj_3R_CaseClauses_3016_19_370()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_ArrayLiteral_2247_17_252() - { - if (jj_scan_token(LBRACKET)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ArrayLiteral_2248_34_280()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_ArrayLiteral_2250_35_281()) jj_scanpos = xsp; - if (jj_scan_token(RBRACKET)) return true; - return false; - } - - private boolean jj_3R_YieldStatement_2975_50_323() - { - if (jj_3R_Expression_2691_17_88()) return true; - return false; - } - - private boolean jj_3R_CaseBlock_3006_17_304() - { - if (jj_scan_token(LBRACE)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_CaseBlock_3006_36_337()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_scan_token(84)) { - jj_scanpos = xsp; - if (jj_3R_CaseBlock_3008_66_338()) return true; - } - return false; - } - - private boolean jj_3R_SwitchStatement_2999_17_162() - { - if (jj_scan_token(SWITCH)) return true; - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_Expression_2691_17_88()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_CaseBlock_3006_17_304()) return true; - return false; - } - - private boolean jj_3R_LabelIdentifier_2234_11_87() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(152)) { - jj_scanpos = xsp; - if (jj_scan_token(153)) return true; - } - return false; - } - - private boolean jj_3_4() - { - if (jj_3R_Identifier_2221_11_57()) return true; - if (jj_scan_token(DOT)) return true; - return false; - } - - private boolean jj_3R_FilePathNoSTar_1464_11_69() - { - Token xsp; - if (jj_3_4()) return true; - while (true) { - xsp = jj_scanpos; - if (jj_3_4()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_YieldStatement_2975_33_322() - { - if (jj_3R_YieldStar_2982_17_343()) return true; - return false; - } - - private boolean jj_3R_WithStatement_2990_17_163() - { - if (jj_scan_token(WITH)) return true; - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_Expression_2691_17_88()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_Statement_2709_25_172()) return true; - return false; - } - - private boolean jj_3_58() - { - if (jj_3R_Expression_2691_17_88()) return true; - return false; - } - - private boolean jj_3R_ForStatement_2936_65_386() - { - if (jj_scan_token(OF)) return true; - return false; - } - - private boolean jj_3R_ForStatement_2933_68_385() - { - if (jj_scan_token(OF)) return true; - return false; - } - - private boolean jj_3_3() - { - if (jj_3R_Identifier_2221_11_57()) return true; - if (jj_scan_token(DOT)) return true; - return false; - } - - private boolean jj_3R_YieldStar_2982_17_343() - { - if (jj_scan_token(STAR)) return true; - return false; - } - - private boolean jj_3R_Identifier_2221_11_57() - { - if (jj_scan_token(IDENTIFIER_NAME)) return true; - return false; - } - - private boolean jj_3_57() - { - if (jj_3R_LabelIdentifier_2234_11_87()) return true; - return false; - } - - private boolean jj_3R_ReturnStatement_2967_28_327() - { - if (jj_3R_Expression_2691_17_88()) return true; - return false; - } - - private boolean jj_3R_YieldStatement_2975_17_290() - { - if (jj_scan_token(YIELD)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_YieldStatement_2975_33_322()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_YieldStatement_2975_50_323()) jj_scanpos = xsp; - if (jj_3R_EndStatement_3225_17_128()) return true; - return false; - } - - private boolean jj_3R_TemplateLiteral_2208_17_231() - { - if (jj_scan_token(CODE_LITERAL)) return true; - return false; - } - - private boolean jj_3_56() - { - if (jj_3R_LabelIdentifier_2234_11_87()) return true; - return false; - } - - private boolean jj_3R_ForStatement_2924_66_380() - { - if (jj_3R_ExpressionNoIn_2697_17_90()) return true; - return false; - } - - private boolean jj_3R_BreakStatement_2957_32_324() - { - if (jj_3R_LabelIdentifier_2234_11_87()) return true; - return false; - } - - private boolean jj_3_2() - { - if (jj_scan_token(FUNCTION)) return true; - if (jj_3R_Identifier_2221_11_57()) return true; - return false; - } - - private boolean jj_3_1() - { - if (jj_scan_token(FUNCTION_GEN)) return true; - if (jj_3R_Identifier_2221_11_57()) return true; - return false; - } - - private boolean jj_3R_ReturnStatement_2967_17_293() - { - if (jj_scan_token(RETURN)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ReturnStatement_2967_28_327()) jj_scanpos = xsp; - if (jj_3R_EndStatement_3225_17_128()) return true; - return false; - } - - private boolean jj_3R_ContinueStatement_2946_36_321() - { - if (jj_3R_LabelIdentifier_2234_11_87()) return true; - return false; - } - - private boolean jj_3R_TemplateLiteral_2202_11_188() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_TemplateLiteral_2202_11_230()) { - jj_scanpos = xsp; - if (jj_3R_TemplateLiteral_2208_17_231()) return true; - } - return false; - } - - private boolean jj_3R_TemplateLiteral_2202_11_230() - { - if (jj_scan_token(STRING_LITERAL)) return true; - return false; - } - - private boolean jj_3R_BreakStatement_2957_17_291() - { - if (jj_scan_token(BREAK)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_BreakStatement_2957_32_324()) jj_scanpos = xsp; - if (jj_3R_EndStatement_3225_17_128()) return true; - return false; - } - - private boolean jj_3R_Literal_2190_17_216() - { - if (jj_scan_token(CODE_LITERAL)) return true; - return false; - } - - private boolean jj_3R_Literal_2184_17_215() - { - if (jj_scan_token(REGULAR_EXPRESSION_LITERAL)) return true; - return false; - } - - private boolean jj_3_55() - { - if (jj_scan_token(VAR)) return true; - if (jj_3R_VariableDeclarationList_2811_17_86()) return true; - if (jj_scan_token(SEMICOLON)) return true; - return false; - } - - private boolean jj_3R_ForStatement_2936_27_369() - { - if (jj_3R_LeftHandSideExpressionForIn_2420_17_379()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(55)) { - jj_scanpos = xsp; - if (jj_3R_ForStatement_2936_65_386()) return true; - } - if (jj_3R_Expression_2691_17_88()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_Statement_2709_25_172()) return true; - return false; - } - - private boolean jj_3R_ContinueStatement_2946_17_289() - { - if (jj_scan_token(CONTINUE)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ContinueStatement_2946_36_321()) jj_scanpos = xsp; - if (jj_3R_EndStatement_3225_17_128()) return true; - return false; - } - - private boolean jj_3R_Literal_2178_17_214() - { - if (jj_scan_token(NULL_LITERAL)) return true; - return false; - } - - private boolean jj_3R_null_2923_39_85() - { - if (jj_3R_ExpressionNoIn_2697_17_90()) return true; - return false; - } - - private boolean jj_3_54() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_null_2923_39_85()) jj_scanpos = xsp; - if (jj_scan_token(SEMICOLON)) return true; - return false; - } - - private boolean jj_3R_ForStatement_2933_27_368() - { - if (jj_scan_token(VAR)) return true; - if (jj_3R_VariableDeclarationNoIn_2830_17_378()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(55)) { - jj_scanpos = xsp; - if (jj_3R_ForStatement_2933_68_385()) return true; - } - if (jj_3R_Expression_2691_17_88()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_Statement_2709_25_172()) return true; - return false; - } - - private boolean jj_3R_Literal_2172_17_213() - { - if (jj_scan_token(BOOLEAN_LITERAL)) return true; - return false; - } - - private boolean jj_3R_ForStatement_2928_27_367() - { - if (jj_scan_token(VAR)) return true; - if (jj_3R_VariableDeclarationList_2811_17_86()) return true; - if (jj_scan_token(SEMICOLON)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ForStatement_2930_134_383()) jj_scanpos = xsp; - if (jj_scan_token(SEMICOLON)) return true; - xsp = jj_scanpos; - if (jj_3R_ForStatement_2931_134_384()) jj_scanpos = xsp; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_Statement_2709_25_172()) return true; - return false; - } - - private boolean jj_3R_ForStatement_2923_27_366() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ForStatement_2924_66_380()) jj_scanpos = xsp; - if (jj_scan_token(SEMICOLON)) return true; - xsp = jj_scanpos; - if (jj_3R_ForStatement_2925_134_381()) jj_scanpos = xsp; - if (jj_scan_token(SEMICOLON)) return true; - xsp = jj_scanpos; - if (jj_3R_ForStatement_2926_134_382()) jj_scanpos = xsp; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_Statement_2709_25_172()) return true; - return false; - } - - private boolean jj_3R_Literal_2166_17_212() - { - if (jj_scan_token(STRING_LITERAL)) return true; - return false; - } - - private boolean jj_3R_ForStatement_2918_28_365() - { - if (jj_3R_LeftHandSideExpressionForIn_2420_17_379()) return true; - if (jj_scan_token(IN)) return true; - if (jj_3R_Expression_2691_17_88()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_Statement_2709_25_172()) return true; - return false; - } - - private boolean jj_3R_IfStatement_2882_63_303() - { - if (jj_scan_token(ELSE)) return true; - if (jj_3R_Statement_2709_25_172()) return true; - return false; - } - - private boolean jj_3R_Literal_2160_17_211() - { - if (jj_scan_token(HEX_INTEGER_LITERAL)) return true; - return false; - } - - private boolean jj_3R_ForStatement_2915_28_364() - { - if (jj_scan_token(VAR)) return true; - if (jj_3R_VariableDeclarationNoIn_2830_17_378()) return true; - if (jj_scan_token(IN)) return true; - if (jj_3R_Expression_2691_17_88()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_Statement_2709_25_172()) return true; - return false; - } - - private boolean jj_3R_ForStatement_2922_17_256() - { - if (jj_scan_token(LPAREN)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ForStatement_2923_27_366()) { - jj_scanpos = xsp; - if (jj_3R_ForStatement_2928_27_367()) { - jj_scanpos = xsp; - if (jj_3R_ForStatement_2933_27_368()) { - jj_scanpos = xsp; - if (jj_3R_ForStatement_2936_27_369()) return true; - } - } - } - return false; - } - - private boolean jj_3R_Literal_2152_17_180() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Literal_2152_17_210()) { - jj_scanpos = xsp; - if (jj_3R_Literal_2160_17_211()) { - jj_scanpos = xsp; - if (jj_3R_Literal_2166_17_212()) { - jj_scanpos = xsp; - if (jj_3R_Literal_2172_17_213()) { - jj_scanpos = xsp; - if (jj_3R_Literal_2178_17_214()) { - jj_scanpos = xsp; - if (jj_3R_Literal_2184_17_215()) { - jj_scanpos = xsp; - if (jj_3R_Literal_2190_17_216()) return true; - } - } - } - } - } - } - return false; - } - - private boolean jj_3R_Literal_2152_17_210() - { - if (jj_scan_token(DECIMAL_LITERAL)) return true; - return false; - } - - private boolean jj_3R_ForStatement_2914_17_255() - { - if (jj_scan_token(EACH)) return true; - if (jj_scan_token(LPAREN)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ForStatement_2915_28_364()) { - jj_scanpos = xsp; - if (jj_3R_ForStatement_2918_28_365()) return true; - } - return false; - } - - private boolean jj_3R_noReservedIdentifier_1380_11_143() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(153)) { - jj_scanpos = xsp; - if (jj_scan_token(27)) { - jj_scanpos = xsp; - if (jj_scan_token(31)) { - jj_scanpos = xsp; - if (jj_scan_token(43)) { - jj_scanpos = xsp; - if (jj_scan_token(52)) { - jj_scanpos = xsp; - if (jj_scan_token(53)) { - jj_scanpos = xsp; - if (jj_scan_token(63)) { - jj_scanpos = xsp; - if (jj_scan_token(59)) { - jj_scanpos = xsp; - if (jj_scan_token(60)) { - jj_scanpos = xsp; - if (jj_scan_token(54)) { - jj_scanpos = xsp; - if (jj_scan_token(50)) { - jj_scanpos = xsp; - if (jj_scan_token(26)) { - jj_scanpos = xsp; - if (jj_scan_token(55)) { - jj_scanpos = xsp; - if (jj_scan_token(79)) { - jj_scanpos = xsp; - if (jj_scan_token(67)) { - jj_scanpos = xsp; - if (jj_scan_token(21)) { - jj_scanpos = xsp; - if (jj_scan_token(22)) { - jj_scanpos = xsp; - if (jj_scan_token(30)) { - jj_scanpos = xsp; - if (jj_scan_token(72)) { - jj_scanpos = xsp; - if (jj_scan_token(69)) { - jj_scanpos = xsp; - if (jj_scan_token(131)) { - jj_scanpos = xsp; - if (jj_scan_token(35)) { - jj_scanpos = xsp; - if (jj_scan_token(36)) { - jj_scanpos = xsp; - if (jj_scan_token(37)) { - jj_scanpos = xsp; - if (jj_scan_token(51)) { - jj_scanpos = xsp; - if (jj_scan_token(65)) { - jj_scanpos = xsp; - if (jj_scan_token(73)) { - jj_scanpos = xsp; - if (jj_scan_token(18)) { - jj_scanpos = xsp; - if (jj_scan_token(49)) { - jj_scanpos = xsp; - if (jj_scan_token(38)) { - jj_scanpos = xsp; - if (jj_scan_token(40)) { - jj_scanpos = xsp; - if (jj_scan_token(25)) return true; - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - return false; - } - - private boolean jj_3R_ForStatement_2913_11_235() - { - if (jj_scan_token(FOR)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ForStatement_2914_17_255()) { - jj_scanpos = xsp; - if (jj_3R_ForStatement_2922_17_256()) return true; - } - return false; - } - - private boolean jj_3R_VariableDeclaration_2824_99_171() - { - if (jj_3R_Initialiser_2836_17_201()) return true; - return false; - } - - private boolean jj_3R_ParenExpression_2140_11_253() - { - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_Expression_2691_17_88()) return true; - if (jj_scan_token(RPAREN)) return true; - return false; - } - - private boolean jj_3R_WhileStatement_2906_11_234() - { - if (jj_scan_token(WHILE)) return true; - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_Expression_2691_17_88()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_Statement_2709_25_172()) return true; - return false; - } - - private boolean jj_3R_PrimaryExpression_2126_19_229() - { - if (jj_3R_Literal_2152_17_180()) return true; - return false; - } - - private boolean jj_3R_IterationStatement_2893_19_192() - { - if (jj_3R_ForStatement_2913_11_235()) return true; - return false; - } - - private boolean jj_3R_PrimaryExpression_2125_19_228() - { - if (jj_3R_Identifier_2221_11_57()) return true; - return false; - } - - private boolean jj_3R_This_2133_11_250() - { - if (jj_scan_token(THIS)) return true; - return false; - } - - private boolean jj_3R_IterationStatement_2892_19_191() - { - if (jj_3R_WhileStatement_2906_11_234()) return true; - return false; - } - - private boolean jj_3R_PrimaryExpression_2124_19_227() - { - if (jj_3R_ParenExpression_2140_11_253()) return true; - return false; - } - - private boolean jj_3R_IterationStatement_2891_19_161() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_IterationStatement_2891_19_190()) { - jj_scanpos = xsp; - if (jj_3R_IterationStatement_2892_19_191()) { - jj_scanpos = xsp; - if (jj_3R_IterationStatement_2893_19_192()) return true; - } - } - return false; - } - - private boolean jj_3R_IterationStatement_2891_19_190() - { - if (jj_3R_DoStatement_2899_11_233()) return true; - return false; - } - - private boolean jj_3R_DoStatement_2899_11_233() - { - if (jj_scan_token(DO)) return true; - if (jj_3R_Statement_2709_25_172()) return true; - if (jj_scan_token(WHILE)) return true; - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_Expression_2691_17_88()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_EndStatement_3225_17_128()) return true; - return false; - } - - private boolean jj_3R_PrimaryExpression_2123_19_226() - { - if (jj_3R_ArrayLiteral_2247_17_252()) return true; - return false; - } - - private boolean jj_3R_getNoReservedIdentifier_1363_11_76() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(153)) { - jj_scanpos = xsp; - if (jj_scan_token(27)) { - jj_scanpos = xsp; - if (jj_scan_token(31)) { - jj_scanpos = xsp; - if (jj_scan_token(43)) { - jj_scanpos = xsp; - if (jj_scan_token(52)) { - jj_scanpos = xsp; - if (jj_scan_token(53)) { - jj_scanpos = xsp; - if (jj_scan_token(63)) { - jj_scanpos = xsp; - if (jj_scan_token(59)) { - jj_scanpos = xsp; - if (jj_scan_token(60)) { - jj_scanpos = xsp; - if (jj_scan_token(54)) { - jj_scanpos = xsp; - if (jj_scan_token(50)) { - jj_scanpos = xsp; - if (jj_scan_token(26)) { - jj_scanpos = xsp; - if (jj_scan_token(55)) { - jj_scanpos = xsp; - if (jj_scan_token(79)) { - jj_scanpos = xsp; - if (jj_scan_token(67)) { - jj_scanpos = xsp; - if (jj_scan_token(21)) { - jj_scanpos = xsp; - if (jj_scan_token(22)) { - jj_scanpos = xsp; - if (jj_scan_token(30)) { - jj_scanpos = xsp; - if (jj_scan_token(72)) { - jj_scanpos = xsp; - if (jj_scan_token(69)) { - jj_scanpos = xsp; - if (jj_scan_token(131)) { - jj_scanpos = xsp; - if (jj_scan_token(35)) { - jj_scanpos = xsp; - if (jj_scan_token(36)) { - jj_scanpos = xsp; - if (jj_scan_token(37)) { - jj_scanpos = xsp; - if (jj_scan_token(51)) { - jj_scanpos = xsp; - if (jj_scan_token(65)) { - jj_scanpos = xsp; - if (jj_scan_token(73)) { - jj_scanpos = xsp; - if (jj_scan_token(18)) { - jj_scanpos = xsp; - if (jj_scan_token(38)) { - jj_scanpos = xsp; - if (jj_scan_token(40)) { - jj_scanpos = xsp; - if (jj_scan_token(25)) return true; - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - return false; - } - - private boolean jj_3R_PrimaryExpression_2122_19_225() - { - if (jj_3R_ObjectLiteral_2294_17_251()) return true; - return false; - } - - private boolean jj_3R_Initialiser_2836_72_243() - { - if (jj_3R_AssignmentExpression_2663_17_72()) return true; - return false; - } - - private boolean jj_3R_PrimaryExpression_2121_13_186() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_PrimaryExpression_2121_13_224()) { - jj_scanpos = xsp; - if (jj_3R_PrimaryExpression_2122_19_225()) { - jj_scanpos = xsp; - if (jj_3R_PrimaryExpression_2123_19_226()) { - jj_scanpos = xsp; - if (jj_3R_PrimaryExpression_2124_19_227()) { - jj_scanpos = xsp; - if (jj_3R_PrimaryExpression_2125_19_228()) { - jj_scanpos = xsp; - if (jj_3R_PrimaryExpression_2126_19_229()) return true; - } - } - } - } - } - return false; - } - - private boolean jj_3R_PrimaryExpression_2121_13_224() - { - if (jj_3R_This_2133_11_250()) return true; - return false; - } - - private boolean jj_3R_IfStatement_2882_17_160() - { - if (jj_scan_token(IF)) return true; - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_Expression_2691_17_88()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_Statement_2709_25_172()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_IfStatement_2882_63_303()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3_53() - { - if (jj_3R_MemberExpression_2333_17_77()) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3_23() - { - if (jj_3R_Arguments_2387_17_70()) return true; - return false; - } - - private boolean jj_3R_Define_2091_25_196() - { - if (jj_3R_Arguments_2387_17_70()) return true; - return false; - } - - private boolean jj_3R_Define_2089_25_195() - { - if (jj_3R_noReservedIdentifier_1380_11_143()) return true; - if (jj_scan_token(ASSIGN)) return true; - if (jj_3R_AssignmentExpression_2663_17_72()) return true; - return false; - } - - private boolean jj_3R_OutputAct_2072_41_258() - { - if (jj_3R_Arguments_2387_17_70()) return true; - return false; - } - - private boolean jj_3R_ExpressionStatement_2860_17_84() - { - if (jj_3R_Expression_2691_17_88()) return true; - if (jj_3R_EndStatement_3225_17_128()) return true; - return false; - } - - private boolean jj_3R_Define_2086_17_167() - { - if (jj_scan_token(DEFINE)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Define_2089_25_195()) { - jj_scanpos = xsp; - if (jj_3R_Define_2091_25_196()) return true; - } - return false; - } - - private boolean jj_3R_EmptyStatement_2851_17_287() - { - if (jj_scan_token(SEMICOLON)) return true; - return false; - } - - private boolean jj_3_52() - { - if (jj_3R_ActionOnAssign_1866_17_79()) return true; - return false; - } - - private boolean jj_3R_OutputAct_2075_25_200() - { - if (jj_3R_Arguments_2387_17_70()) return true; - return false; - } - - private boolean jj_3R_OutputAct_2072_25_241() - { - if (jj_3R_Identifier_2221_11_57()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_OutputAct_2072_41_258()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_VariableDeclarationNoIn_2830_32_391() - { - if (jj_3R_InitialiserNoIn_2842_17_399()) return true; - return false; - } - - private boolean jj_3R_OutputAct_2070_25_240() - { - if (jj_3R_TemplateLiteral_2202_11_188()) return true; - return false; - } - - private boolean jj_3R_InitialiserNoIn_2842_17_399() - { - if (jj_scan_token(ASSIGN)) return true; - if (jj_3R_AssignmentExpressionNoIn_2671_17_135()) return true; - return false; - } - - private boolean jj_3R_Initialiser_2836_22_242() - { - if (jj_3R_ActionOnAssign_1866_17_79()) return true; - return false; - } - - private boolean jj_3R_OutputAct_2069_19_199() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_OutputAct_2070_25_240()) { - jj_scanpos = xsp; - if (jj_3R_OutputAct_2072_25_241()) return true; - } - return false; - } - - private boolean jj_3R_VariableDeclaration_2824_30_170() - { - if (jj_scan_token(COLON)) return true; - if (jj_3R_getNoReservedIdentifier_1363_11_76()) return true; - return false; - } - - private boolean jj_3R_Initialiser_2836_17_201() - { - if (jj_scan_token(ASSIGN)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Initialiser_2836_22_242()) { - jj_scanpos = xsp; - if (jj_3R_Initialiser_2836_72_243()) return true; - } - return false; - } - - private boolean jj_3R_VariableDeclarationList_2811_41_132() - { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_VariableDeclaration_2823_17_131()) return true; - return false; - } - - private boolean jj_3R_ExecOnAssign_2051_33_158() - { - if (jj_3R_Arguments_2387_17_70()) return true; - return false; - } - - private boolean jj_3R_ExecOnAssign_2048_33_157() - { - if (jj_3R_TemplateLiteral_2202_11_188()) return true; - return false; - } - - private boolean jj_3R_VariableDeclarationNoIn_2830_17_378() - { - if (jj_3R_Identifier_2221_11_57()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_VariableDeclarationNoIn_2830_32_391()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_OutputAct_2067_12_169() - { - if (jj_scan_token(OUTPUT_ACT)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_OutputAct_2069_19_199()) { - jj_scanpos = xsp; - if (jj_3R_OutputAct_2075_25_200()) return true; - } - return false; - } - - private boolean jj_3R_VariableDeclaration_2823_17_131() - { - if (jj_3R_Identifier_2221_11_57()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_VariableDeclaration_2824_30_170()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_VariableDeclaration_2824_99_171()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_Perform_2032_33_239() - { - if (jj_3R_Arguments_2387_17_70()) return true; - return false; - } - - private boolean jj_3R_Perform_2030_33_198() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Perform_2030_33_238()) { - jj_scanpos = xsp; - if (jj_3R_Perform_2032_33_239()) return true; - } - return false; - } - - private boolean jj_3R_Perform_2030_33_238() - { - if (jj_3R_TemplateLiteral_2202_11_188()) return true; - return false; - } - - private boolean jj_3R_VariableDeclarationList_2811_17_86() - { - if (jj_3R_VariableDeclaration_2823_17_131()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_VariableDeclarationList_2811_41_132()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_ExecOnAssign_2042_17_115() - { - if (jj_scan_token(EXEC)) return true; - if (jj_3R_getNoReservedIdentifier_1363_11_76()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ExecOnAssign_2048_33_157()) { - jj_scanpos = xsp; - if (jj_3R_ExecOnAssign_2051_33_158()) return true; - } - return false; - } - - private boolean jj_3_22() - { - if (jj_scan_token(IDENTIFIER_NAME)) return true; - if (jj_scan_token(COLON)) return true; - return false; - } - - private boolean jj_3R_VariableStatement_2802_17_286() - { - if (jj_scan_token(VAR)) return true; - if (jj_3R_VariableDeclarationList_2811_17_86()) return true; - if (jj_3R_EndStatement_3225_17_128()) return true; - return false; - } - - private boolean jj_3R_Block_2785_27_189() - { - if (jj_3R_StatementList_2793_17_232()) return true; - return false; - } - - private boolean jj_3R_StatementList_2793_19_254() - { - if (jj_3R_Statement_2709_25_172()) return true; - return false; - } - - private boolean jj_3R_Perform_2025_18_197() - { - if (jj_scan_token(IDENTIFIER_NAME)) return true; - if (jj_scan_token(COLON)) return true; - return false; - } - - private boolean jj_3R_StatementList_2793_17_232() - { - Token xsp; - if (jj_3R_StatementList_2793_19_254()) return true; - while (true) { - xsp = jj_scanpos; - if (jj_3R_StatementList_2793_19_254()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_Perform_2024_17_168() - { - if (jj_scan_token(EXEC)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Perform_2025_18_197()) jj_scanpos = xsp; - if (jj_3R_getNoReservedIdentifier_1363_11_76()) return true; - xsp = jj_scanpos; - if (jj_3R_Perform_2030_33_198()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_Block_2784_17_159() - { - if (jj_scan_token(LBRACE)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Block_2785_27_189()) jj_scanpos = xsp; - if (jj_scan_token(RBRACE)) return true; - return false; - } - - private boolean jj_3R_null_2727_71_130() - { - if (jj_3R_LeftHandSideExpression_2413_17_68()) return true; - return false; - } - - private boolean jj_3R_BodiedStatement_2770_27_119() - { - if (jj_3R_SwitchStatement_2999_17_162()) return true; - return false; - } - - private boolean jj_3R_BodiedStatement_2769_27_118() - { - if (jj_3R_IterationStatement_2891_19_161()) return true; - return false; - } - - private boolean jj_3R_BodiedStatement_2768_27_117() - { - if (jj_3R_IfStatement_2882_17_160()) return true; - return false; - } - - private boolean jj_3R_BodiedStatement_2773_19_122() - { - if (jj_3R_TryStatement_3052_17_165()) return true; - return false; - } - - private boolean jj_3R_BodiedStatement_2767_25_116() - { - if (jj_3R_Block_2784_17_159()) return true; - return false; - } - - private boolean jj_3R_BodiedStatement_2772_19_121() - { - if (jj_3R_ThrowStatement_3045_17_164()) return true; - return false; - } - - private boolean jj_3R_BodiedStatement_2771_19_120() - { - if (jj_3R_WithStatement_2990_17_163()) return true; - return false; - } - - private boolean jj_3R_Insert_1990_30_237() - { - if (jj_3R_Arguments_2387_17_70()) return true; - return false; - } - - private boolean jj_3R_Insert_2005_14_194() - { - if (jj_scan_token(REPLACE)) return true; - if (jj_3R_ConditionalExpression_2648_17_147()) return true; - return false; - } - - private boolean jj_3R_BodiedStatement_2765_17_81() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_BodiedStatement_2767_25_116()) { - jj_scanpos = xsp; - if (jj_3R_BodiedStatement_2768_27_117()) { - jj_scanpos = xsp; - if (jj_3R_BodiedStatement_2769_27_118()) { - jj_scanpos = xsp; - if (jj_3R_BodiedStatement_2770_27_119()) { - jj_scanpos = xsp; - if (jj_3R_BodiedStatement_2771_19_120()) { - jj_scanpos = xsp; - if (jj_3R_BodiedStatement_2772_19_121()) { - jj_scanpos = xsp; - if (jj_3R_BodiedStatement_2773_19_122()) return true; - } - } - } - } - } - } - return false; - } - - private boolean jj_3R_Insert_1978_31_257() - { - if (jj_scan_token(LT)) return true; - if (jj_scan_token(IDENTIFIER_NAME)) return true; - if (jj_scan_token(GT)) return true; - return false; - } - - private boolean jj_3_51() - { - if (jj_3R_Identifier_2221_11_57()) return true; - if (jj_scan_token(COLON)) return true; - return false; - } - - private boolean jj_3R_Insert_1977_30_236() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Insert_1978_31_257()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_scan_token(35)) { - jj_scanpos = xsp; - if (jj_scan_token(36)) { - jj_scanpos = xsp; - if (jj_scan_token(37)) { - jj_scanpos = xsp; - if (jj_scan_token(38)) return true; - } - } - } - if (jj_3R_ConditionalExpression_2648_17_147()) return true; - return false; - } - - private boolean jj_3_50() - { - if (jj_3R_ExpressionStatement_2860_17_84()) return true; - return false; - } - - private boolean jj_3_49() - { - if (jj_scan_token(VAR)) return true; - if (jj_3R_Identifier_2221_11_57()) return true; - return false; - } - - private boolean jj_3R_null_2727_41_129() - { - if (jj_scan_token(VAR)) return true; - if (jj_scan_token(IDENTIFIER_NAME)) return true; - return false; - } - - private boolean jj_3R_null_2727_40_83() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_null_2727_41_129()) { - jj_scanpos = xsp; - if (jj_3R_null_2727_71_130()) return true; - } - if (jj_scan_token(ASSIGN)) return true; - if (jj_scan_token(CALL)) return true; - return false; - } - - private boolean jj_3_48() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(28)) jj_scanpos = xsp; - if (jj_scan_token(CMD)) return true; - return false; - } - - private boolean jj_3R_SingleStatement_2738_27_267() - { - if (jj_3R_LabelledStatement_3039_17_288()) return true; - return false; - } - - private boolean jj_3R_SingleStatement_2736_27_266() - { - if (jj_3R_ExpressionStatement_2860_17_84()) return true; - return false; - } - - private boolean jj_3R_SingleStatement_2744_19_272() - { - if (jj_3R_ReturnStatement_2967_17_293()) return true; - return false; - } - - private boolean jj_3R_SingleStatement_2743_19_271() - { - if (jj_3R_ImportStatement_3193_17_292()) return true; - return false; - } - - private boolean jj_3R_SingleStatement_2742_19_270() - { - if (jj_3R_BreakStatement_2957_17_291()) return true; - return false; - } - - private boolean jj_3R_SingleStatement_2733_27_264() - { - if (jj_3R_VariableStatement_2802_17_286()) return true; - return false; - } - - private boolean jj_3R_SingleStatement_2741_19_269() - { - if (jj_3R_YieldStatement_2975_17_290()) return true; - return false; - } - - private boolean jj_3R_SingleStatement_2740_19_268() - { - if (jj_3R_ContinueStatement_2946_17_289()) return true; - return false; - } - - private boolean jj_3_47() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(27)) { - jj_scanpos = xsp; - if (jj_3R_null_2727_40_83()) return true; - } - return false; - } - - private boolean jj_3R_Insert_1974_14_193() - { - if (jj_scan_token(INSERT)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Insert_1977_30_236()) { - jj_scanpos = xsp; - if (jj_3R_Insert_1990_30_237()) return true; - } - return false; - } - - private boolean jj_3R_SingleStatement_2728_27_262() - { - if (jj_3R_Cmd_1940_9_284()) return true; - return false; - } - - private boolean jj_3_46() - { - if (jj_3R_Action_1826_11_82()) return true; - return false; - } - - private boolean jj_3R_SingleStatement_2735_19_265() - { - if (jj_3R_EmptyStatement_2851_17_287()) return true; - return false; - } - - private boolean jj_3R_SingleStatement_2730_19_263() - { - if (jj_3R_Run_1925_12_285()) return true; - return false; - } - - private boolean jj_3R_Insert_1970_11_166() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Insert_1974_14_193()) { - jj_scanpos = xsp; - if (jj_3R_Insert_2005_14_194()) return true; - } - return false; - } - - private boolean jj_3R_AssignmentExpressionNoIn_2674_72_204() - { - if (jj_3R_AssignmentExpressionNoIn_2671_17_135()) return true; - return false; - } - - private boolean jj_3R_SingleStatement_2727_19_261() - { - if (jj_3R_Call_1895_11_283()) return true; - return false; - } - - private boolean jj_3R_Cmd_1944_34_317() - { - if (jj_scan_token(GT)) return true; - if (jj_3R_AssignmentExpression_2663_17_72()) return true; - return false; - } - - private boolean jj_3R_SingleStatement_2725_19_260() - { - if (jj_3R_Action_1826_11_82()) return true; - return false; - } - - private boolean jj_3R_ExpressionNoIn_2697_46_136() - { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_AssignmentExpressionNoIn_2671_17_135()) return true; - return false; - } - - private boolean jj_3R_SingleStatement_2724_19_259() - { - if (jj_3R_SimpleAction_1804_13_282()) return true; - return false; - } - - private boolean jj_3R_SingleStatement_2721_17_244() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_SingleStatement_2724_19_259()) { - jj_scanpos = xsp; - if (jj_3R_SingleStatement_2725_19_260()) { - jj_scanpos = xsp; - if (jj_3R_SingleStatement_2727_19_261()) { - jj_scanpos = xsp; - if (jj_3R_SingleStatement_2728_27_262()) { - jj_scanpos = xsp; - if (jj_3R_SingleStatement_2730_19_263()) { - jj_scanpos = xsp; - if (jj_3R_SingleStatement_2733_27_264()) { - jj_scanpos = xsp; - if (jj_3R_SingleStatement_2735_19_265()) { - jj_scanpos = xsp; - if (jj_3R_SingleStatement_2736_27_266()) { - jj_scanpos = xsp; - if (jj_3R_SingleStatement_2738_27_267()) { - jj_scanpos = xsp; - if (jj_3R_SingleStatement_2740_19_268()) { - jj_scanpos = xsp; - if (jj_3R_SingleStatement_2741_19_269()) { - jj_scanpos = xsp; - if (jj_3R_SingleStatement_2742_19_270()) { - jj_scanpos = xsp; - if (jj_3R_SingleStatement_2743_19_271()) { - jj_scanpos = xsp; - if (jj_3R_SingleStatement_2744_19_272()) return true; - } - } - } - } - } - } - } - } - } - } - } - } - } - return false; - } - - private boolean jj_3R_Statement_2711_25_202() - { - if (jj_3R_SingleStatement_2721_17_244()) return true; - return false; - } - - private boolean jj_3_45() - { - if (jj_3R_BodiedStatement_2765_17_81()) return true; - return false; - } - - private boolean jj_3R_Statement_2709_25_172() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3_45()) { - jj_scanpos = xsp; - if (jj_3R_Statement_2711_25_202()) return true; - } - return false; - } - - private boolean jj_3R_Expression_2691_42_133() - { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_AssignmentExpression_2663_17_72()) return true; - return false; - } - - private boolean jj_3_21() - { - if (jj_3R_LeftHandSideExpression_2413_17_68()) return true; - if (jj_scan_token(COLON)) return true; - return false; - } - - private boolean jj_3R_Cmd_1941_23_315() - { - if (jj_scan_token(RUN)) return true; - if (jj_scan_token(CMD)) return true; - return false; - } - - private boolean jj_3R_Run_1928_34_320() - { - if (jj_scan_token(GT)) return true; - if (jj_3R_AssignmentExpression_2663_17_72()) return true; - return false; - } - - private boolean jj_3R_AssignmentExpression_2664_64_182() - { - if (jj_3R_AssignmentExpression_2663_17_72()) return true; - return false; - } - - private boolean jj_3_20() - { - if (jj_3R_LeftHandSideExpression_2413_17_68()) return true; - if (jj_scan_token(COLON)) return true; - return false; - } - - private boolean jj_3R_Cmd_1942_13_316() - { - if (jj_3R_LeftHandSideExpression_2413_17_68()) return true; - if (jj_scan_token(COLON)) return true; - return false; - } - - private boolean jj_3R_Cmd_1940_9_284() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(29)) { - jj_scanpos = xsp; - if (jj_3R_Cmd_1941_23_315()) return true; - } - xsp = jj_scanpos; - if (jj_3R_Cmd_1942_13_316()) jj_scanpos = xsp; - if (jj_3R_Arguments_2387_17_70()) return true; - xsp = jj_scanpos; - if (jj_3R_Cmd_1944_34_317()) jj_scanpos = xsp; - if (jj_3R_EndStatement_3225_17_128()) return true; - return false; - } - - private boolean jj_3R_Run_1925_23_318() - { - if (jj_3R_LeftHandSideExpression_2413_17_68()) return true; - if (jj_scan_token(COLON)) return true; - return false; - } - - private boolean jj_3R_ExpressionNoIn_2697_17_90() - { - if (jj_3R_AssignmentExpressionNoIn_2671_17_135()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_ExpressionNoIn_2697_46_136()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_Run_1926_20_319() - { - if (jj_3R_getNoReservedIdentifier_1363_11_76()) return true; - return false; - } - - private boolean jj_3_43() - { - if (jj_3R_ActionOnAssign_1866_17_79()) return true; - return false; - } - - private boolean jj_3R_Expression_2691_17_88() - { - if (jj_3R_AssignmentExpression_2663_17_72()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_Expression_2691_42_133()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_Run_1925_12_285() - { - if (jj_scan_token(RUN)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Run_1925_23_318()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_Run_1926_20_319()) jj_scanpos = xsp; - if (jj_3R_Arguments_2387_17_70()) return true; - xsp = jj_scanpos; - if (jj_3R_Run_1928_34_320()) jj_scanpos = xsp; - if (jj_3R_EndStatement_3225_17_128()) return true; - return false; - } - - private boolean jj_3R_AssignmentExpressionNoIn_2674_26_203() - { - if (jj_3R_ActionOnAssign_1866_17_79()) return true; - return false; - } - - private boolean jj_3R_ConditionalExpressionNoIn_2654_45_246() - { - if (jj_scan_token(HOOK)) return true; - if (jj_3R_AssignmentExpression_2663_17_72()) return true; - if (jj_scan_token(COLON)) return true; - if (jj_3R_AssignmentExpressionNoIn_2671_17_135()) return true; - return false; - } - - private boolean jj_3R_AssignmentOperator_2681_17_80() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(120)) { - jj_scanpos = xsp; - if (jj_scan_token(123)) { - jj_scanpos = xsp; - if (jj_scan_token(167)) { - jj_scanpos = xsp; - if (jj_scan_token(124)) { - jj_scanpos = xsp; - if (jj_scan_token(121)) { - jj_scanpos = xsp; - if (jj_scan_token(122)) { - jj_scanpos = xsp; - if (jj_scan_token(125)) { - jj_scanpos = xsp; - if (jj_scan_token(126)) { - jj_scanpos = xsp; - if (jj_scan_token(127)) { - jj_scanpos = xsp; - if (jj_scan_token(128)) { - jj_scanpos = xsp; - if (jj_scan_token(130)) { - jj_scanpos = xsp; - if (jj_scan_token(129)) return true; - } - } - } - } - } - } - } - } - } - } - } - return false; - } - - private boolean jj_3_44() - { - if (jj_3R_LeftHandSideExpression_2413_17_68()) return true; - if (jj_3R_AssignmentOperator_2681_17_80()) return true; - return false; - } - - private boolean jj_3R_Call_1909_18_314() - { - if (jj_3R_Arguments_2387_17_70()) return true; - return false; - } - - private boolean jj_3_18() - { - if (jj_3R_LeftHandSideExpression_2413_17_68()) return true; - if (jj_scan_token(COLON)) return true; - return false; - } - - private boolean jj_3R_AssignmentExpressionNoIn_2675_19_174() - { - if (jj_3R_ConditionalExpressionNoIn_2654_17_205()) return true; - return false; - } - - private boolean jj_3_41() - { - if (jj_3R_ActionOnAssign_1866_17_79()) return true; - return false; - } - - private boolean jj_3_42() - { - if (jj_3R_LeftHandSideExpression_2413_17_68()) return true; - if (jj_3R_AssignmentOperator_2681_17_80()) return true; - return false; - } - - private boolean jj_3R_ConditionalExpression_2648_41_217() - { - if (jj_scan_token(HOOK)) return true; - if (jj_3R_AssignmentExpression_2663_17_72()) return true; - if (jj_scan_token(COLON)) return true; - if (jj_3R_AssignmentExpression_2663_17_72()) return true; - return false; - } - - private boolean jj_3R_AssignmentExpressionNoIn_2671_17_135() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_AssignmentExpressionNoIn_2671_17_173()) { - jj_scanpos = xsp; - if (jj_3R_AssignmentExpressionNoIn_2675_19_174()) return true; - } - return false; - } - - private boolean jj_3R_AssignmentExpressionNoIn_2671_17_173() - { - if (jj_3R_LeftHandSideExpression_2413_17_68()) return true; - if (jj_3R_AssignmentOperator_2681_17_80()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_AssignmentExpressionNoIn_2674_26_203()) { - jj_scanpos = xsp; - if (jj_3R_AssignmentExpressionNoIn_2674_72_204()) return true; - } - return false; - } - - private boolean jj_3R_Call_1901_17_312() - { - if (jj_scan_token(VAR)) return true; - if (jj_3R_Identifier_2221_11_57()) return true; - if (jj_scan_token(ASSIGN)) return true; - if (jj_scan_token(CALL)) return true; - return false; - } - - private boolean jj_3_19() - { - if (jj_3R_FilePathNoSTar_1464_11_69()) return true; - return false; - } - - private boolean jj_3R_Call_1897_20_342() - { - if (jj_3R_LeftHandSideExpression_2413_17_68()) return true; - if (jj_scan_token(COLON)) return true; - return false; - } - - private boolean jj_3_17() - { - if (jj_3R_MemberExpressionPart_2362_17_67()) return true; - return false; - } - - private boolean jj_3R_AssignmentExpression_2665_19_103() - { - if (jj_3R_ConditionalExpression_2648_17_147()) return true; - return false; - } - - private boolean jj_3R_AssignmentExpression_2664_19_181() - { - if (jj_3R_ActionOnAssign_1866_17_79()) return true; - return false; - } - - private boolean jj_3R_AssignmentExpression_2663_17_102() - { - if (jj_3R_LeftHandSideExpression_2413_17_68()) return true; - if (jj_3R_AssignmentOperator_2681_17_80()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_AssignmentExpression_2664_19_181()) { - jj_scanpos = xsp; - if (jj_3R_AssignmentExpression_2664_64_182()) return true; - } - return false; - } - - private boolean jj_3R_AssignmentExpression_2663_17_72() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_AssignmentExpression_2663_17_102()) { - jj_scanpos = xsp; - if (jj_3R_AssignmentExpression_2665_19_103()) return true; - } - return false; - } - - private boolean jj_3R_Call_1903_9_313() - { - if (jj_3R_LeftHandSideExpression_2413_17_68()) return true; - if (jj_scan_token(ASSIGN)) return true; - if (jj_scan_token(CALL)) return true; - return false; - } - - private boolean jj_3R_LogicalORExpressionNoIn_2634_45_274() - { - if (jj_3R_LogicalOROperator_2640_17_277()) return true; - if (jj_3R_LogicalANDExpressionNoIn_2616_17_273()) return true; - return false; - } - - private boolean jj_3R_Call_1897_12_311() - { - if (jj_scan_token(CALL)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Call_1897_20_342()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_ActionOnAssign_1879_28_156() - { - if (jj_3R_MemberExpressionPart_2362_17_67()) return true; - return false; - } - - private boolean jj_3R_Call_1895_11_283() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Call_1897_12_311()) { - jj_scanpos = xsp; - if (jj_3R_Call_1901_17_312()) { - jj_scanpos = xsp; - if (jj_3R_Call_1903_9_313()) return true; - } - } - xsp = jj_scanpos; - if (jj_3_19()) jj_scanpos = xsp; - if (jj_scan_token(IDENTIFIER_NAME)) return true; - xsp = jj_scanpos; - if (jj_3R_Call_1909_18_314()) jj_scanpos = xsp; - if (jj_3R_EndStatement_3225_17_128()) return true; - return false; - } - - private boolean jj_3R_ConditionalExpressionNoIn_2654_17_205() - { - if (jj_3R_LogicalORExpressionNoIn_2634_17_245()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ConditionalExpressionNoIn_2654_45_246()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_LogicalORExpression_2628_41_248() - { - if (jj_3R_LogicalOROperator_2640_17_277()) return true; - if (jj_3R_LogicalANDExpression_2610_17_209()) return true; - return false; - } - - private boolean jj_3R_ConditionalExpression_2648_17_147() - { - if (jj_3R_LogicalORExpression_2628_17_179()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ConditionalExpression_2648_41_217()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_LogicalANDExpressionNoIn_2616_44_295() - { - if (jj_3R_LogicalANDOperator_2622_17_298()) return true; - if (jj_3R_BitwiseORExpressionNoIn_2597_17_294()) return true; - return false; - } - - private boolean jj_3R_LogicalOROperator_2640_17_277() - { - if (jj_scan_token(SC_OR)) return true; - return false; - } - - private boolean jj_3R_ActionOnAssign_1868_19_114() - { - if (jj_scan_token(IDENTIFIER_NAME)) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_ActionOnAssign_1879_28_156()) { jj_scanpos = xsp; break; } - } - if (jj_scan_token(DOT)) return true; - return false; - } - - private boolean jj_3_16() - { - if (jj_3R_MemberExpressionPart_2362_17_67()) return true; - return false; - } - - private boolean jj_3R_LogicalORExpressionNoIn_2634_17_245() - { - if (jj_3R_LogicalANDExpressionNoIn_2616_17_273()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_LogicalORExpressionNoIn_2634_45_274()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_ActionOnAssign_1866_17_79() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ActionOnAssign_1868_19_114()) jj_scanpos = xsp; - if (jj_3R_ExecOnAssign_2042_17_115()) return true; - return false; - } - - private boolean jj_3R_LogicalANDExpression_2610_40_276() - { - if (jj_3R_LogicalANDOperator_2622_17_298()) return true; - if (jj_3R_BitwiseORExpression_2591_17_247()) return true; - return false; - } - - private boolean jj_3R_LogicalORExpression_2628_17_179() - { - if (jj_3R_LogicalANDExpression_2610_17_209()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_LogicalORExpression_2628_41_248()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_BitwiseORExpressionNoIn_2597_45_329() - { - if (jj_3R_BitwiseOROperator_2603_17_332()) return true; - if (jj_3R_BitwiseXORExpressionNoIn_2579_17_328()) return true; - return false; - } - - private boolean jj_3R_Action_1846_28_123() - { - if (jj_3R_MemberExpressionPart_2362_17_67()) return true; - return false; - } - - private boolean jj_3R_Action_1854_19_127() - { - if (jj_3R_OutputAct_2067_12_169()) return true; - return false; - } - - private boolean jj_3R_LogicalANDOperator_2622_17_298() - { - if (jj_scan_token(SC_AND)) return true; - return false; - } - - private boolean jj_3R_Action_1853_19_126() - { - if (jj_3R_Perform_2024_17_168()) return true; - return false; - } - - private boolean jj_3R_Action_1852_19_125() - { - if (jj_3R_Define_2086_17_167()) return true; - return false; - } - - private boolean jj_3R_Action_1851_19_124() - { - if (jj_3R_Insert_1970_11_166()) return true; - return false; - } - - private boolean jj_3R_LogicalANDExpressionNoIn_2616_17_273() - { - if (jj_3R_BitwiseORExpressionNoIn_2597_17_294()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_LogicalANDExpressionNoIn_2616_44_295()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_BitwiseORExpression_2591_41_297() - { - if (jj_3R_BitwiseOROperator_2603_17_332()) return true; - if (jj_3R_BitwiseXORExpression_2573_17_275()) return true; - return false; - } - - private boolean jj_3R_LogicalANDExpression_2610_17_209() - { - if (jj_3R_BitwiseORExpression_2591_17_247()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_LogicalANDExpression_2610_40_276()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_BitwiseXORExpressionNoIn_2579_45_345() - { - if (jj_3R_BitwiseXOROperator_2585_17_348()) return true; - if (jj_3R_BitwiseANDExpressionNoIn_2561_17_344()) return true; - return false; - } - - private boolean jj_3R_BitwiseOROperator_2603_17_332() - { - if (jj_scan_token(BIT_OR)) return true; - return false; - } - - private boolean jj_3R_BitwiseXORExpression_2573_41_331() - { - if (jj_3R_BitwiseXOROperator_2585_17_348()) return true; - if (jj_3R_BitwiseANDExpression_2555_17_296()) return true; - return false; - } - - private boolean jj_3R_BitwiseORExpressionNoIn_2597_17_294() - { - if (jj_3R_BitwiseXORExpressionNoIn_2579_17_328()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_BitwiseORExpressionNoIn_2597_45_329()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3_15() - { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_FourthSetOp_1610_17_65()) return true; - return false; - } - - private boolean jj_3R_BitwiseORExpression_2591_17_247() - { - if (jj_3R_BitwiseXORExpression_2573_17_275()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_BitwiseORExpression_2591_41_297()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_BitwiseANDExpressionNoIn_2561_43_358() - { - if (jj_3R_BitwiseANDOperator_2567_17_361()) return true; - if (jj_3R_EqualityExpressionNoIn_2541_17_357()) return true; - return false; - } - - private boolean jj_3R_Action_1826_11_82() - { - if (jj_scan_token(IDENTIFIER_NAME)) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_Action_1846_28_123()) { jj_scanpos = xsp; break; } - } - if (jj_scan_token(DOT)) return true; - xsp = jj_scanpos; - if (jj_3R_Action_1851_19_124()) { - jj_scanpos = xsp; - if (jj_3R_Action_1852_19_125()) { - jj_scanpos = xsp; - if (jj_3R_Action_1853_19_126()) { - jj_scanpos = xsp; - if (jj_3R_Action_1854_19_127()) return true; - } - } - } - if (jj_3R_EndStatement_3225_17_128()) return true; - return false; - } - - private boolean jj_3R_BitwiseXOROperator_2585_17_348() - { - if (jj_scan_token(XOR)) return true; - return false; - } - - private boolean jj_3R_SimpleAction_1811_21_310() - { - if (jj_3R_OutputAct_2067_12_169()) return true; - return false; - } - - private boolean jj_3R_SimpleAction_1809_21_309() - { - if (jj_3R_Perform_2024_17_168()) return true; - return false; - } - - private boolean jj_3R_BitwiseXORExpressionNoIn_2579_17_328() - { - if (jj_3R_BitwiseANDExpressionNoIn_2561_17_344()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_BitwiseXORExpressionNoIn_2579_45_345()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_BitwiseANDExpression_2555_40_347() - { - if (jj_3R_BitwiseANDOperator_2567_17_361()) return true; - if (jj_3R_EqualityExpression_2535_17_330()) return true; - return false; - } - - private boolean jj_3R_SimpleAction_1807_21_308() - { - if (jj_3R_Define_2086_17_167()) return true; - return false; - } - - private boolean jj_3R_SimpleAction_1805_21_307() - { - if (jj_3R_Insert_1970_11_166()) return true; - return false; - } - - private boolean jj_3R_BitwiseXORExpression_2573_17_275() - { - if (jj_3R_BitwiseANDExpression_2555_17_296()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_BitwiseXORExpression_2573_41_331()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_EqualityExpressionNoIn_2541_46_373() - { - if (jj_3R_EqualityOperator_2547_17_139()) return true; - if (jj_3R_RelationalExpressionNoIn_2519_17_372()) return true; - return false; - } - - private boolean jj_3R_BitwiseANDOperator_2567_17_361() - { - if (jj_scan_token(BIT_AND)) return true; - return false; - } - - private boolean jj_3R_SimpleAction_1804_13_282() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_SimpleAction_1805_21_307()) { - jj_scanpos = xsp; - if (jj_3R_SimpleAction_1807_21_308()) { - jj_scanpos = xsp; - if (jj_3R_SimpleAction_1809_21_309()) { - jj_scanpos = xsp; - if (jj_3R_SimpleAction_1811_21_310()) return true; - } - } - } - if (jj_3R_EndStatement_3225_17_128()) return true; - return false; - } - - private boolean jj_3R_BitwiseANDExpressionNoIn_2561_17_344() - { - if (jj_3R_EqualityExpressionNoIn_2541_17_357()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_BitwiseANDExpressionNoIn_2561_43_358()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_EqualityExpression_2535_42_360() - { - if (jj_3R_EqualityOperator_2547_17_139()) return true; - if (jj_3R_RelationalExpression_2506_17_346()) return true; - return false; - } - - private boolean jj_3R_BitwiseANDExpression_2555_17_296() - { - if (jj_3R_EqualityExpression_2535_17_330()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_BitwiseANDExpression_2555_40_347()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_EqualityOperator_2547_17_139() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(96)) { - jj_scanpos = xsp; - if (jj_scan_token(97)) { - jj_scanpos = xsp; - if (jj_scan_token(99)) { - jj_scanpos = xsp; - if (jj_scan_token(100)) { - jj_scanpos = xsp; - if (jj_scan_token(98)) return true; - } - } - } - } - return false; - } - - private boolean jj_3R_EqualityExpressionNoIn_2541_17_357() - { - if (jj_3R_RelationalExpressionNoIn_2519_17_372()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_EqualityExpressionNoIn_2541_46_373()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_RelationalExpressionNoIn_2519_37_388() - { - if (jj_3R_RelationalNoInOperator_2526_17_395()) return true; - if (jj_3R_ShiftExpression_2491_17_359()) return true; - return false; - } - - private boolean jj_3R_SourceElement_3178_145_351() - { - if (jj_3R_Statement_2709_25_172()) return true; - return false; - } - - private boolean jj_3R_EqualityExpression_2535_17_330() - { - if (jj_3R_RelationalExpression_2506_17_346()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_EqualityExpression_2535_42_360()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_RelationalNoInOperator_2526_17_395() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(92)) { - jj_scanpos = xsp; - if (jj_scan_token(93)) { - jj_scanpos = xsp; - if (jj_scan_token(94)) { - jj_scanpos = xsp; - if (jj_scan_token(95)) { - jj_scanpos = xsp; - if (jj_scan_token(131)) return true; - } - } - } - } - return false; - } - - private boolean jj_3R_RelationalExpression_2506_37_375() - { - if (jj_3R_RelationalOperator_2512_17_140()) return true; - if (jj_3R_ShiftExpression_2491_17_359()) return true; - return false; - } - - private boolean jj_3R_RelationalExpressionNoIn_2519_17_372() - { - if (jj_3R_ShiftExpression_2491_17_359()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_RelationalExpressionNoIn_2519_37_388()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3_14() - { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_Identifier_2221_11_57()) return true; - return false; - } - - private boolean jj_3R_ShiftExpression_2491_40_390() - { - if (jj_3R_ShiftOperator_2497_17_398()) return true; - if (jj_3R_AdditiveExpression_2476_17_374()) return true; - return false; - } - - private boolean jj_3R_RelationalOperator_2512_17_140() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(92)) { - jj_scanpos = xsp; - if (jj_scan_token(93)) { - jj_scanpos = xsp; - if (jj_scan_token(94)) { - jj_scanpos = xsp; - if (jj_scan_token(95)) { - jj_scanpos = xsp; - if (jj_scan_token(131)) { - jj_scanpos = xsp; - if (jj_scan_token(55)) return true; - } - } - } - } - } - return false; - } - - private boolean jj_3R_RelationalExpression_2506_17_346() - { - if (jj_3R_ShiftExpression_2491_17_359()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_RelationalExpression_2506_37_375()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_AdditiveExpression_2476_46_397() - { - if (jj_3R_AdditiveOperator_2482_17_405()) return true; - if (jj_3R_MultiplicativeExpression_2461_17_389()) return true; - return false; - } - - private boolean jj_3R_ShiftOperator_2497_17_398() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(107)) { - jj_scanpos = xsp; - if (jj_scan_token(108)) { - jj_scanpos = xsp; - if (jj_scan_token(109)) return true; - } - } - return false; - } - - private boolean jj_3R_MemberExpressionPart_2363_149_97() - { - if (jj_scan_token(DOT)) return true; - if (jj_3R_noReservedIdentifier_1380_11_143()) return true; - return false; - } - - private boolean jj_3R_Arguments_2388_123_145() - { - if (jj_3R_ArgumentList_2406_17_178()) return true; - return false; - } - - private boolean jj_3R_ShiftExpression_2491_17_359() - { - if (jj_3R_AdditiveExpression_2476_17_374()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_ShiftExpression_2491_40_390()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3_63() - { - if (jj_scan_token(FUNCTION)) return true; - if (jj_3R_Identifier_2221_11_57()) return true; - return false; - } - - private boolean jj_3R_null_1670_68_95() - { - if (jj_3R_RelationalOperator_2512_17_140()) return true; - return false; - } - - private boolean jj_3R_AdditiveOperator_2482_17_405() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(101)) { - jj_scanpos = xsp; - if (jj_scan_token(102)) return true; - } - return false; - } - - private boolean jj_3R_MultiplicativeExpression_2461_37_404() - { - if (jj_3R_MultiplicativeOperator_2468_17_412()) return true; - if (jj_3R_UnaryExpression_2444_17_396()) return true; - return false; - } - - private boolean jj_3R_SourceElement_3178_86_350() - { - if (jj_3R_FunctionDeclaration_3078_17_363()) return true; - return false; - } - - private boolean jj_3R_AdditiveExpression_2476_17_374() - { - if (jj_3R_MultiplicativeExpression_2461_17_389()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_AdditiveExpression_2476_46_397()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_LeftHandSideExpressionForIn_2420_69_393() - { - if (jj_3R_MemberExpressionForIn_2345_17_401()) return true; - return false; - } - - private boolean jj_3R_null_1670_49_94() - { - if (jj_3R_EqualityOperator_2547_17_139()) return true; - return false; - } - - private boolean jj_3R_MultiplicativeOperator_2468_17_412() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(103)) { - jj_scanpos = xsp; - if (jj_scan_token(168)) { - jj_scanpos = xsp; - if (jj_scan_token(104)) return true; - } - } - return false; - } - - private boolean jj_3R_UnaryExpression_2444_39_403() - { - if (jj_3R_UnaryOperator_2450_17_411()) return true; - if (jj_3R_UnaryExpression_2444_17_396()) return true; - return false; - } - - private boolean jj_3R_LeftHandSideExpression_2413_70_99() - { - if (jj_3R_MemberExpression_2333_17_77()) return true; - return false; - } - - private boolean jj_3R_MultiplicativeExpression_2461_17_389() - { - if (jj_3R_UnaryExpression_2444_17_396()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_MultiplicativeExpression_2461_37_404()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_EndStatement_3225_17_128() - { - if (jj_scan_token(SEMICOLON)) return true; - return false; - } - - private boolean jj_3R_PostfixExpression_2428_44_413() - { - if (jj_3R_PostfixOperator_2434_17_414()) return true; - return false; - } - - private boolean jj_3_64() - { - if (jj_scan_token(DOT)) return true; - if (jj_scan_token(IDENTIFIER_NAME)) return true; - return false; - } - - private boolean jj_3R_UnaryOperator_2450_17_411() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(49)) { - jj_scanpos = xsp; - if (jj_scan_token(64)) { - jj_scanpos = xsp; - if (jj_scan_token(62)) { - jj_scanpos = xsp; - if (jj_scan_token(105)) { - jj_scanpos = xsp; - if (jj_scan_token(106)) { - jj_scanpos = xsp; - if (jj_scan_token(101)) { - jj_scanpos = xsp; - if (jj_scan_token(102)) { - jj_scanpos = xsp; - if (jj_scan_token(114)) { - jj_scanpos = xsp; - if (jj_scan_token(113)) return true; - } - } - } - } - } - } - } - } - return false; - } - - private boolean jj_3R_null_1670_29_66() - { - if (jj_scan_token(IDENTIFIER_NAME)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_null_1670_49_94()) { - jj_scanpos = xsp; - if (jj_3R_null_1670_68_95()) return true; - } - return false; - } - - private boolean jj_3_13() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_null_1670_29_66()) { - jj_scanpos = xsp; - if (jj_scan_token(85)) return true; - } - return false; - } - - private boolean jj_3R_CallExpressionPart_2382_82_111() - { - if (jj_scan_token(DOT)) return true; - if (jj_3R_noReservedIdentifier_1380_11_143()) return true; - return false; - } - - private boolean jj_3R_UnaryExpression_2444_17_402() - { - if (jj_3R_PostfixExpression_2428_17_410()) return true; - return false; - } - - private boolean jj_3R_UnaryExpression_2444_17_396() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_UnaryExpression_2444_17_402()) { - jj_scanpos = xsp; - if (jj_3R_UnaryExpression_2444_39_403()) return true; - } - return false; - } - - private boolean jj_3R_ImportStatement_3193_35_326() - { - if (jj_scan_token(DOT)) return true; - if (jj_scan_token(STAR)) return true; - return false; - } - - private boolean jj_3R_PostfixOperator_2434_17_414() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(105)) { - jj_scanpos = xsp; - if (jj_scan_token(106)) return true; - } - return false; - } - - private boolean jj_3R_Name_3200_17_325() - { - if (jj_scan_token(IDENTIFIER_NAME)) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_64()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3_40() - { - if (jj_3R_CallExpression_2369_17_78()) return true; - return false; - } - - private boolean jj_3R_ArgumentList_2406_41_208() - { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_AssignmentExpression_2663_17_72()) return true; - return false; - } - - private boolean jj_3R_PostfixExpression_2428_17_410() - { - if (jj_3R_LeftHandSideExpression_2413_17_68()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_PostfixExpression_2428_44_413()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_ImportStatement_3193_17_292() - { - if (jj_scan_token(IMPORT)) return true; - if (jj_3R_Name_3200_17_325()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ImportStatement_3193_35_326()) jj_scanpos = xsp; - if (jj_3R_EndStatement_3225_17_128()) return true; - return false; - } - - private boolean jj_3_39() - { - if (jj_3R_MemberExpression_2333_17_77()) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3_35() - { - if (jj_3R_MemberExpressionPart_2362_17_67()) return true; - return false; - } - - private boolean jj_3_62() - { - if (jj_scan_token(FUNCTION_GEN)) return true; - if (jj_3R_Identifier_2221_11_57()) return true; - return false; - } - - private boolean jj_3R_LeftHandSideExpressionForIn_2420_17_392() - { - if (jj_3R_CallExpressionForIn_2375_17_400()) return true; - return false; - } - - private boolean jj_3R_LeftHandSideExpressionForIn_2420_17_379() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_LeftHandSideExpressionForIn_2420_17_392()) { - jj_scanpos = xsp; - if (jj_3R_LeftHandSideExpressionForIn_2420_69_393()) return true; - } - return false; - } - - private boolean jj_3_12() - { - if (jj_scan_token(IDENTIFIER_NAME)) return true; - if (jj_scan_token(ASSIGN)) return true; - return false; - } - - private boolean jj_3R_LeftHandSideExpression_2413_17_98() - { - if (jj_3R_CallExpression_2369_17_78()) return true; - return false; - } - - private boolean jj_3R_LeftHandSideExpression_2413_17_68() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_LeftHandSideExpression_2413_17_98()) { - jj_scanpos = xsp; - if (jj_3R_LeftHandSideExpression_2413_70_99()) return true; - } - return false; - } - - private boolean jj_3_37() - { - if (jj_3R_CallExpressionPart_2381_17_75()) return true; - return false; - } - - private boolean jj_3R_NamedArgumentList_2394_35_207() - { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_NamedArgument_2400_11_206()) return true; - return false; - } - - private boolean jj_3R_SourceElement_3178_17_349() - { - if (jj_3R_GeneratorFunctionDeclaration_3085_17_362()) return true; - return false; - } - - private boolean jj_3R_SourceElement_3178_17_333() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_SourceElement_3178_17_349()) { - jj_scanpos = xsp; - if (jj_3R_SourceElement_3178_86_350()) { - jj_scanpos = xsp; - if (jj_3R_SourceElement_3178_145_351()) return true; - } - } - return false; - } - - private boolean jj_3R_null_1579_82_61() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(35)) { - jj_scanpos = xsp; - if (jj_scan_token(36)) return true; - } - return false; - } - - private boolean jj_3R_GeneratorFunctionExpression_3134_61_220() - { - if (jj_3R_FormalParameterList_3141_17_183()) return true; - return false; - } - - private boolean jj_3R_SourceElements_3172_18_299() - { - if (jj_3R_SourceElement_3178_17_333()) return true; - return false; - } - - private boolean jj_3R_ArgumentList_2406_17_178() - { - if (jj_3R_AssignmentExpression_2663_17_72()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_ArgumentList_2406_41_208()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_SourceElements_3172_17_278() - { - Token xsp; - if (jj_3R_SourceElements_3172_18_299()) return true; - while (true) { - xsp = jj_scanpos; - if (jj_3R_SourceElements_3172_18_299()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_FirstSetOp_1623_32_176() - { - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_FourthSetOp_1610_17_65()) return true; - if (jj_scan_token(RPAREN)) return true; - return false; - } - - private boolean jj_3R_FunctionExpression_3127_60_223() - { - if (jj_3R_FormalParameterList_3141_17_183()) return true; - return false; - } - - private boolean jj_3_36() - { - if (jj_3R_CallExpressionPart_2381_17_75()) return true; - return false; - } - - private boolean jj_3_38() - { - if (jj_3R_getNoReservedIdentifier_1363_11_76()) return true; - if (jj_scan_token(COLON)) return true; - return false; - } - - private boolean jj_3R_ThirdSetOp_1617_31_138() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(118)) { - jj_scanpos = xsp; - if (jj_scan_token(110)) return true; - } - if (jj_3R_ThirdSetOp_1617_17_93()) return true; - return false; - } - - private boolean jj_3R_CallExpressionPart_2382_31_110() - { - if (jj_scan_token(LBRACKET)) return true; - if (jj_3R_Expression_2691_17_88()) return true; - if (jj_scan_token(RBRACKET)) return true; - return false; - } - - private boolean jj_3_34() - { - if (jj_3R_Arguments_2387_17_70()) return true; - return false; - } - - private boolean jj_3R_NamedArgumentList_2394_18_177() - { - if (jj_3R_NamedArgument_2400_11_206()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_NamedArgumentList_2394_35_207()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_NamedArgument_2400_11_206() - { - if (jj_3R_getNoReservedIdentifier_1363_11_76()) return true; - if (jj_scan_token(COLON)) return true; - if (jj_3R_AssignmentExpression_2663_17_72()) return true; - return false; - } - - private boolean jj_3R_Arguments_2387_22_100() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Arguments_2387_22_144()) { - jj_scanpos = xsp; - if (jj_3R_Arguments_2388_123_145()) return true; - } - return false; - } - - private boolean jj_3R_Arguments_2387_22_144() - { - if (jj_3R_NamedArgumentList_2394_18_177()) return true; - return false; - } - - private boolean jj_3R_FunctionBody_3147_29_249() - { - if (jj_3R_SourceElements_3172_17_278()) return true; - return false; - } - - private boolean jj_3_11() - { - if (jj_scan_token(PLUS)) return true; - if (jj_3R_FourthSetOp_1610_17_65()) return true; - return false; - } - - private boolean jj_3_61() - { - if (jj_3R_ExpressionNoIn_2697_17_90()) return true; - return false; - } - - private boolean jj_3R_FormalParameterList_3141_34_218() - { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_Identifier_2221_11_57()) return true; - return false; - } - - private boolean jj_3R_FirstSetOp_1623_17_137() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_FirstSetOp_1623_17_175()) { - jj_scanpos = xsp; - if (jj_3R_FirstSetOp_1623_32_176()) return true; - } - return false; - } - - private boolean jj_3R_FirstSetOp_1623_17_175() - { - if (jj_3R_Identifier_2221_11_57()) return true; - return false; - } - - private boolean jj_3R_MemberExpressionPart_2362_45_142() - { - if (jj_scan_token(LBRACE)) return true; - if (jj_3R_Expression_2691_17_88()) return true; - if (jj_scan_token(RBRACE)) return true; - return false; - } - - private boolean jj_3R_Arguments_2387_17_70() - { - if (jj_scan_token(LPAREN)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Arguments_2387_22_100()) jj_scanpos = xsp; - if (jj_scan_token(RPAREN)) return true; - return false; - } - - private boolean jj_3R_GeneratorFunctionExpression_3134_37_219() - { - if (jj_3R_Identifier_2221_11_57()) return true; - return false; - } - - private boolean jj_3R_AllocationExpression_2356_47_187() - { - if (jj_3R_Arguments_2387_17_70()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_35()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_ThirdSetOp_1617_17_93() - { - if (jj_3R_FirstSetOp_1623_17_137()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ThirdSetOp_1617_31_138()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_CallExpressionPart_2381_17_109() - { - if (jj_3R_Arguments_2387_17_70()) return true; - return false; - } - - private boolean jj_3R_CallExpressionPart_2381_17_75() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_CallExpressionPart_2381_17_109()) { - jj_scanpos = xsp; - if (jj_3R_CallExpressionPart_2382_31_110()) { - jj_scanpos = xsp; - if (jj_3R_CallExpressionPart_2382_82_111()) return true; - } - } - return false; - } - - private boolean jj_3R_ArrowFunctionExpression_3100_65_108() - { - if (jj_3R_ExpressionNoIn_2697_17_90()) return true; - return false; - } - - private boolean jj_3R_null_1601_29_64() - { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(85)) jj_scanpos = xsp; - if (jj_3R_getNoReservedIdentifier_1363_11_76()) return true; - if (jj_scan_token(ASSIGN)) return true; - return false; - } - - private boolean jj_3R_FunctionBody_3147_17_221() - { - if (jj_scan_token(LBRACE)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_FunctionBody_3147_29_249()) jj_scanpos = xsp; - if (jj_scan_token(RBRACE)) return true; - return false; - } - - private boolean jj_3R_FunctionExpression_3127_36_222() - { - if (jj_3R_Identifier_2221_11_57()) return true; - return false; - } - - private boolean jj_3R_FourthSetOp_1610_17_65() - { - if (jj_3R_ThirdSetOp_1617_17_93()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3_11()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_CallExpressionForIn_2375_17_400() - { - if (jj_3R_MemberExpressionForIn_2345_17_401()) return true; - if (jj_3R_Arguments_2387_17_70()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_37()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3_9() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_null_1600_25_63()) { - jj_scanpos = xsp; - if (jj_3R_null_1601_29_64()) return true; - } - return false; - } - - private boolean jj_3R_null_1600_25_63() - { - if (jj_3R_getNoReservedIdentifier_1363_11_76()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(83)) { - jj_scanpos = xsp; - if (jj_scan_token(89)) { - jj_scanpos = xsp; - if (jj_scan_token(43)) return true; - } - } - return false; - } - - private boolean jj_3_32() - { - if (jj_3R_ArrowFunctionExpression_3099_9_74()) return true; - return false; - } - - private boolean jj_3R_FormalParameterList_3141_17_183() - { - if (jj_3R_Identifier_2221_11_57()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_FormalParameterList_3141_34_218()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3_31() - { - if (jj_scan_token(FUNCTION)) return true; - return false; - } - - private boolean jj_3_30() - { - if (jj_scan_token(FUNCTION_GEN)) return true; - return false; - } - - private boolean jj_3R_null_1581_38_62() - { - if (jj_3R_Identifier_2221_11_57()) return true; - if (jj_scan_token(COLON)) return true; - return false; - } - - private boolean jj_3R_CallExpression_2369_17_78() - { - if (jj_3R_MemberExpression_2333_17_77()) return true; - if (jj_3R_Arguments_2387_17_70()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_36()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3_8() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_null_1581_38_62()) jj_scanpos = xsp; - if (jj_scan_token(CONDITION)) return true; - return false; - } - - private boolean jj_3_10() - { - if (jj_3R_FourthSetOp_1610_17_65()) return true; - return false; - } - - private boolean jj_3R_null_1579_38_92() - { - if (jj_3R_Identifier_2221_11_57()) return true; - if (jj_scan_token(COLON)) return true; - return false; - } - - private boolean jj_3R_GeneratorFunctionExpression_3134_17_184() - { - if (jj_scan_token(FUNCTION_GEN)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_GeneratorFunctionExpression_3134_37_219()) jj_scanpos = xsp; - if (jj_scan_token(LPAREN)) return true; - xsp = jj_scanpos; - if (jj_3R_GeneratorFunctionExpression_3134_61_220()) jj_scanpos = xsp; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_FunctionBody_3147_17_221()) return true; - return false; - } - - private boolean jj_3_7() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_null_1579_37_60()) { - jj_scanpos = xsp; - if (jj_3R_null_1579_82_61()) return true; - } - return false; - } - - private boolean jj_3R_null_1579_37_60() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_null_1579_38_92()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_scan_token(35)) { - jj_scanpos = xsp; - if (jj_scan_token(36)) return true; - } - return false; - } - - private boolean jj_3R_MemberExpressionForIn_2349_33_409() - { - if (jj_3R_PrimaryExpression_2121_13_186()) return true; - return false; - } - - private boolean jj_3R_null_1577_38_91() - { - if (jj_3R_Identifier_2221_11_57()) return true; - if (jj_scan_token(COLON)) return true; - return false; - } - - private boolean jj_3R_MemberExpressionForIn_2348_33_408() - { - if (jj_3R_ArrowFunctionExpression_3099_9_74()) return true; - return false; - } - - private boolean jj_3_6() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_null_1577_37_59()) { - jj_scanpos = xsp; - if (jj_scan_token(25)) return true; - } - return false; - } - - private boolean jj_3R_null_1577_37_59() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_null_1577_38_91()) jj_scanpos = xsp; - if (jj_scan_token(APPLY)) return true; - return false; - } - - private boolean jj_3R_MemberExpressionPart_2362_19_141() - { - if (jj_scan_token(LBRACKET)) return true; - if (jj_3R_Expression_2691_17_88()) return true; - if (jj_scan_token(RBRACKET)) return true; - return false; - } - - private boolean jj_3R_MemberExpressionForIn_2347_33_407() - { - if (jj_3R_FunctionExpression_3127_17_185()) return true; - return false; - } - - private boolean jj_3R_MemberExpressionForIn_2346_33_406() - { - if (jj_3R_GeneratorFunctionExpression_3134_17_184()) return true; - return false; - } - - private boolean jj_3R_MemberExpressionPart_2362_17_96() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_MemberExpressionPart_2362_19_141()) { - jj_scanpos = xsp; - if (jj_3R_MemberExpressionPart_2362_45_142()) return true; - } - return false; - } - - private boolean jj_3R_MemberExpressionPart_2362_17_67() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_MemberExpressionPart_2362_17_96()) { - jj_scanpos = xsp; - if (jj_3R_MemberExpressionPart_2363_149_97()) return true; - } - return false; - } - - private boolean jj_3_28() - { - if (jj_3R_ArrowFunctionExpression_3099_9_74()) return true; - return false; - } - - private boolean jj_3_27() - { - if (jj_scan_token(FUNCTION)) return true; - return false; - } - - private boolean jj_3R_ArrowFunctionExpression_3099_46_106() - { - if (jj_3R_Identifier_2221_11_57()) return true; - return false; - } - - private boolean jj_3_26() - { - if (jj_scan_token(FUNCTION_GEN)) return true; - return false; - } - - private boolean jj_3R_FunctionExpression_3127_17_185() - { - if (jj_scan_token(FUNCTION)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_FunctionExpression_3127_36_222()) jj_scanpos = xsp; - if (jj_scan_token(LPAREN)) return true; - xsp = jj_scanpos; - if (jj_3R_FunctionExpression_3127_60_223()) jj_scanpos = xsp; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_FunctionBody_3147_17_221()) return true; - return false; - } - - private boolean jj_3R_null_1575_34_58() - { - if (jj_3R_Identifier_2221_11_57()) return true; - if (jj_scan_token(COLON)) return true; - return false; - } - - private boolean jj_3_5() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_null_1575_34_58()) jj_scanpos = xsp; - if (jj_scan_token(SELECT)) return true; - return false; - } - - private boolean jj_3R_GeneratorFunctionDeclaration_3085_56_376() - { - if (jj_3R_FormalParameterList_3141_17_183()) return true; - return false; - } - - private boolean jj_3R_AllocationExpression_2356_17_155() - { - if (jj_scan_token(NEW)) return true; - if (jj_3R_MemberExpression_2333_17_77()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_AllocationExpression_2356_47_187()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3_33() - { - if (jj_3R_MemberExpressionPart_2362_17_67()) return true; - return false; - } - - private boolean jj_3R_MemberExpression_2337_33_154() - { - if (jj_3R_PrimaryExpression_2121_13_186()) return true; - return false; - } - - private boolean jj_3R_MemberExpression_2336_33_153() - { - if (jj_3R_ArrowFunctionExpression_3099_9_74()) return true; - return false; - } - - private boolean jj_3R_MemberExpression_2335_33_152() - { - if (jj_3R_FunctionExpression_3127_17_185()) return true; - return false; - } - - private boolean jj_3R_MemberExpression_2334_33_151() - { - if (jj_3R_GeneratorFunctionExpression_3134_17_184()) return true; - return false; - } - - private boolean jj_3R_FunctionDeclaration_3078_55_377() - { - if (jj_3R_FormalParameterList_3141_17_183()) return true; - return false; - } - - private boolean jj_3R_MemberExpression_2339_26_113() - { - if (jj_3R_AllocationExpression_2356_17_155()) return true; - return false; - } - - private boolean jj_3R_MemberExpressionForIn_2345_17_401() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_MemberExpressionForIn_2346_33_406()) { - jj_scanpos = xsp; - if (jj_3R_MemberExpressionForIn_2347_33_407()) { - jj_scanpos = xsp; - if (jj_3R_MemberExpressionForIn_2348_33_408()) { - jj_scanpos = xsp; - if (jj_3R_MemberExpressionForIn_2349_33_409()) return true; - } - } - } - while (true) { - xsp = jj_scanpos; - if (jj_3_33()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3_29() - { - if (jj_3R_MemberExpressionPart_2362_17_67()) return true; - return false; - } - - private boolean jj_3_25() - { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_PropertyNameAndValue_2309_17_73()) return true; - return false; - } - - private boolean jj_3R_ArrowFunctionBody_3093_29_134() - { - if (jj_3R_Statement_2709_25_172()) return true; - return false; - } - - private boolean jj_3_60() - { - if (jj_3R_ArrowFunctionBody_3093_17_89()) return true; - return false; - } - - private boolean jj_3R_MemberExpression_2333_17_112() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_MemberExpression_2334_33_151()) { - jj_scanpos = xsp; - if (jj_3R_MemberExpression_2335_33_152()) { - jj_scanpos = xsp; - if (jj_3R_MemberExpression_2336_33_153()) { - jj_scanpos = xsp; - if (jj_3R_MemberExpression_2337_33_154()) return true; - } - } - } - while (true) { - xsp = jj_scanpos; - if (jj_3_29()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_MemberExpression_2333_17_77() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_MemberExpression_2333_17_112()) { - jj_scanpos = xsp; - if (jj_3R_MemberExpression_2339_26_113()) return true; - } - return false; - } - - private boolean jj_3R_ArrowFunctionExpression_3099_16_150() - { - if (jj_3R_FormalParameterList_3141_17_183()) return true; - return false; - } - - private boolean jj_3R_PropertyNameAndValueList_2303_42_352() - { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_PropertyNameAndValue_2309_17_73()) return true; - return false; - } - - private boolean jj_3R_PropertyNameAndValueList_2303_42_334() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_PropertyNameAndValueList_2303_42_352()) { - jj_scanpos = xsp; - if (jj_scan_token(91)) return true; - } - return false; - } - - private boolean jj_3R_ArrowFunctionExpression_3100_11_107() - { - if (jj_3R_ArrowFunctionBody_3093_17_89()) return true; - return false; - } - - private boolean jj_3R_TryStatement_3054_56_341() - { - if (jj_3R_Finally_3069_17_339()) return true; - return false; - } - - private boolean jj_3R_ArrowFunctionExpression_3099_11_105() - { - if (jj_scan_token(LPAREN)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ArrowFunctionExpression_3099_16_150()) jj_scanpos = xsp; - if (jj_scan_token(RPAREN)) return true; - return false; - } - - private boolean jj_3R_ArrowFunctionBody_3093_17_89() - { - if (jj_scan_token(LBRACE)) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_ArrowFunctionBody_3093_29_134()) { jj_scanpos = xsp; break; } - } - if (jj_scan_token(RBRACE)) return true; - return false; - } - - private boolean jj_3R_PropertyName_2317_25_149() - { - if (jj_3R_Literal_2152_17_180()) return true; - return false; - } - - private boolean jj_3R_ArrowFunctionExpression_3099_9_74() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ArrowFunctionExpression_3099_11_105()) { - jj_scanpos = xsp; - if (jj_3R_ArrowFunctionExpression_3099_46_106()) return true; - } - if (jj_scan_token(ARROW)) return true; - xsp = jj_scanpos; - if (jj_3R_ArrowFunctionExpression_3100_11_107()) { - jj_scanpos = xsp; - if (jj_3R_ArrowFunctionExpression_3100_65_108()) return true; - } - return false; - } - - private boolean jj_3R_PropertyName_2315_21_104() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_PropertyName_2315_21_148()) { - jj_scanpos = xsp; - if (jj_3R_PropertyName_2317_25_149()) return true; - } - return false; - } - - private boolean jj_3R_PropertyName_2315_21_148() - { - if (jj_3R_noReservedIdentifier_1380_11_143()) return true; - return false; - } - - private boolean jj_3R_GeneratorFunctionDeclaration_3085_17_362() - { - if (jj_scan_token(FUNCTION_GEN)) return true; - if (jj_3R_Identifier_2221_11_57()) return true; - if (jj_scan_token(LPAREN)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_GeneratorFunctionDeclaration_3085_56_376()) jj_scanpos = xsp; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_FunctionBody_3147_17_221()) return true; - return false; - } - - private boolean jj_3R_TryStatement_3054_47_306() - { - if (jj_3R_Catch_3062_17_340()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_TryStatement_3054_56_341()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_FunctionDeclaration_3078_17_363() - { - if (jj_scan_token(FUNCTION)) return true; - if (jj_3R_Identifier_2221_11_57()) return true; - if (jj_scan_token(LPAREN)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_FunctionDeclaration_3078_55_377()) jj_scanpos = xsp; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_FunctionBody_3147_17_221()) return true; - return false; - } - - private boolean jj_3R_PropertyNameAndValue_2309_17_73() - { - if (jj_3R_PropertyName_2315_21_104()) return true; - if (jj_scan_token(COLON)) return true; - if (jj_3R_AssignmentExpression_2663_17_72()) return true; - return false; - } - - private boolean jj_3R_CaseBlock_3008_84_356() - { - if (jj_3R_CaseClauses_3016_17_354()) return true; - return false; - } - - private boolean jj_3R_CaseClause_3022_68_394() - { - if (jj_3R_StatementList_2793_17_232()) return true; - return false; - } - - private boolean jj_3R_TryStatement_3054_35_305() - { - if (jj_3R_Finally_3069_17_339()) return true; - return false; - } - - private boolean jj_3R_ObjectLiteral_2295_27_279() - { - if (jj_3R_PropertyNameAndValueList_2303_17_300()) return true; - return false; - } - - private boolean jj_3R_DefaultClause_3029_58_371() - { - if (jj_3R_StatementList_2793_17_232()) return true; - return false; - } - - private boolean jj_3R_PropertyNameAndValueList_2303_17_300() - { - if (jj_3R_PropertyNameAndValue_2309_17_73()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_PropertyNameAndValueList_2303_42_334()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_Finally_3069_17_339() - { - if (jj_scan_token(FINALLY)) return true; - if (jj_3R_Block_2784_17_159()) return true; - return false; - } - - private boolean jj_3R_Catch_3062_17_340() - { - if (jj_scan_token(CATCH)) return true; - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_Identifier_2221_11_57()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_Block_2784_17_159()) return true; - return false; - } - - private boolean jj_3R_ObjectLiteral_2294_17_251() - { - if (jj_scan_token(LBRACE)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ObjectLiteral_2295_27_279()) jj_scanpos = xsp; - if (jj_scan_token(RBRACE)) return true; - return false; - } - - private boolean jj_3R_CaseBlock_3008_66_338() - { - if (jj_3R_DefaultClause_3029_17_355()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_CaseBlock_3008_84_356()) jj_scanpos = xsp; - if (jj_scan_token(RBRACE)) return true; - return false; - } - - private boolean jj_3R_ElisionFirst_2286_19_353() - { - if (jj_scan_token(COMMA)) return true; - return false; - } - - private boolean jj_3R_ElisionFirst_2286_18_335() - { - Token xsp; - if (jj_3R_ElisionFirst_2286_19_353()) return true; - while (true) { - xsp = jj_scanpos; - if (jj_3R_ElisionFirst_2286_19_353()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_ElisionFirst_2285_17_301() - { - if (jj_scan_token(COMMA)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_ElisionFirst_2286_18_335()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_TryStatement_3052_17_165() - { - if (jj_scan_token(TRY)) return true; - if (jj_3R_Block_2784_17_159()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_TryStatement_3054_35_305()) { - jj_scanpos = xsp; - if (jj_3R_TryStatement_3054_47_306()) return true; - } - return false; - } - - /** Generated Token Manager. */ - public LARAEcmaScriptTokenManager token_source; - JavaCharStream jj_input_stream; - /** Current token. */ - public Token token; - /** Next token. */ - public Token jj_nt; - private int jj_ntk; - private Token jj_scanpos, jj_lastpos; - private int jj_la; - private int jj_gen; - final private int[] jj_la1 = new int[187]; - static private int[] jj_la1_0; - static private int[] jj_la1_1; - static private int[] jj_la1_2; - static private int[] jj_la1_3; - static private int[] jj_la1_4; - static private int[] jj_la1_5; - static { - jj_la1_init_0(); - jj_la1_init_1(); - jj_la1_init_2(); - jj_la1_init_3(); - jj_la1_init_4(); - jj_la1_init_5(); - } - private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0xce640000,0xce640000,0x0,0x180000,0x180000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe00000,0xe00000,0x0,0x0,0x7b000000,0x38000000,0x0,0x0,0x0,0x0,0x0,0x0,0xce640000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000000,0x0,0x0,0x0,0x8000000,0x0,0xce640000,0x0,0x30000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xce640000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xce640000,0x0,0x0,0xce640000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xce640000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x38000000,0x0,0x10000000,0x0,0x0,0x0,0x38000000,0x38000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x38000000,0x38000000,0x0,0x0,0x0,0x0,0x38000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x38000000,0x38000000,0x38000000,0x38000000,0x0,0x0,0x0,}; - } - private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x98fc0978,0x98fe0978,0x0,0xa4300000,0xa4300000,0x0,0xa4300000,0x0,0x0,0x0,0x0,0x0,0x0,0x80300000,0x80300000,0x64320000,0x0,0x0,0x0,0x200,0x100,0xfc7b80df,0xfc7b80c7,0x400,0x0,0x0,0x0,0x0,0x0,0x98fc0978,0x0,0x0,0x0,0x64320000,0x64320000,0x0,0x0,0x0,0x800000,0x0,0x18,0x0,0x0,0x6000,0x6000,0x18,0x18,0x1000,0x0,0xc7,0xc7,0x0,0xa4300000,0x0,0x98fc0978,0x0,0x0,0x0,0x0,0x78,0x78,0x41,0x0,0x0,0x0,0x0,0x0,0x98fe0978,0x0,0x0,0x80000,0x20000000,0x0,0x0,0x0,0x0,0x64320000,0x0,0x0,0x0,0x0,0x0,0x98fe0978,0x0,0x0,0x98fe0978,0x20000000,0x24300000,0x20000000,0x0,0x0,0x0,0x64320000,0xfcfe0978,0x0,0x0,0x24300000,0x20300000,0x0,0x0,0x64320000,0x40020000,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x64320000,0x64320000,0x64320000,0x64320000,0x0,0x0,0x0,0xfc3380c7,0xc7,0x0,0x0,0x18018000,0x480000,0xfc7b80c7,0xfc7b80c7,0x0,0x0,0x0,0x0,0x0,0x64320000,0x24300000,0x40000,0x80000,0xa0300000,0x64320000,0x64320000,0x64320000,0x64320000,0x64320000,0x1800000,0x1800000,0xa0300000,0x2000000,0x0,0x0,0x0,0x0,0x0,0xfc7b80c7,0xfc7b80c7,0x0,0x0,0x0,0x0,0xfc7b80c7,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfc7b80c7,0xfc7b80c7,0xfc7b80c7,0xfc7b80c7,0x0,0x0,0x0,}; - } - private static void jj_la1_init_2() { - jj_la1_2 = new int[] {0x832a,0x832a,0x2000,0xa80000,0xa80000,0x4000000,0xa80000,0x0,0x10000000,0x0,0x200000,0x4000000,0x4000000,0x0,0x0,0xa80001,0x4000000,0x0,0x0,0x0,0x0,0x4aba207,0x4aba207,0x0,0x0,0x0,0x0,0x200000,0x200000,0x832a,0x80000,0x2000000,0x8000000,0xa80001,0xa80001,0x8000000,0x8000000,0x200000,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xa80000,0x200000,0x832a,0x20000000,0x0,0x20000000,0x10000000,0x0,0x10200000,0x0,0x200000,0x200000,0x200000,0x0,0x200000,0x20832a,0x0,0x8000000,0x0,0xa80000,0x0,0x0,0x0,0x8000000,0xa80001,0x8000000,0x8000000,0x8000000,0x8000000,0x8000000,0x832a,0x8000000,0x8000000,0x832a,0xa80000,0xa80000,0xa80000,0x880000,0x2880000,0x2a00000,0xa80001,0xa8832b,0x8000000,0x8000000,0xa80000,0xa80000,0x0,0x0,0xa80001,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0xf0000000,0xf0000000,0xf0000000,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xa80001,0xa80001,0xa80001,0xa80001,0x0,0x8000000,0x8000000,0x4a82001,0x0,0x0,0x4000000,0x2000,0xb8206,0x4aba207,0x4aba207,0x8000000,0x8000000,0x0,0x0,0x0,0xa80001,0xa80000,0x0,0x202,0xa80000,0xa80001,0xa80001,0xa80001,0xa80001,0xa80001,0x0,0x0,0xa80000,0x200000,0x0,0x8,0x8,0x100100,0x8,0x4aba207,0x4aba207,0x1000,0x1010,0x0,0x0,0x4aba207,0x0,0x200000,0x0,0x0,0x0,0x0,0x8000000,0x4aba207,0x4aba207,0x4aba207,0x4aba207,0x2000000,0x8000000,0x0,}; - } - private static void jj_la1_init_3() { - jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x60660,0x0,0x0,0x0,0x0,0x0,0x60660,0x60660,0x0,0x0,0x404000,0x404000,0x0,0x0,0x0,0x0,0x0,0x0,0x60660,0x606e0,0x0,0x0,0x0,0x1f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x60660,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x60660,0x60660,0x0,0x0,0x0,0x0,0x600,0x600,0x60660,0x60660,0x180,0x180,0x60,0x60,0x3800,0x3800,0x0,0x0,0x0,0x0,0x1f,0x1f,0x1f,0x4000,0x4000,0x10000,0x10000,0x8000,0x8000,0x80000,0x80000,0x100000,0x100000,0x200000,0x200000,0x60660,0x60660,0x60660,0x60660,0xff000000,0x0,0x0,0x60660,0x0,0x0,0x0,0x0,0x0,0x60660,0x60660,0x0,0x0,0x800000,0x1000000,0x1000000,0x60660,0x0,0x0,0x0,0x0,0x60660,0x60660,0x60660,0x60660,0x60660,0x0,0x0,0x0,0x0,0x80,0x0,0x0,0x0,0x0,0x60660,0x60660,0x0,0x0,0x0,0x0,0x60660,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x60660,0x60660,0x60660,0x60660,0x0,0x0,0x1000000,}; - } - private static void jj_la1_init_4() { - jj_la1_4 = new int[] {0x2000008,0x2000008,0x0,0x2803910,0x2803910,0x0,0x2803910,0x2000000,0x0,0x2000000,0x0,0x0,0x0,0x0,0x0,0x2803910,0x0,0x0,0x0,0x0,0x0,0x2803910,0x2803910,0x0,0x2000000,0x0,0x0,0x2000000,0x0,0x2000008,0x0,0x0,0x0,0x2803910,0x2803910,0x0,0x0,0x2000000,0x8,0x2000000,0x0,0x2000000,0x2000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000000,0x2803910,0x0,0x2000008,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x802000,0x802000,0x802000,0x2802000,0x2802000,0x2000008,0x2000000,0x0,0x0,0x2803910,0x803910,0x802000,0x3000000,0x0,0x2803910,0x0,0x0,0x0,0x0,0x0,0x2803918,0x0,0x0,0x2803918,0x2803910,0x2803910,0x2803910,0x0,0x0,0x0,0x2803910,0x2803918,0x0,0x0,0x2803910,0x2803910,0x0,0x0,0x2803910,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x8,0x8,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2803910,0x2803910,0x2803910,0x2803910,0x7,0x0,0x0,0x2803910,0x0,0x0,0x0,0x0,0x0,0x2803910,0x2803910,0x0,0x0,0x0,0x0,0x0,0x2803910,0x2803910,0x0,0x0,0x2803910,0x2803910,0x2803910,0x2803910,0x2803910,0x2803910,0x0,0x0,0x2803910,0x0,0x0,0x0,0x0,0x0,0x0,0x2803910,0x2803910,0x0,0x0,0x2000000,0x2000000,0x2803910,0x2000000,0x2000000,0x2000000,0x2000000,0x2000000,0x2000000,0x0,0x2803910,0x2803910,0x2803910,0x2803910,0x0,0x0,0x0,}; - } - private static void jj_la1_init_5() { - jj_la1_5 = new int[] {0x0,0x0,0x0,0x200,0x200,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x200,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x200,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x200,0x200,0x200,0x200,0x0,0x0,0x0,0x200,0x200,0x0,0x0,0x200,0x200,0x0,0x0,0x200,0x0,0x100,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x200,0x200,0x200,0x80,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x200,0x200,0x0,0x0,0x0,0x0,0x0,0x200,0x200,0x0,0x0,0x200,0x200,0x200,0x200,0x200,0x200,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x200,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x200,0x200,0x200,0x0,0x0,0x0,}; - } - final private JJCalls[] jj_2_rtns = new JJCalls[64]; - private boolean jj_rescan = false; - private int jj_gc = 0; - - /** Constructor with InputStream. */ - public LARAEcmaScript(java.io.InputStream stream) { - this(stream, null); - } - /** Constructor with InputStream and supplied encoding */ - public LARAEcmaScript(java.io.InputStream stream, String encoding) { - try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source = new LARAEcmaScriptTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 187; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Reinitialise. */ - public void ReInit(java.io.InputStream stream) { - ReInit(stream, null); - } - /** Reinitialise. */ - public void ReInit(java.io.InputStream stream, String encoding) { - try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jjtree.reset(); - jj_gen = 0; - for (int i = 0; i < 187; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Constructor. */ - public LARAEcmaScript(java.io.Reader stream) { - jj_input_stream = new JavaCharStream(stream, 1, 1); - token_source = new LARAEcmaScriptTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 187; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Reinitialise. */ - public void ReInit(java.io.Reader stream) { - if (jj_input_stream == null) { - jj_input_stream = new JavaCharStream(stream, 1, 1); - } else { - jj_input_stream.ReInit(stream, 1, 1); - } - if (token_source == null) { - token_source = new LARAEcmaScriptTokenManager(jj_input_stream); - } - - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jjtree.reset(); - jj_gen = 0; - for (int i = 0; i < 187; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Constructor with generated Token Manager. */ - public LARAEcmaScript(LARAEcmaScriptTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 187; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Reinitialise. */ - public void ReInit(LARAEcmaScriptTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jjtree.reset(); - jj_gen = 0; - for (int i = 0; i < 187; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - if (++jj_gc > 100) { - jj_gc = 0; - for (int i = 0; i < jj_2_rtns.length; i++) { - JJCalls c = jj_2_rtns[i]; - while (c != null) { - if (c.gen < jj_gen) c.first = null; - c = c.next; - } - } - } - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); - } - - @SuppressWarnings("serial") - static private final class LookaheadSuccess extends java.lang.Error { - @Override - public Throwable fillInStackTrace() { - return this; - } - } - static private final LookaheadSuccess jj_ls = new LookaheadSuccess(); - private boolean jj_scan_token(int kind) { - if (jj_scanpos == jj_lastpos) { - jj_la--; - if (jj_scanpos.next == null) { - jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); - } else { - jj_lastpos = jj_scanpos = jj_scanpos.next; - } - } else { - jj_scanpos = jj_scanpos.next; - } - if (jj_rescan) { - int i = 0; Token tok = token; - while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } - if (tok != null) jj_add_error_token(kind, i); - } - if (jj_scanpos.kind != kind) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; - return false; - } - - -/** Get the next Token. */ - final public Token getNextToken() { - if (token.next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - jj_gen++; - return token; - } - -/** Get the specific Token. */ - final public Token getToken(int index) { - Token t = token; - for (int i = 0; i < index; i++) { - if (t.next != null) t = t.next; - else t = t.next = token_source.getNextToken(); - } - return t; - } - - private int jj_ntk_f() { - if ((jj_nt=token.next) == null) - return (jj_ntk = (token.next=token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); - } - - private java.util.List jj_expentries = new java.util.ArrayList(); - private int[] jj_expentry; - private int jj_kind = -1; - private int[] jj_lasttokens = new int[100]; - private int jj_endpos; - - private void jj_add_error_token(int kind, int pos) { - if (pos >= 100) { - return; - } - - if (pos == jj_endpos + 1) { - jj_lasttokens[jj_endpos++] = kind; - } else if (jj_endpos != 0) { - jj_expentry = new int[jj_endpos]; - - for (int i = 0; i < jj_endpos; i++) { - jj_expentry[i] = jj_lasttokens[i]; - } - - for (int[] oldentry : jj_expentries) { - if (oldentry.length == jj_expentry.length) { - boolean isMatched = true; - - for (int i = 0; i < jj_expentry.length; i++) { - if (oldentry[i] != jj_expentry[i]) { - isMatched = false; - break; - } - - } - if (isMatched) { - jj_expentries.add(jj_expentry); - break; - } - } - } - - if (pos != 0) { - jj_lasttokens[(jj_endpos = pos) - 1] = kind; - } - } - } - - /** Generate ParseException. */ - public ParseException generateParseException() { - jj_expentries.clear(); - boolean[] la1tokens = new boolean[171]; - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for (int i = 0; i < 187; i++) { - if (jj_la1[i] == jj_gen) { - for (int j = 0; j < 32; j++) { - if ((jj_la1_0[i] & (1< jj_gen) { - jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; - switch (i) { - case 0: jj_3_1(); break; - case 1: jj_3_2(); break; - case 2: jj_3_3(); break; - case 3: jj_3_4(); break; - case 4: jj_3_5(); break; - case 5: jj_3_6(); break; - case 6: jj_3_7(); break; - case 7: jj_3_8(); break; - case 8: jj_3_9(); break; - case 9: jj_3_10(); break; - case 10: jj_3_11(); break; - case 11: jj_3_12(); break; - case 12: jj_3_13(); break; - case 13: jj_3_14(); break; - case 14: jj_3_15(); break; - case 15: jj_3_16(); break; - case 16: jj_3_17(); break; - case 17: jj_3_18(); break; - case 18: jj_3_19(); break; - case 19: jj_3_20(); break; - case 20: jj_3_21(); break; - case 21: jj_3_22(); break; - case 22: jj_3_23(); break; - case 23: jj_3_24(); break; - case 24: jj_3_25(); break; - case 25: jj_3_26(); break; - case 26: jj_3_27(); break; - case 27: jj_3_28(); break; - case 28: jj_3_29(); break; - case 29: jj_3_30(); break; - case 30: jj_3_31(); break; - case 31: jj_3_32(); break; - case 32: jj_3_33(); break; - case 33: jj_3_34(); break; - case 34: jj_3_35(); break; - case 35: jj_3_36(); break; - case 36: jj_3_37(); break; - case 37: jj_3_38(); break; - case 38: jj_3_39(); break; - case 39: jj_3_40(); break; - case 40: jj_3_41(); break; - case 41: jj_3_42(); break; - case 42: jj_3_43(); break; - case 43: jj_3_44(); break; - case 44: jj_3_45(); break; - case 45: jj_3_46(); break; - case 46: jj_3_47(); break; - case 47: jj_3_48(); break; - case 48: jj_3_49(); break; - case 49: jj_3_50(); break; - case 50: jj_3_51(); break; - case 51: jj_3_52(); break; - case 52: jj_3_53(); break; - case 53: jj_3_54(); break; - case 54: jj_3_55(); break; - case 55: jj_3_56(); break; - case 56: jj_3_57(); break; - case 57: jj_3_58(); break; - case 58: jj_3_59(); break; - case 59: jj_3_60(); break; - case 60: jj_3_61(); break; - case 61: jj_3_62(); break; - case 62: jj_3_63(); break; - case 63: jj_3_64(); break; - } - } - p = p.next; - } while (p != null); - - } catch(LookaheadSuccess ls) { } - } - jj_rescan = false; - } - - private void jj_save(int index, int xla) { - JJCalls p = jj_2_rtns[index]; - while (p.gen > jj_gen) { - if (p.next == null) { p = p.next = new JJCalls(); break; } - p = p.next; - } - - p.gen = jj_gen + xla - jj_la; - p.first = token; - p.arg = xla; - } - - static final class JJCalls { - int gen; - Token first; - int arg; - JJCalls next; - } - -} diff --git a/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScript.jj b/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScript.jj deleted file mode 100644 index 83c663018..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScript.jj +++ /dev/null @@ -1,8109 +0,0 @@ -/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. LARAEcmaScript.jj */ -/*@egen*//* - * Copyright 2013 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - - -options { - - /* - * Default value is true. If true, all methods and class variables - * are specified as static in the generated parser and token manager. This allows only - * one parser object to be present, but it improves the performance of the parser. - */ - STATIC = false; - - /* - * Options for obtaining debugging information - */ - DEBUG_PARSER = false; - - DEBUG_TOKEN_MANAGER = false; - - /* - * Default value is false. When set to true, the generated parser - * uses an input stream object that processes Java Unicode escapes before - * sending characters to the token manager. - */ - JAVA_UNICODE_ESCAPE = true; - - /* - * Default value is false. When set to true, the generated parser - * uses uses an input stream object that reads Unicode files. By default, ASCII files - * are assumed. - */ - UNICODE_INPUT = true; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //sets first and last token of the node - /* - * JDK Version - */ - JDK_VERSION = "1.5"; - - /* - * Ignore case for keywords - */ - //IGNORE_CASE = true; -} - -PARSER_BEGIN(LARAEcmaScript) - -package org.dojo.jsl.parser.ast; - -import java.io.*; -import java.util.*; -import java.io.File; -import java.io.FileReader; -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import larac.utils.output.ErrorMsg; -import larac.objects.Enums.Types; -import larac.exceptions.ParseExceptionData; -import larac.exceptions.StopParseException; - -public class LARAEcmaScript extends LARAParserBase/*@bgen(jjtree)*/implements LARAEcmaScriptTreeConstants/*@egen*/{/*@bgen(jjtree)*/ - protected JJTLARAEcmaScriptState jjtree = new JJTLARAEcmaScriptState(); - -/*@egen*/ - private static final int MAX_EXCEPTION_TOKEN_SIZE = 6; - private static final int MAXIMUM_SYNTAX_EXCEPTIONS = 5; - - public File inputAspectFile = null; - public FileReader inputAspectFr = null; - public BufferedReader inputAspectBr = null; - public List exceptions = new ArrayList() ; - private int exprBraceCount = 0; - - public ASTExpressionStatement parseExpression(String expression) throws ParseException{ - return ParseExpression(); - } - - public ASTStart parse() throws ParseException{ - this.exceptions = new ArrayList(); - - return this.Start(); - } - - /* Old Code */ - @Deprecated - public static ASTStart parseFile(String fileName){ - return parseFile(new File(fileName)); - } - @Deprecated - public static ASTStart parseFile(File laraFile){ - ASTStart start = null; - File inputAspectFile = laraFile; - FileReader inputAspectFr = null; - BufferedReader inputAspectBr = null; - try{ - inputAspectFr = new FileReader(inputAspectFile); - inputAspectBr = new BufferedReader(inputAspectFr); - LARAEcmaScript aspectParser = new LARAEcmaScript(inputAspectBr); - start = aspectParser.Start(); - } - catch (Exception e) - { - try { - if(inputAspectFr != null) - inputAspectFr.close(); - if(inputAspectBr != null) - inputAspectBr.close(); - } catch (IOException e1) { - throw new RuntimeException(e1); - } - } - - try { - if(inputAspectFr != null) - inputAspectFr.close(); - if(inputAspectBr != null) - inputAspectBr.close(); - - } catch (IOException e1) { - throw new RuntimeException(e1); - } - return start; - } - -} -PARSER_END(LARAEcmaScript) - -TOKEN_MGR_DECLS : { - public int htmlTokenNestingLevel = 0; - public boolean expectActionScript = false; -} - - -/***************************************** - * LEXICAL & REGEXP GRAMMARS STARTS HERE * - *****************************************/ - - -/* Section 7 : Lexical Conventions */ - -/* Section 7.2 : White Space */ - - -SKIP: //SPECIAL_TOKEN : -{ - | | | | > -| - < #TAB: " " | "\t" > /* TAB */ -| - < #VT: "\u000b" > /* Vertical Tab */ -| - < #FF: " " | "\f"> /* Form Feed */ -| - < #SP: " " | " " > /* Space */ -| - < #NBSP: "\u00a0" > /* No-break space */ -| - < #USP: /* Other Unicode space seperator */ - ["\u2000"] - | ["\u2001"] - | ["\u2002"] - | ["\u2003"] - | ["\u2004"] - | ["\u2005"] - | ["\u2006"] - | ["\u2007"] - | ["\u2008"] - | ["\u2009"] - | ["\u200a"] - | ["\u200b"] - | ["\u3000"] - > -} - -/* Section 7.3 : Line Terminators */ - - -SKIP: //SPECIAL_TOKEN : -{ - | | | > -| - < #LF: "\n" > /* Line Feed */ -| - < #CR: "\r" > /* Carriage Return */ -| - < #LS: "\u2028" > /* Line separator */ -| - < #PS: "\u2029" > /* Paragraph separator */ -} - - -/* Comments */ - - -MORE : -{ - "//" : IN_SINGLE_LINE_COMMENT -| - "/*" : IN_MULTI_LINE_COMMENT -//| -// "/**" : IN_MULTI_LINE_DOC -} - - -SPECIAL_TOKEN : -{ - : DEFAULT -} - - -SPECIAL_TOKEN : -{ - : DEFAULT -} - -// -//SPECIAL_TOKEN : -//{ -// : DEFAULT -//} - - -MORE : -{ - < ~[] > -} - - - -/* Section 7.5.1: Reserved Words */ - - -TOKEN : -{ - /************************** LARA TOKENS *************************************/ - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - < STATICDECL: "static" > : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - /*******Tokens required for the dynamic apply ******/ - : DEFAULT -| - : DEFAULT -| - : DEFAULT -| - /************************** LARA TOKENS *************************************/ - < BREAK: "break" > : DEFAULT -| - < CONTINUE: "continue" > : DEFAULT -| - < DELETE: "delete" > : DEFAULT -| - < ELSE: "else" > : DEFAULT -| - < FOR: "for" > : DEFAULT -| - < FUNCTION: "function" > : DEFAULT -| - < FUNCTION_GEN: "function*" > : DEFAULT -| - < IF: "if" > : DEFAULT -| - < IN: "in" > : DEFAULT -| - < OF: "of" > : DEFAULT -| - < EACH: "each" > : DEFAULT -| - < NEW: "new" > : DEFAULT -| - < RETURN: "return" > : DEFAULT -| - < YIELD: "yield" > : DEFAULT -| - < THIS: "this" > : IN_REGEX -| - < TYPEOF: "typeof" > : DEFAULT -| - < VAR: "var" > : DEFAULT -| - < VOID: "void" > : DEFAULT -| - < WHILE: "while" > : DEFAULT -| - < WITH: "with" > : DEFAULT -| - < CASE: "case" > : DEFAULT -| - < CATCH: "catch" > : DEFAULT -| - < CLASS: "class" > : DEFAULT -| - < CONST: "const" > : DEFAULT -| - < DEBUGGER: "debugger" > : DEFAULT -| - < _DEFAULT: "default" > : DEFAULT -| - < DO: "do" > : DEFAULT -| - < ENUM: "enum" > : DEFAULT -| - < EXTENDS: "extends" > : DEFAULT -| - < FINALLY: "finally" > : DEFAULT -| - < IMPORT: "import" > : DEFAULT -| - < SUPER: "super" > : DEFAULT -| - < SWITCH: "switch" > : DEFAULT -| - < THROW: "throw" > : DEFAULT -| - < TRY: "try" > : DEFAULT -| - < ARROW: "=>" > : DEFAULT -//| -// < UTF8_BOM: "\u00ef\u00bb\u00bf" > : DEFAULT -} - - - -/* JScript .NET Tokens - -TOKEN : -{ - < BYTE: "byte" > - | < SBYTE: "sbyte" > - | < SHORT: "short" > - | < USHORT: "ushort" > - | < UINT: "uint" > - | < LONG: "long" > - | < ULONG: "ulong" > - | < FLOAT: "float" > - | < NUMBER: "Number" > - | < DOUBLE: "double" > - | < DECIMAL: "decimal" > - | < BOOLEAN: "boolean" > - | < STRING: "String" > - | < CHAR: "char" > -} - -*/ - - -/* Section 7.7: Punctuators */ - - -TOKEN : -{ - < LBRACE: "{" > : DEFAULT -| - < RBRACE: "}" > : IN_REGEX -| - < LPAREN: "(" > : DEFAULT -| - < RPAREN: ")" > : IN_REGEX -| - < LBRACKET: "[" > : DEFAULT -| - < RBRACKET: "]" > : IN_REGEX -| - < DOT: "." > : DEFAULT -| - < SEMICOLON: ";" > : DEFAULT -| - < COMMA: "," > : DEFAULT -| - < LT: "<" > : DEFAULT -| - < GT: ">" > : DEFAULT -| - < LE: "<=" > : DEFAULT -| - < GE: ">=" > : DEFAULT -| - < EQ: "==" > : DEFAULT -| - < NE: "!=" > : DEFAULT -| - : DEFAULT /* LARA operator */ -| - < SEQ: "===" > : DEFAULT /* Strict Equals Operator */ -| - < SNEQ: "!==" > : DEFAULT /* Strict Does-not-equal Operator */ -| - < PLUS: "+" > : DEFAULT -| - < MINUS: "-" > : DEFAULT -| - < STAR: "*" > : DEFAULT -| - < REM: "%" > : DEFAULT -| - < INCR: "++" > : IN_REGEX -| - < DECR: "--" > : IN_REGEX -| - < LSHIFT: "<<" > : DEFAULT -| - < RSHIFT: ">>" > : DEFAULT -| - < RUNSHIFT: ">>>" > : DEFAULT /* Unsigned Right Shift Operator */ -| - < BIT_AND: "&" > : DEFAULT -| - < BIT_OR: "|" > : DEFAULT -| - < XOR: "^" > : DEFAULT -| - < BANG: "!" > : DEFAULT -| - < TILDE: "~" > : IN_REGEX -| - < SC_AND: "&&" > : DEFAULT -| - < SC_OR: "||" > : DEFAULT -| - < HOOK: "?" > : DEFAULT -| - < NATURAL_JOIN: "::" > : DEFAULT /* LARA Operator*/ -| - < COLON: ":" > : DEFAULT -| - < ASSIGN: "=" > : DEFAULT -| - < PLUSASSIGN: "+=" > : DEFAULT -| - < MINUSASSIGN: "-=" > : DEFAULT -| - < STARASSIGN: "*=" > : DEFAULT -| - < REMASSIGN: "%=" > : DEFAULT -| - < LSHIFTASSIGN: "<<=" > : DEFAULT -| - < RSIGNEDSHIFTASSIGN: ">>=" > : DEFAULT -| - < RUNSIGNEDSHIFTASSIGN: ">>>=" > : DEFAULT -| - < ANDASSIGN: "&=" > : DEFAULT -| - < ORASSIGN: "|=" > : DEFAULT -| - < XORASSIGN: "^=" > : DEFAULT -| - < INTANCE_OF: "instanceof" > : DEFAULT -} - - -/* Section 7.8.3: Numeric Literals */ - - -TOKEN: -{ - < DECIMAL_LITERAL : - "." ()? ()? - | - "." ()? - | - ()? - > : IN_REGEX -| - < #NON_ZERO_DIGIT: ["1"-"9"] > -| - < #EXPONENT_PART: ("e" | "E") (["+","-"])? > -} - - -TOKEN: -{ - < DECIMAL_INTEGER_LITERAL: - "0" | ()? - > : IN_REGEX -} - - -TOKEN: -{ - < HEX_INTEGER_LITERAL: "0" ["x","X"] ()+ > : IN_REGEX -} - - -TOKEN: -{ < DECIMAL_DIGITS: ()+ > : IN_REGEX } - -TOKEN: -{ - < DECIMAL_DIGIT: ["0"-"9"] > -} - -/* Section 7.8.1: NULL Literals */ - - -TOKEN: -{ - < NULL_LITERAL: "null" > : IN_REGEX -} - -/* Section 7.8.2: Boolean Literals */ - - -TOKEN: -{ - < BOOLEAN_LITERAL: "true" | "false" > : IN_REGEX -} - - - -/* Section 7.8.4: String Literals */ - - -TOKEN: -{ - < STRING_LITERAL: - "\"" ()? "\"" | "'" ()? "'" - > : IN_REGEX -| - < #DOUBLE_STRING_CHARACTERS: ()* > -| - < #SINGLE_STRING_CHARACTERS: ()* > -| - < #DOUBLE_STRING_CHARACTER: - (~["\"","\\","\n","\r","\u2028","\u2029"])* - | "\\" - > -| - < #SINGLE_STRING_CHARACTER: - (~["'","\\","\n","\r","\u2028","\u2029"]) - | "\\" - > -| - < #ESCAPE_SEQUENCE: - - | - "0" - | - - | - - > -| - < #CHARACTER_ESCAPE_SEQUENCE: - | - > -| - < #SINGLE_ESCAPE_CHARACTER: ["'" , "\"" , "\\" , "b" , "f" , "n" , "r" , "t" , "v"] > -| - < #NON_ESCAPE_CHARACTER: - ~["\n","\r","\u2028","\u2029"] - | - ~["'" , "\"" , "\\" , "b" , "f" , "n" , "r" , "t" , "v", "x", "u"] - | - ~["0"-"9"] - > -} - -TOKEN: -{ - < HEX_ESCAPE_SEQUENCE: "x" > -} - -< DEFAULT, IN_REGEX > -TOKEN: -{ - : DEFAULT - -} - -/* -TOKEN: -{ - < ESCAPE_CHARACTER: - ["'" , "\"" , "\\" , "b" , "f" , "n" , "r" , "t" , "v"] - | ["0"-"9"] - | "x" - | "u" - > -} -*/ - -/* Section 7.6: Identifiers */ - - -TOKEN: -{ - < LABEL_IDENTIFIER: - "#" ()* - > : IN_REGEX -| - < IDENTIFIER_NAME: - ( ( | "*" | "#" | "^") ) - | - (( | < AT_SIGN >)? ()*) - > : IN_REGEX -| - < #IDENTIFIER_START: - - | - - | - - > -| - < #IDENTIFIER_PART: - - | - - | - - | - - | - - | - - > -| - < #DOLLAR_SIGN: "$" > -| - < #AT_SIGN: "@" > -| - < #UNDER_SCORE: "_" > -| - < #UNICODE_LETTER: - ["A"-"Z"] - | ["a"-"z"] - | ["A"-"Z"] - | ["a"-"z"] - | ["\u00aa"] - | ["\u00b5"] - | ["\u00ba"] - | ["\u00c0"-"\u00d6"] - | ["\u00d8"-"\u00f6"] - | ["\u00f8"-"\u021f"] - | ["\u0222"-"\u0233"] - | ["\u0250"-"\u02ad"] - | ["\u02b0"-"\u02b8"] - | ["\u02bb"-"\u02c1"] - | ["\u02d0"-"\u02d1"] - | ["\u02e0"-"\u02e4"] - | ["\u02ee"] - | ["\u037a"] - | ["\u0386"] - | ["\u0388"-"\u038a"] - | ["\u038c"] - | ["\u038e"-"\u03a1"] - | ["\u03a3"-"\u03ce"] - | ["\u03d0"-"\u03d7"] - | ["\u03da"-"\u03f3"] - | ["\u0400"-"\u0481"] - | ["\u048c"-"\u04c4"] - | ["\u04c7"-"\u04c8"] - | ["\u04cb"-"\u04cc"] - | ["\u04d0"-"\u04f5"] - | ["\u04f8"-"\u04f9"] - | ["\u0531"-"\u0556"] - | ["\u0559"] - | ["\u0561"-"\u0587"] - | ["\u05d0"-"\u05ea"] - | ["\u05f0"-"\u05f2"] - | ["\u0621"-"\u063a"] - | ["\u0640"-"\u064a"] - | ["\u0671"-"\u06d3"] - | ["\u06d5"] - | ["\u06e5"-"\u06e6"] - | ["\u06fa"-"\u06fc"] - | ["\u0710"] - | ["\u0712"-"\u072c"] - | ["\u0780"-"\u07a5"] - | ["\u0905"-"\u0939"] - | ["\u093d"] - | ["\u0950"] - | ["\u0958"-"\u0961"] - | ["\u0985"-"\u098c"] - | ["\u098f"-"\u0990"] - | ["\u0993"-"\u09a8"] - | ["\u09aa"-"\u09b0"] - | ["\u09b2"] - | ["\u09b6"-"\u09b9"] - | ["\u09dc"-"\u09dd"] - | ["\u09df"-"\u09e1"] - | ["\u09f0"-"\u09f1"] - | ["\u0a05"-"\u0a0a"] - | ["\u0a0f"-"\u0a10"] - | ["\u0a13"-"\u0a28"] - | ["\u0a2a"-"\u0a30"] - | ["\u0a32"-"\u0a33"] - | ["\u0a35"-"\u0a36"] - | ["\u0a38"-"\u0a39"] - | ["\u0a59"-"\u0a5c"] - | ["\u0a5e"] - | ["\u0a72"-"\u0a74"] - | ["\u0a85"-"\u0a8b"] - | ["\u0a8d"] - | ["\u0a8f"-"\u0a91"] - | ["\u0a93"-"\u0aa8"] - | ["\u0aaa"-"\u0ab0"] - | ["\u0ab2"-"\u0ab3"] - | ["\u0ab5"-"\u0ab9"] - | ["\u0abd"] - | ["\u0ad0"] - | ["\u0ae0"] - | ["\u0b05"-"\u0b0c"] - | ["\u0b0f"-"\u0b10"] - | ["\u0b13"-"\u0b28"] - | ["\u0b2a"-"\u0b30"] - | ["\u0b32"-"\u0b33"] - | ["\u0b36"-"\u0b39"] - | ["\u0b3d"] - | ["\u0b5c"-"\u0b5d"] - | ["\u0b5f"-"\u0b61"] - | ["\u0b85"-"\u0b8a"] - | ["\u0b8e"-"\u0b90"] - | ["\u0b92"-"\u0b95"] - | ["\u0b99"-"\u0b9a"] - | ["\u0b9c"] - | ["\u0b9e"-"\u0b9f"] - | ["\u0ba3"-"\u0ba4"] - | ["\u0ba8"-"\u0baa"] - | ["\u0bae"-"\u0bb5"] - | ["\u0bb7"-"\u0bb9"] - | ["\u0c05"-"\u0c0c"] - | ["\u0c0e"-"\u0c10"] - | ["\u0c12"-"\u0c28"] - | ["\u0c2a"-"\u0c33"] - | ["\u0c35"-"\u0c39"] - | ["\u0c60"-"\u0c61"] - | ["\u0c85"-"\u0c8c"] - | ["\u0c8e"-"\u0c90"] - | ["\u0c92"-"\u0ca8"] - | ["\u0caa"-"\u0cb3"] - | ["\u0cb5"-"\u0cb9"] - | ["\u0cde"] - | ["\u0ce0"-"\u0ce1"] - | ["\u0d05"-"\u0d0c"] - | ["\u0d0e"-"\u0d10"] - | ["\u0d12"-"\u0d28"] - | ["\u0d2a"-"\u0d39"] - | ["\u0d60"-"\u0d61"] - | ["\u0d85"-"\u0d96"] - | ["\u0d9a"-"\u0db1"] - | ["\u0db3"-"\u0dbb"] - | ["\u0dbd"] - | ["\u0dc0"-"\u0dc6"] - | ["\u0e01"-"\u0e30"] - | ["\u0e32"-"\u0e33"] - | ["\u0e40"-"\u0e46"] - | ["\u0e81"-"\u0e82"] - | ["\u0e84"] - | ["\u0e87"-"\u0e88"] - | ["\u0e8a"] - | ["\u0e8d"] - | ["\u0e94"-"\u0e97"] - | ["\u0e99"-"\u0e9f"] - | ["\u0ea1"-"\u0ea3"] - | ["\u0ea5"] - | ["\u0ea7"] - | ["\u0eaa"-"\u0eab"] - | ["\u0ead"-"\u0eb0"] - | ["\u0eb2"-"\u0eb3"] - | ["\u0ebd"-"\u0ec4"] - | ["\u0ec6"] - | ["\u0edc"-"\u0edd"] - | ["\u0f00"] - | ["\u0f40"-"\u0f6a"] - | ["\u0f88"-"\u0f8b"] - | ["\u1000"-"\u1021"] - | ["\u1023"-"\u1027"] - | ["\u1029"-"\u102a"] - | ["\u1050"-"\u1055"] - | ["\u10a0"-"\u10c5"] - | ["\u10d0"-"\u10f6"] - | ["\u1100"-"\u1159"] - | ["\u115f"-"\u11a2"] - | ["\u11a8"-"\u11f9"] - | ["\u1200"-"\u1206"] - | ["\u1208"-"\u1246"] - | ["\u1248"] - | ["\u124a"-"\u124d"] - | ["\u1250"-"\u1256"] - | ["\u1258"] - | ["\u125a"-"\u125d"] - | ["\u1260"-"\u1286"] - | ["\u1288"] - | ["\u128a"-"\u128d"] - | ["\u1290"-"\u12ae"] - | ["\u12b0"] - | ["\u12b2"-"\u12b5"] - | ["\u12b8"-"\u12be"] - | ["\u12c0"] - | ["\u12c2"-"\u12c5"] - | ["\u12c8"-"\u12ce"] - | ["\u12d0"-"\u12d6"] - | ["\u12d8"-"\u12ee"] - | ["\u12f0"-"\u130e"] - | ["\u1310"] - | ["\u1312"-"\u1315"] - | ["\u1318"-"\u131e"] - | ["\u1320"-"\u1346"] - | ["\u1348"-"\u135a"] - | ["\u13a0"-"\u13b0"] - | ["\u13b1"-"\u13f4"] - | ["\u1401"-"\u1676"] - | ["\u1681"-"\u169a"] - | ["\u16a0"-"\u16ea"] - | ["\u1780"-"\u17b3"] - | ["\u1820"-"\u1877"] - | ["\u1880"-"\u18a8"] - | ["\u1e00"-"\u1e9b"] - | ["\u1ea0"-"\u1ee0"] - | ["\u1ee1"-"\u1ef9"] - | ["\u1f00"-"\u1f15"] - | ["\u1f18"-"\u1f1d"] - | ["\u1f20"-"\u1f39"] - | ["\u1f3a"-"\u1f45"] - | ["\u1f48"-"\u1f4d"] - | ["\u1f50"-"\u1f57"] - | ["\u1f59"] - | ["\u1f5b"] - | ["\u1f5d"] - | ["\u1f5f"-"\u1f7d"] - | ["\u1f80"-"\u1fb4"] - | ["\u1fb6"-"\u1fbc"] - | ["\u1fbe"] - | ["\u1fc2"-"\u1fc4"] - | ["\u1fc6"-"\u1fcc"] - | ["\u1fd0"-"\u1fd3"] - | ["\u1fd6"-"\u1fdb"] - | ["\u1fe0"-"\u1fec"] - | ["\u1ff2"-"\u1ff4"] - | ["\u1ff6"-"\u1ffc"] - | ["\u207f"] - | ["\u2102"] - | ["\u2107"] - | ["\u210a"-"\u2113"] - | ["\u2115"] - | ["\u2119"-"\u211d"] - | ["\u2124"] - | ["\u2126"] - | ["\u2128"] - | ["\u212a"-"\u212d"] - | ["\u212f"-"\u2131"] - | ["\u2133"-"\u2139"] - | ["\u2160"-"\u2183"] - | ["\u3005"-"\u3007"] - | ["\u3021"-"\u3029"] - | ["\u3031"-"\u3035"] - | ["\u3038"-"\u303a"] - | ["\u3041"-"\u3094"] - | ["\u309d"-"\u309e"] - | ["\u30a1"-"\u30fa"] - | ["\u30fc"-"\u30fe"] - | ["\u3105"-"\u312c"] - | ["\u3131"-"\u318e"] - | ["\u31a0"-"\u31b7"] - | ["\u3400"] - | ["\u4db5"] - | ["\u4e00"] - | ["\u9fa5"] - | ["\ua000"-"\ua48c"] - | ["\uac00"] - | ["\ud7a3"] - | ["\uf900"-"\ufa2d"] - | ["\ufb00"-"\ufb06"] - | ["\ufb13"-"\ufb17"] - | ["\ufb1d"] - | ["\ufb1f"-"\ufb28"] - | ["\ufb2a"-"\ufb36"] - | ["\ufb38"-"\ufb3c"] - | ["\ufb3e"] - | ["\ufb40"-"\ufb41"] - | ["\ufb43"-"\ufb44"] - | ["\ufb46"-"\ufbb1"] - | ["\ufbd3"-"\ufd3d"] - | ["\ufd50"-"\ufd8f"] - | ["\ufd92"-"\ufdc7"] - | ["\ufdf0"-"\ufdfb"] - | ["\ufe70"-"\ufe72"] - | ["\ufe74"] - | ["\ufe76"-"\ufefc"] - | ["\uff21"-"\uff3a"] - | ["\uff41"-"\uff5a"] - | ["\uff66"-"\uffbe"] - | ["\uffc2"-"\uffc7"] - | ["\uffca"-"\uffcf"] - | ["\uffd2"-"\uffd7"] - | ["\uffda"-"\uffdc"] - > -} - -/* - * Unicode categories Non-spacing mark (MN) OR Combining spacing mark (MC) - */ -MORE: -{ - < UNICODE_COMBINING_MARK: | > -} - - -TOKEN: -{ - < MC: - ["\u0903"] - | ["\u093e"] - | ["\u093f"] - | ["\u0940"] - | ["\u0949"] - | ["\u094a"] - | ["\u094b"] - | ["\u094c"] - | ["\u0982"] - | ["\u0983"] - | ["\u09be"] - | ["\u09bf"] - | ["\u09c0"] - | ["\u09c7"] - | ["\u09c8"] - | ["\u09cb"] - | ["\u09cc"] - | ["\u09d7"] - | ["\u0a03"] - | ["\u0a3e"] - | ["\u0a3f"] - | ["\u0a40"] - | ["\u0a83"] - | ["\u0abe"] - | ["\u0abf"] - | ["\u0ac0"] - | ["\u0ac9"] - | ["\u0acb"] - | ["\u0acc"] - | ["\u0b02"] - | ["\u0b03"] - | ["\u0b3e"] - | ["\u0b40"] - | ["\u0b47"] - | ["\u0b48"] - | ["\u0b4b"] - | ["\u0b4c"] - | ["\u0b57"] - | ["\u0bbe"] - | ["\u0bbf"] - | ["\u0bc1"] - | ["\u0bc2"] - | ["\u0bc6"] - | ["\u0bc7"] - | ["\u0bc8"] - | ["\u0bca"] - | ["\u0bcb"] - | ["\u0bcc"] - | ["\u0bd7"] - | ["\u0c01"] - | ["\u0c02"] - | ["\u0c03"] - | ["\u0c41"] - | ["\u0c42"] - | ["\u0c43"] - | ["\u0c44"] - | ["\u0c82"] - | ["\u0c83"] - | ["\u0cbe"] - | ["\u0cc0"] - | ["\u0cc1"] - | ["\u0cc2"] - | ["\u0cc3"] - | ["\u0cc4"] - | ["\u0cc7"] - | ["\u0cc8"] - | ["\u0cca"] - | ["\u0ccb"] - | ["\u0cd5"] - | ["\u0cd6"] - | ["\u0d02"] - | ["\u0d03"] - | ["\u0d3e"] - | ["\u0d3f"] - | ["\u0d40"] - | ["\u0d46"] - | ["\u0d47"] - | ["\u0d48"] - | ["\u0d4a"] - | ["\u0d4b"] - | ["\u0d4c"] - | ["\u0d57"] - | ["\u0d82"] - | ["\u0d83"] - | ["\u0dcf"] - | ["\u0dd0"] - | ["\u0dd1"] - | ["\u0dd8"] - | ["\u0dd9"] - | ["\u0dda"] - | ["\u0ddb"] - | ["\u0ddc"] - | ["\u0ddd"] - | ["\u0dde"] - | ["\u0ddf"] - | ["\u0df2"] - | ["\u0df3"] - | ["\u0f3e"] - | ["\u0f3f"] - | ["\u0f7f"] - | ["\u102c"] - | ["\u1031"] - | ["\u1038"] - | ["\u1056"] - | ["\u1057"] - | ["\u17b6"] - | ["\u17be"] - | ["\u17bf"] - | ["\u17c0"] - | ["\u17c1"] - | ["\u17c2"] - | ["\u17c3"] - | ["\u17c4"] - | ["\u17c5"] - | ["\u17c7"] - | ["\u17c8"] - | ["\u1923"] - | ["\u1924"] - | ["\u1925"] - | ["\u1926"] - | ["\u1929"] - | ["\u192a"] - | ["\u192b"] - | ["\u1930"] - | ["\u1931"] - | ["\u1933"] - | ["\u1934"] - | ["\u1935"] - | ["\u1936"] - | ["\u1937"] - | ["\u1938"] - | ["\u19b0"] - | ["\u19b1"] - | ["\u19b2"] - | ["\u19b3"] - | ["\u19b4"] - | ["\u19b5"] - | ["\u19b6"] - | ["\u19b7"] - | ["\u19b8"] - | ["\u19b9"] - | ["\u19ba"] - | ["\u19bb"] - | ["\u19bc"] - | ["\u19bd"] - | ["\u19be"] - | ["\u19bf"] - | ["\u19c0"] - | ["\u19c8"] - | ["\u19c9"] - | ["\u1a19"] - | ["\u1a1a"] - | ["\u1a1b"] - | ["\ua802"] - | ["\ua823"] - | ["\ua824"] - | ["\ua827"] - | ["\u1d16"] - | ["\u1d16"] - | ["\u1d16"] - | ["\u1d16"] - | ["\u1d16"] - | ["\u1d17"] - | ["\u1d17"] - | ["\u1d17"] - > -| - < MN: - ["\u0300"-"\u034e"] - | ["\u0360"-"\u0362"] - | ["\u0483"-"\u0486"] - | ["\u0591"-"\u05a1"] - | ["\u05a3"-"\u05b9"] - | ["\u05bb"-"\u05bd"] - | ["\u05bf"] - | ["\u05c1"-"\u05c2"] - | ["\u05c4"] - | ["\u064b"-"\u0655"] - | ["\u0670"] - | ["\u06d6"-"\u06dc"] - | ["\u06df"-"\u06e4"] - | ["\u06e7"-"\u06e8"] - | ["\u06ea"-"\u06ed"] - | ["\u0711"] - | ["\u0730"-"\u074a"] - | ["\u07a6"-"\u07b0"] - | ["\u0901"-"\u0903"] - | ["\u093c"] - | ["\u093e"-"\u094d"] - | ["\u0951"-"\u0954"] - | ["\u0962"-"\u0963"] - | ["\u0981"-"\u0983"] - | ["\u09bc"-"\u09c4"] - | ["\u09c7"-"\u09c8"] - | ["\u09cb"-"\u09cd"] - | ["\u09d7"] - | ["\u09e2"-"\u09e3"] - | ["\u0a02"] - | ["\u0a3c"] - | ["\u0a3e"-"\u0a42"] - | ["\u0a47"-"\u0a48"] - | ["\u0a4b"-"\u0a4d"] - | ["\u0a70"-"\u0a71"] - | ["\u0a81"-"\u0a83"] - | ["\u0abc"] - | ["\u0abe"-"\u0ac5"] - | ["\u0ac7"-"\u0ac9"] - | ["\u0acb"-"\u0acd"] - | ["\u0b01"-"\u0b03"] - | ["\u0b3c"] - | ["\u0b3e"-"\u0b43"] - | ["\u0b47"-"\u0b48"] - | ["\u0b4b"-"\u0b4d"] - | ["\u0b56"-"\u0b57"] - | ["\u0b82"-"\u0b83"] - | ["\u0bbe"-"\u0bc2"] - | ["\u0bc6"-"\u0bc8"] - | ["\u0bca"-"\u0bcd"] - | ["\u0bd7"] - | ["\u0c01"-"\u0c03"] - | ["\u0c3e"-"\u0c44"] - | ["\u0c46"-"\u0c48"] - | ["\u0c4a"-"\u0c4d"] - | ["\u0c55"-"\u0c56"] - | ["\u0c82"-"\u0c83"] - | ["\u0cbe"-"\u0cc4"] - | ["\u0cc6"-"\u0cc8"] - | ["\u0cca"-"\u0ccd"] - | ["\u0cd5"-"\u0cd6"] - | ["\u0d02"-"\u0d03"] - | ["\u0d3e"-"\u0d43"] - | ["\u0d46"-"\u0d48"] - | ["\u0d4a"-"\u0d4d"] - | ["\u0d57"] - | ["\u0d82"-"\u0d83"] - | ["\u0dca"] - | ["\u0dcf"-"\u0dd4"] - | ["\u0dd6"] - | ["\u0dd8"-"\u0ddf"] - | ["\u0df2"-"\u0df3"] - | ["\u0e31"] - | ["\u0e34"-"\u0e3a"] - | ["\u0e47"-"\u0e4e"] - | ["\u0eb1"] - | ["\u0eb4"-"\u0eb9"] - | ["\u0ebb"-"\u0ebc"] - | ["\u0ec8"-"\u0ecd"] - | ["\u0f18"-"\u0f19"] - | ["\u0f35"] - | ["\u0f37"] - | ["\u0f39"] - | ["\u0f3e"-"\u0f3f"] - | ["\u0f71"-"\u0f84"] - | ["\u0f86"-"\u0f87"] - | ["\u0f90"-"\u0f97"] - | ["\u0f99"-"\u0fbc"] - | ["\u0fc6"] - | ["\u102c"-"\u1032"] - | ["\u1036"-"\u1039"] - | ["\u1056"-"\u1059"] - | ["\u17b4"-"\u17d3"] - | ["\u18a9"] - | ["\u20d0"-"\u20dc"] - | ["\u20e1"] - | ["\u302a"-"\u302f"] - | ["\u3099"-"\u309a"] - | ["\ufb1e"] - | ["\ufe20"-"\ufe23"] - > -} - -TOKEN: -{ - < UNICODE_DIGIT: - ["0"-"9"] - | ["\u0660"-"\u0669"] - | ["\u06f0"-"\u06f9"] - | ["\u0966"-"\u096f"] - | ["\u09e6"-"\u09ef"] - | ["\u0a66"-"\u0a6f"] - | ["\u0ae6"-"\u0aef"] - | ["\u0b66"-"\u0b6f"] - | ["\u0be7"-"\u0bef"] - | ["\u0c66"-"\u0c6f"] - | ["\u0ce6"-"\u0cef"] - | ["\u0d66"-"\u0d6f"] - | ["\u0e50"-"\u0e59"] - | ["\u0ed0"-"\u0ed9"] - | ["\u0f20"-"\u0f29"] - | ["\u1040"-"\u1049"] - | ["\u1369"-"\u1371"] - | ["\u17e0"-"\u17e9"] - | ["\u1810"-"\u1819"] - | ["\uff10"-"\uff19"] - > -} - -TOKEN: -{ - < UNICODE_CONNECTOR_PUNCTUATION: - ["_"] - | - ["\u203f"-"\u2040"] - | - ["\u30fb"] - | - ["\ufe33"-"\ufe34"] - | - ["\ufe4d"-"\ufe4f"] - | - ["\uff3f"] - | - ["\uff65"] - > -} - -TOKEN: -{ - < UNICODE_ESCAPE_SEQUENCE: "u" > -} - -TOKEN: -{ - < HEX_DIGIT: ["0"-"9"] | ["a"-"f"] | ["A"-"F"] > -} - - - - -TOKEN : -{ - < SLASHASSIGN: "/=" > : DEFAULT -| - < SLASH: "/" > : DEFAULT -} - - /* ************************* LARA TOKENS ************************************* - -TOKEN : /* JP IDENTIFIERS * -{ - < JPVAR: "$" ( | )> :DEFAULT | - < #IN_JPVAR: | | < END > | | | | | > -} - /* ************************* LARA TOKENS ************************************* / - -/* Section 7.8.5: Regular Expression Literals */ - - -TOKEN : -{ - < REGULAR_EXPRESSION_LITERAL: - "/" ( (~["\n","\r","\\","/","*"]) | ) - ( (~["\n","\r","\\","/"]) | )* "/" ()* - > : IN_REGEX -| - < #BACKSLASH_SEQUENCE: - "\\" (~["\n","\r"]) - > -} - - -/** Function that returns the join point identifier, which can be any identifier - or one of the following reserved words - **/ - Token getNoReservedIdentifier() : - {Token t;} - { - ( - t= | - t= | t= | t=< END > | - t= | t= | t= | t= | t= | - t= | t= | t= | t= | t=< SWITCH > | t=< CASE > | - t= | t= | t= | t=<_DEFAULT> | t= | t=< INTANCE_OF > | - t= | t= | t= | - t= | t= |t= | t= |t=< REPLACE > |t=< CHECK > |t=< APPLY > - ) - {return t;} - } - - - - void noReservedIdentifier() : - {/*@bgen(jjtree) Identifier */ - ASTIdentifier jjtn000 = new ASTIdentifier(JJTIDENTIFIER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token t;} - {/*@bgen(jjtree) Identifier */ - try { -/*@egen*/ - ( - t= | - t= | t= | t=< END > | - t= | t= | t= | t= | t= | - t= | t= | t= | t= | t=< SWITCH > | t=< CASE > | - t= | t= | t= | t=<_DEFAULT> | t=< CLASS > | t=< INTANCE_OF > | - t= | t= | t= | - t= | t= |t= | t= | - t= |t=< REPLACE > | t=< CHECK > | t=< APPLY > - )/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { jjtn000.setName(t.image);jjtn000.jjtSetValue(t.image); - //jjtThis.setCoord(t,t); - }/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - -/***************************************** - * ECMA SYNTACTIC GRAMMARS STARTS HERE * - *****************************************/ - -/******************************************************************************* - ************************ LARA SYNTACTIC GRAMMAR ************************* - *******************************************************************************/ - - /** - * A LARA file can contain zero or more includes and imports, followed by definitions of aspectdefs, - * codedefs, functions and global variables - **/ - ASTStart Start() : - {/*@bgen(jjtree) Start */ - ASTStart jjtn000 = new ASTStart(JJTSTART); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) Start */ - try { -/*@egen*/ -// [] - (Import())* - (AspectDef() - | CodeDef() - | Declaration() - )* - /*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { return jjtn000; }/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void Declaration() : { } - { - - LOOKAHEAD(( ) Identifier()) GeneratorFunctionDeclaration() - | LOOKAHEAD(( ) Identifier()) FunctionDeclaration() - | VariableStatement() - // TODO: Enable this, disable the one below, implement declareGlobal - //| Expression() ( )? - - |/*@bgen(jjtree) AssignmentExpression */ - { - ASTAssignmentExpression jjtn001 = new ASTAssignmentExpression(JJTASSIGNMENTEXPRESSION); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - ( - - LeftHandSideExpression() AssignmentOperator() AssignmentExpression() [] - )/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - - } - - /** - * The path to a file that is not in the same path of the invoked LARA file. With one import it is - * possible to import one or every file within a package - **/ - void Import() : - {/*@bgen(jjtree) Import */ - ASTImport jjtn000 = new ASTImport(JJTIMPORT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token t; Token begin; Token end;} - {/*@bgen(jjtree) Import */ - try { -/*@egen*/ - begin= t=FilePath() end=EndStatement()/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - {jjtn000.jjtSetValue(t.image);}/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - // { jjtThis.setCoord(begin,end);} - } - /** FilePath - * gets the path to a file or all the files in the package - **/ - Token FilePath(): - {Token t;} - { - (LOOKAHEAD(2)Identifier())* (t= |t=) - {return t;} - } - - /** FilePathNoSTar - * gets the path to a file in a package - **/ - void FilePathNoSTar() : - {/*@bgen(jjtree) FilePath */ - ASTFilePath jjtn000 = new ASTFilePath(JJTFILEPATH); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) FilePath */ - try { -/*@egen*/ - (LOOKAHEAD(2)Identifier())+/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /** - * Code Definition A parcel of native code or LARA-Code to be used by the insert/output action. To define the target - * language, one has to define the type of the codedef, such as: codedef, this means that the code to be inserted - * is written in C language. A code definition needs an identifier and its body is code that can contain a tag such - * as "" to insert information on the code such as: join point property or a variable value. To use those tags, - * the codedef must have input arguments to refer those to specific values. - **/ - void CodeDef() : - {/*@bgen(jjtree) CodeDef */ - ASTCodeDef jjtn000 = new ASTCodeDef(JJTCODEDEF); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token name, code, language, begin, end;} - {/*@bgen(jjtree) CodeDef */ - try { -/*@egen*/ - {jjtn000.setLanguage("native");} - begin=[ language= {jjtn000.setLanguage(language.image);}] - name= {jjtn000.setName(name.image);}/*@bgen(jjtree) #FormalParameterList(> 0) */ - { - ASTFormalParameterList jjtn001 = new ASTFormalParameterList(JJTFORMALPARAMETERLIST); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - ( [ [FormalParameterList()] ] )/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 0); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - code = - { - String simpleCode = code.image.substring(2,code.image.length()-2); - jjtn000.setCode(simpleCode); - } - end=/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - - // { jjtThis.setCoord(begin,end);} - } - - /** - * Input arguments The arguments to be defined when a "aspect-call" action is stated. They can be normal variables - * or variables referent to a specific join point. The normal variables can have a default value - **/ - void Input() : {/*@bgen(jjtree) Input */ - ASTInput jjtn000 = new ASTInput(JJTINPUT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/ Token begin, end;} - {/*@bgen(jjtree) Input */ - try { -/*@egen*/ - begin= - VariableDeclarationList() ()? - end=/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - //{ jjtThis.setCoord(begin,end);} - } - - /** - * Output arguments List of normal variables or variables referent to a specific join point. The normal variables - * can have a default value - **/ - void Output() : {/*@bgen(jjtree) Output */ - ASTOutput jjtn000 = new ASTOutput(JJTOUTPUT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/ Token begin, end;} - {/*@bgen(jjtree) Output */ - try { -/*@egen*/ - begin= - VariableDeclarationList() ()? - end=/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /** - * Static List of static variables and functions, which can be accessed statically in the aspect. The variables - * values are shared between all aspect instances - **/ - void Static() : {/*@bgen(jjtree) Static */ - ASTStatic jjtn000 = new ASTStatic(JJTSTATIC); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) Static */ - try { -/*@egen*/ - - (VariableStatement()| GeneratorFunctionDeclaration() | FunctionDeclaration())* - /*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /** Initialize - * Similar to a constructor. A block of JavaScript code to initialize variables, inter alia - **/ - void Initialize() : {/*@bgen(jjtree) Initialize */ - ASTInitialize jjtn000 = new ASTInitialize(JJTINITIALIZE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) Initialize */ - try { -/*@egen*/ - - JavaScript() - /*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - /** Finalize - * Similar to a destructor. A block of JavaScript code to finalize output variables, inter alia - **/ - void Finalize() : {/*@bgen(jjtree) Finalize */ - ASTFinalize jjtn000 = new ASTFinalize(JJTFINALIZE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) Finalize */ - try { -/*@egen*/ - - JavaScript() - /*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /** Check - * Set of conditions to verify input arguments and other important stats that specify if the aspect can be executed - **/ - void Check() : {/*@bgen(jjtree) Check */ - ASTCheck jjtn000 = new ASTCheck(JJTCHECK); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) Check */ - try { -/*@egen*/ - - LogicalORExpression() [EndStatement() (LogicalORExpression() EndStatement())*] - /*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /** Aspect Definition - * The aspect definition can contain outputs and inputs variables, a check to verify those variables, an initializer and a finalizer to deal with information to be handler before and after the aspect, respectively. - * The body of the aspect consists of selects, applies and conditions to apply the aspect in the target program, and afters, befores, function and variable declaration to assist the apply and condition section. - */ - void AspectDef() : - {/*@bgen(jjtree) AspectDef */ - ASTAspectDef jjtn000 = new ASTAspectDef(JJTASPECTDEF); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token aspName, begin, end;} - {/*@bgen(jjtree) AspectDef */ - try { -/*@egen*/ - begin= - aspName= - ( - Input() - | - Output() - | - Static() - )* - - [ Initialize() ] - [ Check() ] - ( - ( - LOOKAHEAD([Identifier() ] ( - LOOKAHEAD((getNoReservedIdentifier()(||)) - | ([]getNoReservedIdentifier() )) Pointcut() | - - LOOKAHEAD(2) FourthSetOp()) end=< END >/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - //{ jjtThis.setCoord(begin,end);} - } - - void FourthSetOp() : - {/*@bgen(jjtree) #Join(> 1) */ - ASTJoin jjtn000 = new ASTJoin(JJTJOIN); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token joinType;} - {/*@bgen(jjtree) #Join(> 1) */ - try { -/*@egen*/ - ThirdSetOp() [LOOKAHEAD(2)joinType=FourthSetOp() - {jjtn000.jjtSetValue(joinType.image);}]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void ThirdSetOp() : - {/*@bgen(jjtree) #Join(> 1) */ - ASTJoin jjtn000 = new ASTJoin(JJTJOIN); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token joinType;} - {/*@bgen(jjtree) #Join(> 1) */ - try { -/*@egen*/ - FirstSetOp() [(joinType=|joinType=) ThirdSetOp() - {jjtn000.jjtSetValue(joinType.image);}]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void FirstSetOp():{} - { - Identifier() | ( FourthSetOp()) - } - - /** Pointcut - * It can contain an identifier for the join point, a join point identifier and a possible property expression. - * Each join point can have a child, the join point down to its hierarchy - */ - void Pointcut() : - {/*@bgen(jjtree) Pointcut */ - ASTPointcut jjtn000 = new ASTPointcut(JJTPOINTCUT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token joinPoint,reference;String referenceStr;} - {/*@bgen(jjtree) Pointcut */ - try { -/*@egen*/ - ( - //e.g.: ($l1=loop){...} - - reference = < IDENTIFIER_NAME> - joinPoint = getNoReservedIdentifier() - {referenceStr = reference.image;} - - | - LOOKAHEAD(< IDENTIFIER_NAME > ) //e.g.: $l1=loop{...} - reference = < IDENTIFIER_NAME> - joinPoint = getNoReservedIdentifier() - {referenceStr = reference.image;} - | - joinPoint = getNoReservedIdentifier() ////e.g.: loop{...} - {referenceStr = "$"+joinPoint.image;} - - ) - { - jjtn000.jjtSetValue(joinPoint.image); - jjtn000.setReference(referenceStr); - } - - [PointcutFilters()] - [ Pointcut()]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /** Pointcut properties - * The properties of a pointcut can be declared in three different ways: - - it can be any property (*) - - a set of properties that will be mapped to the default attribute - - a property expression - */ - void PointcutFilters(): - {} - { - - (|/*@bgen(jjtree) PointcutFilters */ - { - ASTPointcutFilters jjtn002 = new ASTPointcutFilters(JJTPOINTCUTFILTERS); - boolean jjtc002 = true; - jjtree.openNodeScope(jjtn002); - jjtn002.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - (LOOKAHEAD( (EqualityOperator()|RelationalOperator()) | ) - ( - OrFiltersExpr()/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn002, true); - jjtc002 = false; - jjtn002.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - {jjtn002.setFullSpecified(true);} - ) - | - (/*@bgen(jjtree) #OrFiltersExpr(> 1) */ - { - ASTOrFiltersExpr jjtn001 = new ASTOrFiltersExpr(JJTORFILTERSEXPR); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - - ( ConditionalExpression() - ( ConditionalExpression())* - )/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ /*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn002, true); - jjtc002 = false; - jjtn002.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - {jjtn002.setFullSpecified(false);} - ) - )/*@bgen(jjtree)*/ - } catch (Throwable jjte002) { - if (jjtc002) { - jjtree.clearNodeScope(jjtn002); - jjtc002 = false; - } else { - jjtree.popNode(); - } - if (jjte002 instanceof RuntimeException) { - throw (RuntimeException)jjte002; - } - if (jjte002 instanceof ParseException) { - throw (ParseException)jjte002; - } - throw (Error)jjte002; - } finally { - if (jjtc002) { - jjtree.closeNodeScope(jjtn002, true); - jjtn002.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - - ) - - } - - /** "OR" Property Expr - * In the pointcut properties declaration, the comma is used as an OR operator (similar to ||) - **/ - void OrFiltersExpr() :{} - {/*@bgen(jjtree) #OrFiltersExpr(> 1) */ - { - ASTOrFiltersExpr jjtn001 = new ASTOrFiltersExpr(JJTORFILTERSEXPR); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - (ANDFiltersExpr() ( ANDFiltersExpr() )*)/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /** "AND" Property Expression - * To combine properties such as an AND operation, the properties are declared inside brackets, converting the comma (which is the OR operator) into an AND. - */ - void ANDFiltersExpr():{} - { - Filter() | /*@bgen(jjtree) #ANDFiltersExpr(> 1) */ - { - ASTANDFiltersExpr jjtn001 = new ASTANDFiltersExpr(JJTANDFILTERSEXPR); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ (Filter() ( Filter() )*)/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /** Property - * The property is defined by comparing a join point attribute to a value - **/ - void Filter() : - {/*@bgen(jjtree) Filter */ - ASTFilter jjtn000 = new ASTFilter(JJTFILTER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token prop,op;} - {/*@bgen(jjtree) Filter */ - try { -/*@egen*/ - prop= (EqualityOperator()|RelationalOperator()) ConditionalExpression()/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - {jjtn000.setProp(prop.image); - }/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - /** Around - * A Statement to occur around an apply - * It contains a list of applies that this statement refers to. The body of this statement is JavaScript, and can be used to prepare information for the applies. - **/ - void AroundApply() : - {/*@bgen(jjtree) AroundApply */ - ASTAroundApply jjtn000 = new ASTAroundApply(JJTAROUNDAPPLY); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token name,when, end; - String label = "";} - {/*@bgen(jjtree) AroundApply */ - try { -/*@egen*/ - [name= {label = name.image;}] ( when= | when= ) - [/*@bgen(jjtree) Applies */ - { - ASTApplies jjtn001 = new ASTApplies(JJTAPPLIES); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/(Identifier() ((LOOKAHEAD(2) Identifier())*))/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ ] - JavaScript() - - {jjtn000.setName(label); - jjtn000.setWhen(when.image);} - end=/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - //{ jjtThis.setCoord(when,end);} - - } - - /** Apply - * Old Version of apply, only static weaving - * Advice each join point of the related select(s). - * It can contain an unique label and a list of selects to be advised by the apply. If no select is inserted, the last select with no label will be used. - * The body contains JavaScript, in which the actions can be declared - ** - void Apply() #Apply: - {Token name, apply, end;} - { - [name={jjtThis.setName(name.image);} ] apply= [To()] - JavaScript() - end= - { jjtThis.setCoord(apply,end);} - } - /**/ - - /** Apply (Static/Dynamic) - * The new version of the Apply statement: static or dynamic weaving - * Advice each join point of the related select(s). - * It can contain an unique label and a list of selects to be advised by the apply. If no select is inserted, the last select with no label will be used. - * The body contains JavaScript, in which the actions can be declared - **/ - void Apply() : - {/*@bgen(jjtree) Apply */ - ASTApply jjtn000 = new ASTApply(JJTAPPLY); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token name, apply, end;} - {/*@bgen(jjtree) Apply */ - try { -/*@egen*/ - [name={jjtn000.setName(name.image);} ] - apply= - - [ - < DYNAMIC > {jjtn000.setDynamic(true);} - [ - < PARALLEL > {jjtn000.setConcurrent(true);} - | - < SEQUENCIAL > {jjtn000.setConcurrent(false);} - ] - [ - < BEFORE > {jjtn000.setTrigger("before");} - | - < AFTER > {jjtn000.setTrigger("after");} -// | -// //This needs to be fixed as it conflicts with the action "replace" -// < REPLACE > {jjtThis.setTrigger("around");} - ] - ] - - - [To()] - JavaScript() - end=/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - //{ jjtThis.setCoord(apply,end);} - - - } - - /** To - * list of selects that will be influenced by the apply - **/ - void To() : - {/*@bgen(jjtree) To */ - ASTTo jjtn000 = new ASTTo(JJTTO); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) To */ - try { -/*@egen*/ - FourthSetOp() - (LOOKAHEAD( FourthSetOp()) FourthSetOp())*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - void SimpleAction() : - {/*@bgen(jjtree) Action */ - ASTAction jjtn000 = new ASTAction(JJTACTION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token t;} - {/*@bgen(jjtree) Action */ - try { -/*@egen*/ - ( - Insert() - | - Define() - | - Perform() - | - OutputAct() /**/ - ) - EndStatement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - - } - - /** Action - * Actions that can be used to influence the join points. - * A join point variable can be used to specify the targeted join point where the action takes place - **/ - void Action() : - { - Token t; - } - {/*@bgen(jjtree) Action */ - { - ASTAction jjtn003 = new ASTAction(JJTACTION); - boolean jjtc003 = true; - jjtree.openNodeScope(jjtn003); - jjtn003.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ -// -// LOOKAHEAD(LeftHandSideExpression() AssignmentOperator() ) ( -// LeftHandSideExpression() AssignmentOperator() -// ActionOnAssign() -// -// )#AssignmentExpression -// | - (/*@bgen(jjtree) #CompositeReference(> 1) */ - { - ASTCompositeReference jjtn002 = new ASTCompositeReference(JJTCOMPOSITEREFERENCE); - boolean jjtc002 = true; - jjtree.openNodeScope(jjtn002); - jjtn002.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - ( - (/*@bgen(jjtree) Identifier */ - { - ASTIdentifier jjtn001 = new ASTIdentifier(JJTIDENTIFIER); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - ( - t=/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn001, true); - jjtc001 = false; - jjtn001.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { - jjtn001.setName(t.image);jjtn001.jjtSetValue(t.image); - //jjtThis.setCoord(t,t); - } - )/*@bgen(jjtree)*/ - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - ) - - (LOOKAHEAD(MemberExpressionPart())MemberExpressionPart())* - < DOT > - - )/*@bgen(jjtree)*/ - } catch (Throwable jjte002) { - if (jjtc002) { - jjtree.clearNodeScope(jjtn002); - jjtc002 = false; - } else { - jjtree.popNode(); - } - if (jjte002 instanceof RuntimeException) { - throw (RuntimeException)jjte002; - } - if (jjte002 instanceof ParseException) { - throw (ParseException)jjte002; - } - throw (Error)jjte002; - } finally { - if (jjtc002) { - jjtree.closeNodeScope(jjtn002, jjtree.nodeArity() > 1); - jjtn002.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - ( - Insert() | - Define() | - Perform() | - OutputAct() - ) - )/*@bgen(jjtree)*/ - } catch (Throwable jjte003) { - if (jjtc003) { - jjtree.clearNodeScope(jjtn003); - jjtc003 = false; - } else { - jjtree.popNode(); - } - if (jjte003 instanceof RuntimeException) { - throw (RuntimeException)jjte003; - } - if (jjte003 instanceof ParseException) { - throw (ParseException)jjte003; - } - throw (Error)jjte003; - } finally { - if (jjtc003) { - jjtree.closeNodeScope(jjtn003, true); - jjtn003.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - EndStatement() - } - - -void ActionOnAssign() : - {/*@bgen(jjtree) Action */ - ASTAction jjtn000 = new ASTAction(JJTACTION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/ - Token t; - } - {/*@bgen(jjtree) Action */ - try { -/*@egen*/ - - (/*@bgen(jjtree) #CompositeReference(> 1) */ - { - ASTCompositeReference jjtn002 = new ASTCompositeReference(JJTCOMPOSITEREFERENCE); - boolean jjtc002 = true; - jjtree.openNodeScope(jjtn002); - jjtn002.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ ( - (/*@bgen(jjtree) Identifier */ - { - ASTIdentifier jjtn001 = new ASTIdentifier(JJTIDENTIFIER); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - ( - t=/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn001, true); - jjtc001 = false; - jjtn001.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { - jjtn001.setName(t.image);jjtn001.jjtSetValue(t.image); - //jjtThis.setCoord(t,t); - } - )/*@bgen(jjtree)*/ - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - ) - - (LOOKAHEAD(MemberExpressionPart())MemberExpressionPart())* - < DOT > - - )/*@bgen(jjtree)*/ - } catch (Throwable jjte002) { - if (jjtc002) { - jjtree.clearNodeScope(jjtn002); - jjtc002 = false; - } else { - jjtree.popNode(); - } - if (jjte002 instanceof RuntimeException) { - throw (RuntimeException)jjte002; - } - if (jjte002 instanceof ParseException) { - throw (ParseException)jjte002; - } - throw (Error)jjte002; - } finally { - if (jjtc002) { - jjtree.closeNodeScope(jjtn002, jjtree.nodeArity() > 1); - jjtn002.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ )? - - - ExecOnAssign()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /** Call - * Action to invoke an aspect. - * The aspect is called with the input arguments that requires and the call instance can have a reference variable to be used to recover information from the invoked aspect. - **/ - void Call() : - {/*@bgen(jjtree) Call */ - ASTCall jjtn000 = new ASTCall(JJTCALL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token aspVarName,aspName,ref, end;} - {/*@bgen(jjtree) Call */ - try { -/*@egen*/ - ( - [LOOKAHEAD(LeftHandSideExpression() ) - LeftHandSideExpression() ] - - | - < VAR > Identifier() < ASSIGN > - | - LeftHandSideExpression() < ASSIGN > - ) - - [LOOKAHEAD(2)FilePathNoSTar()] - aspName= - - [Arguments()] end=EndStatement()/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - - { - jjtn000.setAspName(aspName.image); - // jjtThis.setCoord(aspName,end); - }/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - - /** Run - * Execution of an external tool. - **/ - void Run() : - {/*@bgen(jjtree) Run */ - ASTRun jjtn000 = new ASTRun(JJTRUN); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token run, toolName, end;} - {/*@bgen(jjtree) Run */ - try { -/*@egen*/ - run= [LOOKAHEAD(LeftHandSideExpression() )LeftHandSideExpression() ] - [toolName=getNoReservedIdentifier() {jjtn000.setToolName(toolName.image);}] - Arguments() - [ AssignmentExpression()] - end=EndStatement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - - // {jjtThis.setCoord(run,end);} - } - - /** Command - * Execution of a command. - **/ - void Cmd() : - {/*@bgen(jjtree) Cmd */ - ASTCmd jjtn000 = new ASTCmd(JJTCMD); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token cmd, toolName, end;} - {/*@bgen(jjtree) Cmd */ - try { -/*@egen*/ - ( - cmd= | cmd= {jjtn000.setNewVersion(true);} ) - [LOOKAHEAD(LeftHandSideExpression() )LeftHandSideExpression() ] - Arguments() - [ AssignmentExpression()] - end=EndStatement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - //{jjtThis.setCoord(cmd,end);} - } - - /** OLD CALL ** - void Call() #Call: - {Token aspVarName,aspName,ref, end;} - { - [LOOKAHEAD( ) - aspVarName= - {jjtThis.setAspVarName(aspVarName.image);}] - [LOOKAHEAD(2)FilePathNoSTar()]aspName= - {jjtThis.setAspName(aspName.image);} - [LOOKAHEAD(Arguments())Arguments()] end= - // { jjtThis.setCoord(aspName,end);} - } - /***/ - - /** Insert - * The insertion of code is made by indicating a codedefinition's identifier with the required arguments or writing the desired code, with the possibility of using LARA-code to be defined into the target language, such as insert before %{\ufffd}%. - * It is also needed to say if the code is inserted before, after or around the pointcut. - **/ - void Insert() : - {/*@bgen(jjtree) Insert */ - ASTInsert jjtn000 = new ASTInsert(JJTINSERT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token when,language, begin, end;} - {/*@bgen(jjtree) Insert */ - try { -/*@egen*/ - { - jjtn000.setLanguage("native"); - } - ( - ( - begin= - ( - ( - [ language= {jjtn000.setLanguage(language.image);}] - (when= | when= | when= | when=) - ConditionalExpression()/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ -// ( -// TemplateLiteral() -// | -// ((Identifier() [LOOKAHEAD(Arguments())Arguments()]) #CompositeReference(>1)) -// ) - {jjtn000.setWhen(when.image);} - //{jjtThis.setCoord(begin,when);} - ) - | - ( - Arguments() - //{jjtThis.setCoord(begin,begin);} - ) - /*| - ( - TemplateLiteral() - | - ((Identifier() [LOOKAHEAD(Arguments())Arguments()]) #CompositeReference(>1)) - {jjtThis.setWhen("inside");} - //{jjtThis.setCoord(begin,begin);} - ) */ - ) - ) - | - ( - begin = ConditionalExpression()/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ -// ( -// TemplateLiteral() -// | -// ((Identifier() [LOOKAHEAD(Arguments())Arguments()]) #CompositeReference(>1)) -// ) - {jjtn000.setWhen(begin.image);} - //{jjtThis.setCoord(begin,begin);} - ) - )/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /** Perform - * Perform an action over the join point - **/ - void Perform() : - {/*@bgen(jjtree) Perform */ - ASTPerform jjtn000 = new ASTPerform(JJTPERFORM); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token action, begin, end, t;} - {/*@bgen(jjtree) Perform */ - try { -/*@egen*/ - begin= - [LOOKAHEAD(< IDENTIFIER_NAME > < COLON > ) t=< IDENTIFIER_NAME > < COLON >{jjtn000.setVariable(t.image);} ] - action=getNoReservedIdentifier() - {jjtn000.setAction(action.image);} - //{jjtThis.setCoord(begin,action);} - [/*@bgen(jjtree) FunctionCallParameters */ - { - ASTFunctionCallParameters jjtn001 = new ASTFunctionCallParameters(JJTFUNCTIONCALLPARAMETERS); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - (TemplateLiteral())/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - | - Arguments() - ]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /** Perform - * Perform an action over the join point - **/ - void ExecOnAssign() : - {/*@bgen(jjtree) Perform */ - ASTPerform jjtn000 = new ASTPerform(JJTPERFORM); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token action, begin, end, t;} - {/*@bgen(jjtree) Perform */ - try { -/*@egen*/ - - //[LOOKAHEAD(< IDENTIFIER_NAME > < COLON > ) t=< IDENTIFIER_NAME > < COLON >{jjtThis.setVariable(t.image);} ] - action=getNoReservedIdentifier() - {jjtn000.setAction(action.image);} - //{jjtThis.setCoord(begin,action);} - (/*@bgen(jjtree) FunctionCallParameters */ - { - ASTFunctionCallParameters jjtn001 = new ASTFunctionCallParameters(JJTFUNCTIONCALLPARAMETERS); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - (TemplateLiteral())/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - | - Arguments() - )/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - -// void CodeLiteralOnlyArgument() #FunctionCallParameters: {} -// { -// TemplateLiteral() -// } - - /** Output - * Similar to Insert, however it is used to output in runtime - **/ - void OutputAct() : - {/*@bgen(jjtree) OutputAct */ - ASTOutputAct jjtn000 = new ASTOutputAct(JJTOUTPUTACT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) OutputAct */ - try { -/*@egen*/ - begin= - ( - ( - TemplateLiteral() - | - (/*@bgen(jjtree) #CompositeReference(> 1) */ - { - ASTCompositeReference jjtn001 = new ASTCompositeReference(JJTCOMPOSITEREFERENCE); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/(Identifier() [LOOKAHEAD(Arguments())Arguments()])/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ ) - ) - | - Arguments() - )/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - //{jjtThis.setCoord(begin,begin);} - } - - /** Define - * Assign a value to a join point attribute - **/ - void Define() : - {/*@bgen(jjtree) Define */ - ASTDefine jjtn000 = new ASTDefine(JJTDEFINE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) Define */ - try { -/*@egen*/ - begin= - - ( - noReservedIdentifier() AssignmentExpression() - | - Arguments() - )/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - //{jjtThis.setCoord(begin,begin);} - } - - /** Condition - * Boolean expression that verifies if the apply can take place in a join point - **/ - void Condition() : - {/*@bgen(jjtree) Condition */ - ASTCondition jjtn000 = new ASTCondition(JJTCONDITION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token t,begin, end;} - {/*@bgen(jjtree) Condition */ - try { -/*@egen*/ - [ t= { jjtn000.jjtSetValue(t.image); } ] - begin= [/*@bgen(jjtree) For */ - { - ASTFor jjtn001 = new ASTFor(JJTFOR); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ (Identifier() ( Identifier())* )/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ ] - LogicalORExpression() - end=/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - //{jjtThis.setCoord(begin,end);} - } - -/******************************************************************************* - ********************** END OF LARA SYNTACTIC GRAMMAR ********************* - *******************************************************************************/ - - /* The following part of the grammar is the EcmaScript grammar created by The Dojo Foundation (2004-2005), and it was partially updated to conform to the requirements of LARA grammar, such as the use of actions and join point variables. - **/ - - /* Section 11.1: Primary Expressions */ - - void PrimaryExpression() : - {} - { - This() - | ObjectLiteral() - | ArrayLiteral() - | ParenExpression() - | Identifier() - | Literal() -// { return jjtThis; } - } - - void This() : - {/*@bgen(jjtree) ThisReference */ - ASTThisReference jjtn000 = new ASTThisReference(JJTTHISREFERENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) ThisReference */ - try { -/*@egen*//*@bgen(jjtree) ThisReference */ - { - ASTThisReference jjtn001 = new ASTThisReference(JJTTHISREFERENCE); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - "this"/*@bgen(jjtree)*/ - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ /*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - - } - - void ParenExpression() : - {/*@bgen(jjtree) ParenExpression */ - ASTParenExpression jjtn000 = new ASTParenExpression(JJTPARENEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) ParenExpression */ - try { -/*@egen*/ - "(" Expression() ")"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /* Section 7.8: Literals */ - - void Literal() : - {/*@bgen(jjtree) Literal */ - ASTLiteral jjtn000 = new ASTLiteral(JJTLITERAL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/ - Token t; - Map objLiteral; - List arrayLiteral; - } - {/*@bgen(jjtree) Literal */ - try { -/*@egen*/ - t = /*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { - jjtn000.setDecimalValue(t.image); - if(t.image.contains(".")) - jjtn000.setType(Types.Float); - else jjtn000.setType(Types.Int); - } - | - t = /*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { - jjtn000.setHexValue(t.image); - jjtn000.setType(Types.Int); - } - | - t = /*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { - jjtn000.setStringValue(t.image); - jjtn000.setType(Types.String); - } - | - t = /*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { - jjtn000.setBooleanValue(t.image); - jjtn000.setType(Types.Boolean); - } - | - t = /*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { - jjtn000.setNullValue(); - jjtn000.setType(Types.Null); - } - | - t = /*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { - jjtn000.setRegexValue(t.image); - jjtn000.setType(Types.RegEx); - } - | - t = /*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { - jjtn000.setCodeValue(t.image); - jjtn000.setType(Types.Code); - }/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void TemplateLiteral() : - {/*@bgen(jjtree) Literal */ - ASTLiteral jjtn000 = new ASTLiteral(JJTLITERAL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/ - Token t; - } - {/*@bgen(jjtree) Literal */ - try { -/*@egen*/ - t = /*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { - jjtn000.setStringValue(t.image); - jjtn000.setType(Types.String); - } - | - t = /*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { - jjtn000.setCodeValue(t.image); - jjtn000.setType(Types.Code); - }/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - void Identifier() : - {/*@bgen(jjtree) Identifier */ - ASTIdentifier jjtn000 = new ASTIdentifier(JJTIDENTIFIER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/ - Token t; - } - {/*@bgen(jjtree) Identifier */ - try { -/*@egen*/ - t=/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { - jjtn000.setName(t.image);jjtn000.jjtSetValue(t.image); - /*{jjtThis.setCoord(t,t); }*/ - }/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - void LabelIdentifier() : - {/*@bgen(jjtree) Identifier */ - ASTIdentifier jjtn000 = new ASTIdentifier(JJTIDENTIFIER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/ - Token t; - } - {/*@bgen(jjtree) Identifier */ - try { -/*@egen*/ - ( - t= | t=< IDENTIFIER_NAME>)/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { - jjtn000.setName(t.image);jjtn000.jjtSetValue(t.image); - /*{jjtThis.setCoord(t,t); }*/ - }/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /* Section 11.1.4: Array Initialiser */ - - void ArrayLiteral() : - {/*@bgen(jjtree) ArrayLiteral */ - ASTArrayLiteral jjtn000 = new ASTArrayLiteral(JJTARRAYLITERAL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) ArrayLiteral */ - try { -/*@egen*/ - "[" ( - (ElisionFirst())? - ( - ElementList() - //LOOKAHEAD(ElementList() Elision()) ElementList() Elision() - //| ( ElementList() )? - )? - ) "]"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - - void ElementList() : - {} - { - AssignmentExpression() - - ( LOOKAHEAD(2) - Elision() AssignmentExpression() )* [Elision()] - //(Elision() AssignmentExpression() )* - //(Elision())? - } - - void Elision() : - {} - { - (",") - [/*@bgen(jjtree) EmptyPositions */ - { - ASTEmptyPositions jjtn001 = new ASTEmptyPositions(JJTEMPTYPOSITIONS); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/("," {jjtn001.inc();})+/*@bgen(jjtree)*/ - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ ] - } - - - void ElisionFirst() : - {/*@bgen(jjtree) EmptyPositions */ - ASTEmptyPositions jjtn000 = new ASTEmptyPositions(JJTEMPTYPOSITIONS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) EmptyPositions */ - try { -/*@egen*/ - (","){jjtn000.inc();} - [("," {jjtn000.inc();})+ ]/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /* Section 11.1.5: Object Initialiser */ - - void ObjectLiteral() : - {/*@bgen(jjtree) ObjectLiteral */ - ASTObjectLiteral jjtn000 = new ASTObjectLiteral(JJTOBJECTLITERAL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) ObjectLiteral */ - try { -/*@egen*/ - < LBRACE > {exprBraceCount++;} - ( PropertyNameAndValueList() )? - < RBRACE >/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ {exprBraceCount--;}/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void PropertyNameAndValueList() : - {} - { - - PropertyNameAndValue() ( LOOKAHEAD( "," PropertyNameAndValue()) "," PropertyNameAndValue() | "," )* - } - - void PropertyNameAndValue() : - {/*@bgen(jjtree) LiteralField */ - ASTLiteralField jjtn000 = new ASTLiteralField(JJTLITERALFIELD); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) LiteralField */ - try { -/*@egen*/ - PropertyName() ":" AssignmentExpression()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void PropertyName() : - {} - { - noReservedIdentifier() - | - Literal() - /* OLD - Identifier() - | - #Literal - | - #Literal - */ - } - - - /* Section 11.2: Left-Hand-Side Expressions */ - - void MemberExpression() : - {} - {/*@bgen(jjtree) #CompositeReference(> 1) */ - { - ASTCompositeReference jjtn001 = new ASTCompositeReference(JJTCOMPOSITEREFERENCE); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - ( ( - LOOKAHEAD("function*") GeneratorFunctionExpression() | - LOOKAHEAD("function") FunctionExpression() | - LOOKAHEAD(ArrowFunctionExpression()) ArrowFunctionExpression() | - PrimaryExpression() - ) (LOOKAHEAD(2) MemberExpressionPart())* )/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - | AllocationExpression() - } - - void MemberExpressionForIn() : - {} - {/*@bgen(jjtree) #CompositeReference(> 1) */ - { - ASTCompositeReference jjtn001 = new ASTCompositeReference(JJTCOMPOSITEREFERENCE); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - ( ( - LOOKAHEAD("function*") GeneratorFunctionExpression() | - LOOKAHEAD("function") FunctionExpression() | - LOOKAHEAD(ArrowFunctionExpression()) ArrowFunctionExpression() | - PrimaryExpression() - ) (LOOKAHEAD(2) MemberExpressionPart())* )/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void AllocationExpression() : - {/*@bgen(jjtree) AllocationExpression */ - ASTAllocationExpression jjtn000 = new ASTAllocationExpression(JJTALLOCATIONEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) AllocationExpression */ - try { -/*@egen*//*@bgen(jjtree) #CompositeReference(> 1) */ - { - ASTCompositeReference jjtn001 = new ASTCompositeReference(JJTCOMPOSITEREFERENCE); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - ( "new" MemberExpression() ( (LOOKAHEAD(Arguments()) Arguments() (LOOKAHEAD(2) MemberExpressionPart())* ) * ) )/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree.nodeArity() > 1); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ /*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void MemberExpressionPart() : - {} - {/*@bgen(jjtree) PropertyValueReference */ - { - ASTPropertyValueReference jjtn001 = new ASTPropertyValueReference(JJTPROPERTYVALUEREFERENCE); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - ( ("[" Expression() "]") | (< LBRACE > {exprBraceCount++;} Expression() < RBRACE >/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn001, true); - jjtc001 = false; - jjtn001.jjtSetLastToken(getToken(0)); - } -/*@egen*/ {exprBraceCount--;}))/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ |/*@bgen(jjtree) PropertyIdentifierReference */ - { - ASTPropertyIdentifierReference jjtn002 = new ASTPropertyIdentifierReference(JJTPROPERTYIDENTIFIERREFERENCE); - boolean jjtc002 = true; - jjtree.openNodeScope(jjtn002); - jjtn002.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ ( "." (noReservedIdentifier()))/*@bgen(jjtree)*/ - } catch (Throwable jjte002) { - if (jjtc002) { - jjtree.clearNodeScope(jjtn002); - jjtc002 = false; - } else { - jjtree.popNode(); - } - if (jjte002 instanceof RuntimeException) { - throw (RuntimeException)jjte002; - } - if (jjte002 instanceof ParseException) { - throw (ParseException)jjte002; - } - throw (Error)jjte002; - } finally { - if (jjtc002) { - jjtree.closeNodeScope(jjtn002, true); - jjtn002.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - - } - - void CallExpression() : - {/*@bgen(jjtree) #CompositeReference(> 1) */ - ASTCompositeReference jjtn000 = new ASTCompositeReference(JJTCOMPOSITEREFERENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #CompositeReference(> 1) */ - try { -/*@egen*/ - MemberExpression() Arguments() ( LOOKAHEAD(2) CallExpressionPart() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void CallExpressionForIn() : - {/*@bgen(jjtree) #CompositeReference(> 1) */ - ASTCompositeReference jjtn000 = new ASTCompositeReference(JJTCOMPOSITEREFERENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #CompositeReference(> 1) */ - try { -/*@egen*/ - MemberExpressionForIn() Arguments() ( LOOKAHEAD(2) CallExpressionPart() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void CallExpressionPart() : - {} - { - Arguments() |/*@bgen(jjtree) PropertyValueReference */ - { - ASTPropertyValueReference jjtn001 = new ASTPropertyValueReference(JJTPROPERTYVALUEREFERENCE); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ ( "[" Expression() "]" )/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ |/*@bgen(jjtree) PropertyIdentifierReference */ - { - ASTPropertyIdentifierReference jjtn002 = new ASTPropertyIdentifierReference(JJTPROPERTYIDENTIFIERREFERENCE); - boolean jjtc002 = true; - jjtree.openNodeScope(jjtn002); - jjtn002.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ ( "." noReservedIdentifier() )/*@bgen(jjtree)*/ - } catch (Throwable jjte002) { - if (jjtc002) { - jjtree.clearNodeScope(jjtn002); - jjtc002 = false; - } else { - jjtree.popNode(); - } - if (jjte002 instanceof RuntimeException) { - throw (RuntimeException)jjte002; - } - if (jjte002 instanceof ParseException) { - throw (ParseException)jjte002; - } - throw (Error)jjte002; - } finally { - if (jjtc002) { - jjtree.closeNodeScope(jjtn002, true); - jjtn002.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void Arguments() : - {/*@bgen(jjtree) FunctionCallParameters */ - ASTFunctionCallParameters jjtn000 = new ASTFunctionCallParameters(JJTFUNCTIONCALLPARAMETERS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) FunctionCallParameters */ - try { -/*@egen*/ - "(" (LOOKAHEAD(getNoReservedIdentifier() ) (NamedArgumentList(){ jjtn000.areNamed = true;}) - | ArgumentList())? ")"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void NamedArgumentList() : - {} - { - NamedArgument() ( NamedArgument())* - } - - void NamedArgument() : - {/*@bgen(jjtree) NamedArgument */ - ASTNamedArgument jjtn000 = new ASTNamedArgument(JJTNAMEDARGUMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token argument;} - {/*@bgen(jjtree) NamedArgument */ - try { -/*@egen*/ - argument=getNoReservedIdentifier() {jjtn000.jjtSetValue(argument.image);} - AssignmentExpression()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - void ArgumentList() : - {} - { - AssignmentExpression() ("," AssignmentExpression())* - } - - - void LeftHandSideExpression() : - {} - { - LOOKAHEAD(MemberExpression() "(") CallExpression() | MemberExpression() - } - - - void LeftHandSideExpressionForIn() : - {} - { - LOOKAHEAD(CallExpression()) CallExpressionForIn() | MemberExpressionForIn() - } - - /* Section 11.3 Postfix Expressions */ - - void PostfixExpression() : - {/*@bgen(jjtree) #PostfixExpression(> 1) */ - ASTPostfixExpression jjtn000 = new ASTPostfixExpression(JJTPOSTFIXEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #PostfixExpression(> 1) */ - try { -/*@egen*/ - LeftHandSideExpression() [ LOOKAHEAD(1) PostfixOperator() ]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void PostfixOperator() : - {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token op;} - {/*@bgen(jjtree) Operator */ - try { -/*@egen*/ - ( op="++" | op="--")/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { jjtn000.jjtSetValue(op.image); }/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - /* Section 11.4 Unary Operators */ - - void UnaryExpression() : - {/*@bgen(jjtree) #UnaryExpression(> 1) */ - ASTUnaryExpression jjtn000 = new ASTUnaryExpression(JJTUNARYEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #UnaryExpression(> 1) */ - try { -/*@egen*/ - PostfixExpression() | ( UnaryOperator() UnaryExpression() )/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void UnaryOperator() : - {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token op;} - {/*@bgen(jjtree) Operator */ - try { -/*@egen*/ - (op="delete" | op="void" | op="typeof" | op="++" | op="--" | op="+" | op="-" | op="~" | op="!")/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { jjtn000.jjtSetValue(op.image);}/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - /* Section 11.5: Multiplicative Operators */ - - - void MultiplicativeExpression() : - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - try { -/*@egen*/ - UnaryExpression() ( MultiplicativeOperator() UnaryExpression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - void MultiplicativeOperator() : - {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token op;} - {/*@bgen(jjtree) Operator */ - try { -/*@egen*/ - (op="*" | op= | op="%")/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ { jjtn000.jjtSetValue(op.image);}/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /* Section 11.6: Additive Operators */ - - void AdditiveExpression() : - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - try { -/*@egen*/ - MultiplicativeExpression() ( LOOKAHEAD(1) AdditiveOperator() MultiplicativeExpression())*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void AdditiveOperator() : - {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token op;} - {/*@bgen(jjtree) Operator */ - try { -/*@egen*/ - (op="+" | op="-")/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ { jjtn000.jjtSetValue(op.image);}/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - /* Section 11.7: Bitwise Shift Operators */ - - void ShiftExpression() : - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - try { -/*@egen*/ - AdditiveExpression() ( ShiftOperator() AdditiveExpression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void ShiftOperator() : - {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token op;} - {/*@bgen(jjtree) Operator */ - try { -/*@egen*/ - (op="<<" | op=">>" | op=">>>")/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { jjtn000.jjtSetValue(op.image); }/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /* Section 11.4: Relational Operators */ - - void RelationalExpression() : - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - try { -/*@egen*/ - ShiftExpression() ( RelationalOperator() ShiftExpression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void RelationalOperator() : - {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token op;} - {/*@bgen(jjtree) Operator */ - try { -/*@egen*/ - (op="<" | op=">" | op="<=" | op=">=" | op="instanceof" | op="in")/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { jjtn000.jjtSetValue(op.image); }/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void RelationalExpressionNoIn() : - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - try { -/*@egen*/ - ShiftExpression() ( RelationalNoInOperator() ShiftExpression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - void RelationalNoInOperator() : - {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token op;} - {/*@bgen(jjtree) Operator */ - try { -/*@egen*/ - (op="<" | op=">" | op="<=" | op=">=" | op="instanceof")/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { jjtn000.jjtSetValue(op.image); }/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /* Section 11.9: Equality Operators */ - - void EqualityExpression() : - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - try { -/*@egen*/ - RelationalExpression() ( EqualityOperator() RelationalExpression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void EqualityExpressionNoIn() : - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - try { -/*@egen*/ - RelationalExpressionNoIn() ( EqualityOperator() RelationalExpressionNoIn())*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void EqualityOperator() : - {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token op;} - {/*@bgen(jjtree) Operator */ - try { -/*@egen*/ - (op="==" | op="!=" | op="===" | op="!==" | op=)/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ { jjtn000.jjtSetValue(op.image);}/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /* Section 11.10: Binary Bitwise Operators */ - - void BitwiseANDExpression() : - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - try { -/*@egen*/ - EqualityExpression() ( BitwiseANDOperator() EqualityExpression())*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void BitwiseANDExpressionNoIn() : - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - try { -/*@egen*/ - EqualityExpressionNoIn() (BitwiseANDOperator() EqualityExpressionNoIn())*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void BitwiseANDOperator() : - {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token op;} - {/*@bgen(jjtree) Operator */ - try { -/*@egen*/ - op="&"/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ { jjtn000.jjtSetValue(op.image); }/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void BitwiseXORExpression() : - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - try { -/*@egen*/ - BitwiseANDExpression() (BitwiseXOROperator() BitwiseANDExpression())*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void BitwiseXORExpressionNoIn() : - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - try { -/*@egen*/ - BitwiseANDExpressionNoIn() (BitwiseXOROperator() BitwiseANDExpressionNoIn())*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void BitwiseXOROperator() : - {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token op;} - {/*@bgen(jjtree) Operator */ - try { -/*@egen*/ - op="^"/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ { jjtn000.jjtSetValue(op.image); }/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void BitwiseORExpression() : - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - try { -/*@egen*/ - BitwiseXORExpression() (BitwiseOROperator() BitwiseXORExpression())*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void BitwiseORExpressionNoIn() : - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - ASTBinaryExpressionSequence jjtn000 = new ASTBinaryExpressionSequence(JJTBINARYEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #BinaryExpressionSequence(> 1) */ - try { -/*@egen*/ - BitwiseXORExpressionNoIn() (BitwiseOROperator() BitwiseXORExpressionNoIn())*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void BitwiseOROperator() : - {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token op;} - {/*@bgen(jjtree) Operator */ - try { -/*@egen*/ - op="|"/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ { jjtn000.jjtSetValue(op.image); }/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - /* Section 11.11: Binary Logical Operators */ - - void LogicalANDExpression() : - {/*@bgen(jjtree) #AndExpressionSequence(> 1) */ - ASTAndExpressionSequence jjtn000 = new ASTAndExpressionSequence(JJTANDEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #AndExpressionSequence(> 1) */ - try { -/*@egen*/ - BitwiseORExpression() (LogicalANDOperator() BitwiseORExpression())*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void LogicalANDExpressionNoIn() : - {/*@bgen(jjtree) #AndExpressionSequence(> 1) */ - ASTAndExpressionSequence jjtn000 = new ASTAndExpressionSequence(JJTANDEXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #AndExpressionSequence(> 1) */ - try { -/*@egen*/ - BitwiseORExpressionNoIn() (LogicalANDOperator() BitwiseORExpressionNoIn())*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void LogicalANDOperator() : - {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token op;} - {/*@bgen(jjtree) Operator */ - try { -/*@egen*/ - op="&&"/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ { jjtn000.jjtSetValue(op.image); }/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void LogicalORExpression() : - {/*@bgen(jjtree) #OrExpressionSequence(> 1) */ - ASTOrExpressionSequence jjtn000 = new ASTOrExpressionSequence(JJTOREXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #OrExpressionSequence(> 1) */ - try { -/*@egen*/ - LogicalANDExpression() (LogicalOROperator() LogicalANDExpression())*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void LogicalORExpressionNoIn() : - {/*@bgen(jjtree) #OrExpressionSequence(> 1) */ - ASTOrExpressionSequence jjtn000 = new ASTOrExpressionSequence(JJTOREXPRESSIONSEQUENCE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #OrExpressionSequence(> 1) */ - try { -/*@egen*/ - LogicalANDExpressionNoIn() (LogicalOROperator() LogicalANDExpressionNoIn())*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void LogicalOROperator() : - {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token op;} - {/*@bgen(jjtree) Operator */ - try { -/*@egen*/ - op="||"/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ { jjtn000.jjtSetValue(op.image); }/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /* Section 11.12: Conditional Operator */ - - void ConditionalExpression() : - {/*@bgen(jjtree) #ConditionalExpression(> 1) */ - ASTConditionalExpression jjtn000 = new ASTConditionalExpression(JJTCONDITIONALEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #ConditionalExpression(> 1) */ - try { -/*@egen*/ - LogicalORExpression() [ "?" AssignmentExpression() ":" AssignmentExpression() ]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void ConditionalExpressionNoIn() : - {/*@bgen(jjtree) #ConditionalExpression(> 1) */ - ASTConditionalExpression jjtn000 = new ASTConditionalExpression(JJTCONDITIONALEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #ConditionalExpression(> 1) */ - try { -/*@egen*/ - LogicalORExpressionNoIn() [ "?" AssignmentExpression() ":" AssignmentExpressionNoIn() ]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - /* Section 11.13: Assignment Operators */ - - void AssignmentExpression() : - {/*@bgen(jjtree) #AssignmentExpression(> 1) */ - ASTAssignmentExpression jjtn000 = new ASTAssignmentExpression(JJTASSIGNMENTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #AssignmentExpression(> 1) */ - try { -/*@egen*/ - LOOKAHEAD(LeftHandSideExpression() AssignmentOperator()) LeftHandSideExpression() AssignmentOperator() - (LOOKAHEAD(ActionOnAssign())ActionOnAssign() |AssignmentExpression()) - | ConditionalExpression()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void AssignmentExpressionNoIn() : - {/*@bgen(jjtree) #AssignmentExpression(> 1) */ - ASTAssignmentExpression jjtn000 = new ASTAssignmentExpression(JJTASSIGNMENTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #AssignmentExpression(> 1) */ - try { -/*@egen*/ - LOOKAHEAD(LeftHandSideExpression() AssignmentOperator()) - - LeftHandSideExpression() AssignmentOperator() - (LOOKAHEAD(ActionOnAssign())ActionOnAssign() | AssignmentExpressionNoIn()) - | ConditionalExpressionNoIn()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void AssignmentOperator() : - {/*@bgen(jjtree) Operator */ - ASTOperator jjtn000 = new ASTOperator(JJTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token op;} - {/*@bgen(jjtree) Operator */ - try { -/*@egen*/ - (op="=" | op="*=" | op= | op="%=" | op="+=" | op="-=" | op="<<=" | op=">>=" | op=">>>=" | op="&=" | op="^=" | op="|=")/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - { jjtn000.jjtSetValue(op.image); }/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - /* Section 11.14: Comma Operator */ - - void Expression() : - {/*@bgen(jjtree) #ExpressionList(> 1) */ - ASTExpressionList jjtn000 = new ASTExpressionList(JJTEXPRESSIONLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #ExpressionList(> 1) */ - try { -/*@egen*/ - AssignmentExpression() ( "," AssignmentExpression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void ExpressionNoIn() : - {} - { - AssignmentExpressionNoIn() ( "," AssignmentExpressionNoIn() )* - } - - - - /* Section 12: STATEMENTS */ - - void Statement() : - {{exprBraceCount =0;}} - { - - - LOOKAHEAD(2) BodiedStatement() - | - SingleStatement() -// }catch(ParseException e){ -// e.printStackTrace(); -// throw null; -// } - } - - void SingleStatement() : - {} - { - try - { - - SimpleAction() - | LOOKAHEAD(Action()) - Action() - | LOOKAHEAD(< CALL > | (< VAR > < IDENTIFIER_NAME > | LeftHandSideExpression() ) ) Call() - | LOOKAHEAD([] ) - Cmd() - | Run() - //| LOOKAHEAD(Block()) Block() - // | LOOKAHEAD("var" Identifier() ":") JScriptVarStatement() // JScript .NET declaration - | LOOKAHEAD("var" Identifier()) - VariableStatement() - | EmptyStatement() - | LOOKAHEAD(ExpressionStatement()) - ExpressionStatement() - | LOOKAHEAD(Identifier() ":") - LabelledStatement() - | ContinueStatement() - | YieldStatement() - | BreakStatement() - | ImportStatement() - | ReturnStatement() - }catch(ParseException e){ - error_skipto(e,SEMICOLON); - }catch(TokenMgrError error){ - exceptions.add(error); - if (exceptions.size() >= MAXIMUM_SYNTAX_EXCEPTIONS) { - Exception e = new larac.exceptions.LARACompilerException("Lexer problems", error); - error_skipto(new ParseException(error.getMessage()), SEMICOLON); - } - -// error_skipto(new ParseException(e.getMessage()),SEMICOLON); -// Exception e = new larac.exceptions.LARACompilerException("Lexer problems",error); -// exceptions.add(error); -// throw ; - } - - } - - void BodiedStatement() : - {} - { - try{ - - Block() - | IfStatement() - | IterationStatement() - | SwitchStatement() - | WithStatement() - | ThrowStatement() - | TryStatement() - }catch(ParseException e){ - error_skipto(e,LBRACE); - } - } - - /* 12.1 Block Statement */ - - void Block() : - {/*@bgen(jjtree) Block */ - ASTBlock jjtn000 = new ASTBlock(JJTBLOCK); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin, end;} - {/*@bgen(jjtree) Block */ - try { -/*@egen*/ - begin=< LBRACE > - ( StatementList() )? - end=< RBRACE >/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - //{jjtThis.setCoord(begin,end);} - } - - void StatementList() : - {/*@bgen(jjtree) #StatementList(> 1) */ - ASTStatementList jjtn000 = new ASTStatementList(JJTSTATEMENTLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #StatementList(> 1) */ - try { -/*@egen*/ - ( Statement() )+/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - /* Section 12.2: Variable statement */ - - void VariableStatement() : - {/*@bgen(jjtree) VariableStatement */ - ASTVariableStatement jjtn000 = new ASTVariableStatement(JJTVARIABLESTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin, end;} - {/*@bgen(jjtree) VariableStatement */ - try { -/*@egen*/ - - begin=< VAR > VariableDeclarationList() end=EndStatement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - //{ jjtThis.setCoord(begin,end);} - - } - - void VariableDeclarationList() : - {/*@bgen(jjtree) #VariableDeclarationList(> 1) */ - ASTVariableDeclarationList jjtn000 = new ASTVariableDeclarationList(JJTVARIABLEDECLARATIONLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #VariableDeclarationList(> 1) */ - try { -/*@egen*/ - VariableDeclaration() ( "," VariableDeclaration() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void VariableDeclarationListNoIn() : - {/*@bgen(jjtree) #VariableDeclarationList(> 1) */ - ASTVariableDeclarationList jjtn000 = new ASTVariableDeclarationList(JJTVARIABLEDECLARATIONLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #VariableDeclarationList(> 1) */ - try { -/*@egen*/ - VariableDeclarationNoIn() ( "," VariableDeclarationNoIn() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void VariableDeclaration() : - {/*@bgen(jjtree) VariableDeclaration */ - ASTVariableDeclaration jjtn000 = new ASTVariableDeclaration(JJTVARIABLEDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token type;} - {/*@bgen(jjtree) VariableDeclaration */ - try { -/*@egen*/ -// Identifier() ( Initialiser() )? - Identifier()[":" type=getNoReservedIdentifier() {jjtn000.setType(type.image);}] ( Initialiser() )?/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void VariableDeclarationNoIn() : - {} - { - Identifier()/*@bgen(jjtree) #EmptyExpression( jjtree . nodeArity ( ) == 0) */ - { - ASTEmptyExpression jjtn001 = new ASTEmptyExpression(JJTEMPTYEXPRESSION); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ ( InitialiserNoIn() )?/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree . nodeArity ( ) == 0); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void Initialiser() : - {} - { - "=" (LOOKAHEAD(ActionOnAssign() ) ActionOnAssign() | AssignmentExpression()) - } - - void InitialiserNoIn() : - {} - { - "=" AssignmentExpressionNoIn() - } - - - /* Section 12.3: Empty Statement */ - - void EmptyStatement() : - {/*@bgen(jjtree) EmptyStatement */ - ASTEmptyStatement jjtn000 = new ASTEmptyStatement(JJTEMPTYSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) EmptyStatement */ - try { -/*@egen*/ - ";"/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - /* Section 12.4: Expression Statement */ - - void ExpressionStatement() : - {/*@bgen(jjtree) ExpressionStatement */ - ASTExpressionStatement jjtn000 = new ASTExpressionStatement(JJTEXPRESSIONSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) ExpressionStatement */ - try { -/*@egen*/ - Expression() EndStatement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - ASTExpressionStatement ParseExpression() : - {/*@bgen(jjtree) ExpressionStatement */ - ASTExpressionStatement jjtn000 = new ASTExpressionStatement(JJTEXPRESSIONSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) ExpressionStatement */ - try { -/*@egen*/ - //Expression() //To many things! just need a parser like the LeftHandSideExpression rule - //This is a simpler version, which is just what we need - ( - LOOKAHEAD(MemberExpression() "(") CallExpression() - | MemberExpression() - ) - /*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtn000.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - {return jjtn000;}/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - /* Section 12.5: The if Statement */ - - void IfStatement() : - {/*@bgen(jjtree) IfStatement */ - ASTIfStatement jjtn000 = new ASTIfStatement(JJTIFSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) IfStatement */ - try { -/*@egen*/ - begin="if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - //{jjtThis.setCoord(begin,begin); } - } - - - /* Section 12.6: Iteration Statements */ - void IterationStatement() : - {Token begin;Token end;} - { - DoStatement() - | WhileStatement() - | ForStatement() - } - - void DoStatement() : - {/*@bgen(jjtree) DoStatement */ - ASTDoStatement jjtn000 = new ASTDoStatement(JJTDOSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin, end;} - {/*@bgen(jjtree) DoStatement */ - try { -/*@egen*/ - begin= Statement() end= Expression() EndStatement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - // {jjtThis.setCoord(begin,end);} - } - - void WhileStatement() : - {/*@bgen(jjtree) WhileStatement */ - ASTWhileStatement jjtn000 = new ASTWhileStatement(JJTWHILESTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) WhileStatement */ - try { -/*@egen*/ - begin= Expression() Statement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - // {jjtThis.setCoord(begin,begin);} - } - - void ForStatement() : - {Token begin;boolean isEach = false;} - { - begin=< FOR >( - (/*@bgen(jjtree) ForVarInStatement */ - { - ASTForVarInStatement jjtn001 = new ASTForVarInStatement(JJTFORVARINSTATEMENT); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ //for each var - ("var" VariableDeclarationNoIn() Expression() Statement()/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn001, true); - jjtc001 = false; - jjtn001.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - {jjtn001.setEach(true);} /*{jjtThis.setCoord(begin,begin);*/)/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - |/*@bgen(jjtree) ForInStatement */ - { - ASTForInStatement jjtn002 = new ASTForInStatement(JJTFORINSTATEMENT); - boolean jjtc002 = true; - jjtree.openNodeScope(jjtn002); - jjtn002.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*///for each - ( LeftHandSideExpressionForIn() Expression() Statement()/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn002, true); - jjtc002 = false; - jjtn002.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - {jjtn002.setEach(true);} /*{jjtThis.setCoord(begin,begin);*/)/*@bgen(jjtree)*/ - } catch (Throwable jjte002) { - if (jjtc002) { - jjtree.clearNodeScope(jjtn002); - jjtc002 = false; - } else { - jjtree.popNode(); - } - if (jjte002 instanceof RuntimeException) { - throw (RuntimeException)jjte002; - } - if (jjte002 instanceof ParseException) { - throw (ParseException)jjte002; - } - throw (Error)jjte002; - } finally { - if (jjtc002) { - jjtree.closeNodeScope(jjtn002, true); - jjtn002.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - ) - | - ( //for ...;...;... - LOOKAHEAD( (ExpressionNoIn())? ";")/*@bgen(jjtree) ForStatement */ - { - ASTForStatement jjtn009 = new ASTForStatement(JJTFORSTATEMENT); - boolean jjtc009 = true; - jjtree.openNodeScope(jjtn009); - jjtn009.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ (/*@bgen(jjtree) #EmptyExpression( jjtree . nodeArity ( ) == 0) */ - { - ASTEmptyExpression jjtn004 = new ASTEmptyExpression(JJTEMPTYEXPRESSION); - boolean jjtc004 = true; - jjtree.openNodeScope(jjtn004); - jjtn004.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/(/*@bgen(jjtree) PreAssignmentList */ - { - ASTPreAssignmentList jjtn003 = new ASTPreAssignmentList(JJTPREASSIGNMENTLIST); - boolean jjtc003 = true; - jjtree.openNodeScope(jjtn003); - jjtn003.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ ExpressionNoIn()/*@bgen(jjtree)*/ - } catch (Throwable jjte003) { - if (jjtc003) { - jjtree.clearNodeScope(jjtn003); - jjtc003 = false; - } else { - jjtree.popNode(); - } - if (jjte003 instanceof RuntimeException) { - throw (RuntimeException)jjte003; - } - if (jjte003 instanceof ParseException) { - throw (ParseException)jjte003; - } - throw (Error)jjte003; - } finally { - if (jjtc003) { - jjtree.closeNodeScope(jjtn003, true); - jjtn003.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ )?/*@bgen(jjtree)*/ - } catch (Throwable jjte004) { - if (jjtc004) { - jjtree.clearNodeScope(jjtn004); - jjtc004 = false; - } else { - jjtree.popNode(); - } - if (jjte004 instanceof RuntimeException) { - throw (RuntimeException)jjte004; - } - if (jjte004 instanceof ParseException) { - throw (ParseException)jjte004; - } - throw (Error)jjte004; - } finally { - if (jjtc004) { - jjtree.closeNodeScope(jjtn004, jjtree . nodeArity ( ) == 0); - jjtn004.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ ";"/*@bgen(jjtree) #EmptyExpression( jjtree . nodeArity ( ) == 0) */ - { - ASTEmptyExpression jjtn006 = new ASTEmptyExpression(JJTEMPTYEXPRESSION); - boolean jjtc006 = true; - jjtree.openNodeScope(jjtn006); - jjtn006.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - (/*@bgen(jjtree) ForConditionList */ - { - ASTForConditionList jjtn005 = new ASTForConditionList(JJTFORCONDITIONLIST); - boolean jjtc005 = true; - jjtree.openNodeScope(jjtn005); - jjtn005.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ Expression()/*@bgen(jjtree)*/ - } catch (Throwable jjte005) { - if (jjtc005) { - jjtree.clearNodeScope(jjtn005); - jjtc005 = false; - } else { - jjtree.popNode(); - } - if (jjte005 instanceof RuntimeException) { - throw (RuntimeException)jjte005; - } - if (jjte005 instanceof ParseException) { - throw (ParseException)jjte005; - } - throw (Error)jjte005; - } finally { - if (jjtc005) { - jjtree.closeNodeScope(jjtn005, true); - jjtn005.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ )?/*@bgen(jjtree)*/ - } catch (Throwable jjte006) { - if (jjtc006) { - jjtree.clearNodeScope(jjtn006); - jjtc006 = false; - } else { - jjtree.popNode(); - } - if (jjte006 instanceof RuntimeException) { - throw (RuntimeException)jjte006; - } - if (jjte006 instanceof ParseException) { - throw (ParseException)jjte006; - } - throw (Error)jjte006; - } finally { - if (jjtc006) { - jjtree.closeNodeScope(jjtn006, jjtree . nodeArity ( ) == 0); - jjtn006.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ ";"/*@bgen(jjtree) #EmptyExpression( jjtree . nodeArity ( ) == 0) */ - { - ASTEmptyExpression jjtn008 = new ASTEmptyExpression(JJTEMPTYEXPRESSION); - boolean jjtc008 = true; - jjtree.openNodeScope(jjtn008); - jjtn008.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - (/*@bgen(jjtree) PostAssignmentList */ - { - ASTPostAssignmentList jjtn007 = new ASTPostAssignmentList(JJTPOSTASSIGNMENTLIST); - boolean jjtc007 = true; - jjtree.openNodeScope(jjtn007); - jjtn007.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ Expression()/*@bgen(jjtree)*/ - } catch (Throwable jjte007) { - if (jjtc007) { - jjtree.clearNodeScope(jjtn007); - jjtc007 = false; - } else { - jjtree.popNode(); - } - if (jjte007 instanceof RuntimeException) { - throw (RuntimeException)jjte007; - } - if (jjte007 instanceof ParseException) { - throw (ParseException)jjte007; - } - throw (Error)jjte007; - } finally { - if (jjtc007) { - jjtree.closeNodeScope(jjtn007, true); - jjtn007.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ )?/*@bgen(jjtree)*/ - } catch (Throwable jjte008) { - if (jjtc008) { - jjtree.clearNodeScope(jjtn008); - jjtc008 = false; - } else { - jjtree.popNode(); - } - if (jjte008 instanceof RuntimeException) { - throw (RuntimeException)jjte008; - } - if (jjte008 instanceof ParseException) { - throw (ParseException)jjte008; - } - throw (Error)jjte008; - } finally { - if (jjtc008) { - jjtree.closeNodeScope(jjtn008, jjtree . nodeArity ( ) == 0); - jjtn008.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ ")" - Statement() /*{jjtThis.setCoord(begin,begin); }*/)/*@bgen(jjtree)*/ - } catch (Throwable jjte009) { - if (jjtc009) { - jjtree.clearNodeScope(jjtn009); - jjtc009 = false; - } else { - jjtree.popNode(); - } - if (jjte009 instanceof RuntimeException) { - throw (RuntimeException)jjte009; - } - if (jjte009 instanceof ParseException) { - throw (ParseException)jjte009; - } - throw (Error)jjte009; - } finally { - if (jjtc009) { - jjtree.closeNodeScope(jjtn009, true); - jjtn009.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - |//for var ...;...;... - LOOKAHEAD("var" VariableDeclarationList() ";")/*@bgen(jjtree) ForVarStatement */ - { - ASTForVarStatement jjtn015 = new ASTForVarStatement(JJTFORVARSTATEMENT); - boolean jjtc015 = true; - jjtree.openNodeScope(jjtn015); - jjtn015.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ ("var"/*@bgen(jjtree) PreAssignmentList */ - { - ASTPreAssignmentList jjtn010 = new ASTPreAssignmentList(JJTPREASSIGNMENTLIST); - boolean jjtc010 = true; - jjtree.openNodeScope(jjtn010); - jjtn010.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ VariableDeclarationList()/*@bgen(jjtree)*/ - } catch (Throwable jjte010) { - if (jjtc010) { - jjtree.clearNodeScope(jjtn010); - jjtc010 = false; - } else { - jjtree.popNode(); - } - if (jjte010 instanceof RuntimeException) { - throw (RuntimeException)jjte010; - } - if (jjte010 instanceof ParseException) { - throw (ParseException)jjte010; - } - throw (Error)jjte010; - } finally { - if (jjtc010) { - jjtree.closeNodeScope(jjtn010, true); - jjtn010.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ ";"/*@bgen(jjtree) #EmptyExpression( jjtree . nodeArity ( ) == 0) */ - { - ASTEmptyExpression jjtn012 = new ASTEmptyExpression(JJTEMPTYEXPRESSION); - boolean jjtc012 = true; - jjtree.openNodeScope(jjtn012); - jjtn012.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - (/*@bgen(jjtree) ForConditionList */ - { - ASTForConditionList jjtn011 = new ASTForConditionList(JJTFORCONDITIONLIST); - boolean jjtc011 = true; - jjtree.openNodeScope(jjtn011); - jjtn011.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ Expression()/*@bgen(jjtree)*/ - } catch (Throwable jjte011) { - if (jjtc011) { - jjtree.clearNodeScope(jjtn011); - jjtc011 = false; - } else { - jjtree.popNode(); - } - if (jjte011 instanceof RuntimeException) { - throw (RuntimeException)jjte011; - } - if (jjte011 instanceof ParseException) { - throw (ParseException)jjte011; - } - throw (Error)jjte011; - } finally { - if (jjtc011) { - jjtree.closeNodeScope(jjtn011, true); - jjtn011.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ )?/*@bgen(jjtree)*/ - } catch (Throwable jjte012) { - if (jjtc012) { - jjtree.clearNodeScope(jjtn012); - jjtc012 = false; - } else { - jjtree.popNode(); - } - if (jjte012 instanceof RuntimeException) { - throw (RuntimeException)jjte012; - } - if (jjte012 instanceof ParseException) { - throw (ParseException)jjte012; - } - throw (Error)jjte012; - } finally { - if (jjtc012) { - jjtree.closeNodeScope(jjtn012, jjtree . nodeArity ( ) == 0); - jjtn012.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ ";"/*@bgen(jjtree) #EmptyExpression( jjtree . nodeArity ( ) == 0) */ - { - ASTEmptyExpression jjtn014 = new ASTEmptyExpression(JJTEMPTYEXPRESSION); - boolean jjtc014 = true; - jjtree.openNodeScope(jjtn014); - jjtn014.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - (/*@bgen(jjtree) PostAssignmentList */ - { - ASTPostAssignmentList jjtn013 = new ASTPostAssignmentList(JJTPOSTASSIGNMENTLIST); - boolean jjtc013 = true; - jjtree.openNodeScope(jjtn013); - jjtn013.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ Expression()/*@bgen(jjtree)*/ - } catch (Throwable jjte013) { - if (jjtc013) { - jjtree.clearNodeScope(jjtn013); - jjtc013 = false; - } else { - jjtree.popNode(); - } - if (jjte013 instanceof RuntimeException) { - throw (RuntimeException)jjte013; - } - if (jjte013 instanceof ParseException) { - throw (ParseException)jjte013; - } - throw (Error)jjte013; - } finally { - if (jjtc013) { - jjtree.closeNodeScope(jjtn013, true); - jjtn013.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ )?/*@bgen(jjtree)*/ - } catch (Throwable jjte014) { - if (jjtc014) { - jjtree.clearNodeScope(jjtn014); - jjtc014 = false; - } else { - jjtree.popNode(); - } - if (jjte014 instanceof RuntimeException) { - throw (RuntimeException)jjte014; - } - if (jjte014 instanceof ParseException) { - throw (ParseException)jjte014; - } - throw (Error)jjte014; - } finally { - if (jjtc014) { - jjtree.closeNodeScope(jjtn014, jjtree . nodeArity ( ) == 0); - jjtn014.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - Statement() /*{jjtThis.setCoord(begin,begin);}*/)/*@bgen(jjtree)*/ - } catch (Throwable jjte015) { - if (jjtc015) { - jjtree.clearNodeScope(jjtn015); - jjtc015 = false; - } else { - jjtree.popNode(); - } - if (jjte015 instanceof RuntimeException) { - throw (RuntimeException)jjte015; - } - if (jjte015 instanceof ParseException) { - throw (ParseException)jjte015; - } - throw (Error)jjte015; - } finally { - if (jjtc015) { - jjtree.closeNodeScope(jjtn015, true); - jjtn015.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - |/*@bgen(jjtree) ForVarInStatement */ - { - ASTForVarInStatement jjtn016 = new ASTForVarInStatement(JJTFORVARINSTATEMENT); - boolean jjtc016 = true; - jjtree.openNodeScope(jjtn016); - jjtn016.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ //for var in/of - ( "var" VariableDeclarationNoIn() (|( {isEach = true;})) Expression() Statement()/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn016, true); - jjtc016 = false; - jjtn016.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - {jjtn016.setEach(isEach);} /*{jjtThis.setCoord(begin,begin); }*/)/*@bgen(jjtree)*/ - } catch (Throwable jjte016) { - if (jjtc016) { - jjtree.clearNodeScope(jjtn016); - jjtc016 = false; - } else { - jjtree.popNode(); - } - if (jjte016 instanceof RuntimeException) { - throw (RuntimeException)jjte016; - } - if (jjte016 instanceof ParseException) { - throw (ParseException)jjte016; - } - throw (Error)jjte016; - } finally { - if (jjtc016) { - jjtree.closeNodeScope(jjtn016, true); - jjtn016.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - |/*@bgen(jjtree) ForInStatement */ - { - ASTForInStatement jjtn017 = new ASTForInStatement(JJTFORINSTATEMENT); - boolean jjtc017 = true; - jjtree.openNodeScope(jjtn017); - jjtn017.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ //for in/of - ( LeftHandSideExpressionForIn() (|( {isEach = true;})) Expression() Statement()/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn017, true); - jjtc017 = false; - jjtn017.jjtSetLastToken(getToken(0)); - } -/*@egen*/ - {jjtn017.setEach(isEach);}/*{jjtThis.setCoord(begin,begin); }*/)/*@bgen(jjtree)*/ - } catch (Throwable jjte017) { - if (jjtc017) { - jjtree.clearNodeScope(jjtn017); - jjtc017 = false; - } else { - jjtree.popNode(); - } - if (jjte017 instanceof RuntimeException) { - throw (RuntimeException)jjte017; - } - if (jjte017 instanceof ParseException) { - throw (ParseException)jjte017; - } - throw (Error)jjte017; - } finally { - if (jjtc017) { - jjtree.closeNodeScope(jjtn017, true); - jjtn017.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - ) - ) - } - /* Section 12.7: The continue Statement */ - - void ContinueStatement() : - {/*@bgen(jjtree) ContinueStatement */ - ASTContinueStatement jjtn000 = new ASTContinueStatement(JJTCONTINUESTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) ContinueStatement */ - try { -/*@egen*/ - begin="continue" ( LOOKAHEAD(LabelIdentifier()) LabelIdentifier() )? EndStatement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - /*{jjtThis.setCoord(begin,begin); }*/ - } - - - - /* Section 12.8: The break Statement */ - - void BreakStatement() : - {/*@bgen(jjtree) BreakStatement */ - ASTBreakStatement jjtn000 = new ASTBreakStatement(JJTBREAKSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) BreakStatement */ - try { -/*@egen*/ - begin="break"( LOOKAHEAD(LabelIdentifier()) LabelIdentifier() )? EndStatement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - /*{jjtThis.setCoord(begin,begin); }*/ - } - - - /* Section 12.9 The return Statement */ - - void ReturnStatement() : - {/*@bgen(jjtree) ReturnStatement */ - ASTReturnStatement jjtn000 = new ASTReturnStatement(JJTRETURNSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) ReturnStatement */ - try { -/*@egen*/ - "return"/*@bgen(jjtree) #EmptyExpression( jjtree . nodeArity ( ) == 0) */ - { - ASTEmptyExpression jjtn001 = new ASTEmptyExpression(JJTEMPTYEXPRESSION); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ ( LOOKAHEAD(Expression()) Expression() )?/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree . nodeArity ( ) == 0); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ EndStatement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - /* Custom */ - void YieldStatement() : - {/*@bgen(jjtree) YieldStatement */ - ASTYieldStatement jjtn000 = new ASTYieldStatement(JJTYIELDSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) YieldStatement */ - try { -/*@egen*/ - begin="yield" ( YieldStar() )?/*@bgen(jjtree) #EmptyExpression( jjtree . nodeArity ( ) == 0) */ - { - ASTEmptyExpression jjtn001 = new ASTEmptyExpression(JJTEMPTYEXPRESSION); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ ( LOOKAHEAD(Expression()) Expression() )?/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, jjtree . nodeArity ( ) == 0); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ EndStatement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - void YieldStar() : - {/*@bgen(jjtree) YieldStar */ - ASTYieldStar jjtn000 = new ASTYieldStar(JJTYIELDSTAR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) YieldStar */ - try { -/*@egen*/ - "*"/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - /* Section 12.10: The with Statement */ - - void WithStatement() : - {/*@bgen(jjtree) WithStatement */ - ASTWithStatement jjtn000 = new ASTWithStatement(JJTWITHSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) WithStatement */ - try { -/*@egen*/ - "with" "(" Expression() ")" Statement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - /* 12.11 The switch Statement */ - - void SwitchStatement() : - {/*@bgen(jjtree) SwitchStatement */ - ASTSwitchStatement jjtn000 = new ASTSwitchStatement(JJTSWITCHSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) SwitchStatement */ - try { -/*@egen*/ - begin="switch" "(" Expression() ")" CaseBlock()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - /*{jjtThis.setCoord(begin,begin); }*/ - } - - void CaseBlock() : - {/*@bgen(jjtree) CaseGroups */ - ASTCaseGroups jjtn000 = new ASTCaseGroups(JJTCASEGROUPS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin,end;} - {/*@bgen(jjtree) CaseGroups */ - try { -/*@egen*/ - begin=< LBRACE > ( CaseClauses() )? - ( - end=< RBRACE > | DefaultClause() ( CaseClauses() )? end=< RBRACE > - )/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - /*{jjtThis.setCoord(begin,end); }*/ - } - - void CaseClauses() : - {} - { - ( CaseClause() )+ - } - - void CaseClause() : - {/*@bgen(jjtree) CaseGroup */ - ASTCaseGroup jjtn000 = new ASTCaseGroup(JJTCASEGROUP); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) CaseGroup */ - try { -/*@egen*/ - (/*@bgen(jjtree) CaseGuard */ - { - ASTCaseGuard jjtn001 = new ASTCaseGuard(JJTCASEGUARD); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ ( begin="case" Expression() ":" )/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ ) ( StatementList() )?/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - /*{jjtThis.setCoord(begin,begin); }*/ - } - - void DefaultClause() : - {/*@bgen(jjtree) CaseGroup */ - ASTCaseGroup jjtn000 = new ASTCaseGroup(JJTCASEGROUP); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) CaseGroup */ - try { -/*@egen*/ - (/*@bgen(jjtree) CaseGuard */ - { - ASTCaseGuard jjtn001 = new ASTCaseGuard(JJTCASEGUARD); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ ( begin="default" ":" )/*@bgen(jjtree)*/ - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ ) ( StatementList() )?/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - /*{jjtThis.setCoord(begin,begin); }*/ - } - - - /* Section 12.12: Labelled Statements */ - - void LabelledStatement() : - {/*@bgen(jjtree) LabelledStatement */ - ASTLabelledStatement jjtn000 = new ASTLabelledStatement(JJTLABELLEDSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) LabelledStatement */ - try { -/*@egen*/ - Identifier() ":" Statement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void ThrowStatement() : - {/*@bgen(jjtree) ThrowStatement */ - ASTThrowStatement jjtn000 = new ASTThrowStatement(JJTTHROWSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) ThrowStatement */ - try { -/*@egen*/ - begin="throw" Expression() EndStatement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - /*{jjtThis.setCoord(begin,begin); }*/ - } - - void TryStatement() : - {/*@bgen(jjtree) TryStatement */ - ASTTryStatement jjtn000 = new ASTTryStatement(JJTTRYSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) TryStatement */ - try { -/*@egen*/ - begin="try" Block() - ( - ( Finally() | Catch() [Finally()]) - )/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - /*{jjtThis.setCoord(begin,begin); }*/ - } - - void Catch() : - {/*@bgen(jjtree) CatchClause */ - ASTCatchClause jjtn000 = new ASTCatchClause(JJTCATCHCLAUSE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) CatchClause */ - try { -/*@egen*/ - begin="catch" "(" Identifier() ")" Block()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - /*{jjtThis.setCoord(begin,begin); }*/ - } - - void Finally() : - {/*@bgen(jjtree) FinallyClause */ - ASTFinallyClause jjtn000 = new ASTFinallyClause(JJTFINALLYCLAUSE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) FinallyClause */ - try { -/*@egen*/ - begin="finally" Block()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - /*{jjtThis.setCoord(begin,begin); }*/ - } - - /* Section 13: Function Definition */ - - void FunctionDeclaration() : - {/*@bgen(jjtree) FunctionDeclaration */ - ASTFunctionDeclaration jjtn000 = new ASTFunctionDeclaration(JJTFUNCTIONDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) FunctionDeclaration */ - try { -/*@egen*/ - begin="function" Identifier()/*@bgen(jjtree) FormalParameterList */ - { - ASTFormalParameterList jjtn001 = new ASTFormalParameterList(JJTFORMALPARAMETERLIST); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ ( "(" ( FormalParameterList() )? ")" )/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ FunctionBody()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - /*{jjtThis.setCoord(begin,begin); }*/ - } - - void GeneratorFunctionDeclaration() : - {/*@bgen(jjtree) GeneratorFunctionDeclaration */ - ASTGeneratorFunctionDeclaration jjtn000 = new ASTGeneratorFunctionDeclaration(JJTGENERATORFUNCTIONDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) GeneratorFunctionDeclaration */ - try { -/*@egen*/ - begin="function*" Identifier()/*@bgen(jjtree) FormalParameterList */ - { - ASTFormalParameterList jjtn001 = new ASTFormalParameterList(JJTFORMALPARAMETERLIST); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ ( "(" ( FormalParameterList() )? ")" )/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ FunctionBody()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - /*{jjtThis.setCoord(begin,begin); }*/ - } - - - void ArrowFunctionBody() : - {/*@bgen(jjtree) Block */ - ASTBlock jjtn000 = new ASTBlock(JJTBLOCK); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) Block */ - try { -/*@egen*/ - < LBRACE > (Statement())* < RBRACE >/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void ArrowFunctionExpression() : - {/*@bgen(jjtree) ArrowFunctionExpression */ - ASTArrowFunctionExpression jjtn000 = new ASTArrowFunctionExpression(JJTARROWFUNCTIONEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) ArrowFunctionExpression */ - try { -/*@egen*//*@bgen(jjtree) FormalParameterList */ - { - ASTFormalParameterList jjtn001 = new ASTFormalParameterList(JJTFORMALPARAMETERLIST); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ - ( "(" (FormalParameterList())? ")" | Identifier() )/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - ( LOOKAHEAD(ArrowFunctionBody()) ArrowFunctionBody() | LOOKAHEAD(ExpressionNoIn()) ExpressionNoIn() )/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - - -//ActionOnAssign() -// | Expression() - -//LOOKAHEAD(ArrowFunctionBody() -//LOOKAHEAD(ExpressionNoIn()) - //| LOOKAHEAD(PrimaryExpression()) PrimaryExpression() - // LOOKAHEAD(ActionOnAssign()) ActionOnAssign() - //| ConditionalExpression() - - //( LOOKAHEAD(ArrowFunctionBody()) ArrowFunctionBody() | LOOKAHEAD(Expression())Expression()) - //ConditionalExpression() - //( (LOOKAHEAD(FunctionBody()) FunctionBody()) | (LOOKAHEAD(Expression()) Expression()) ) - //(ArrowFunctionBody() | PrimaryExpression()) - //(ArrowFunctionBody() | ( LOOKAHEAD(MemberExpression() "(") CallExpression() | MemberExpression() )) - //(ArrowFunctionBody() | ( LOOKAHEAD(MemberExpression() "(") CallExpression() | MemberExpression() )) - //( "(" FormalParameterList() ")" | Identifier() ) #FormalParameterList (FunctionBody() | ActionOnAssign() | LogicalORExpression()) - //"(" ( FormalParameterList() )? ")" #ArrowParameterList "=>" (FunctionBody()) - //( ("(" ( FormalParameterList() )? ")") | Identifier()) #ArrowParameterList "=>" FunctionBody() - /*{jjtThis.setCoord(begin,begin); }*/ - } - - void FunctionExpression() : - {/*@bgen(jjtree) FunctionExpression */ - ASTFunctionExpression jjtn000 = new ASTFunctionExpression(JJTFUNCTIONEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) FunctionExpression */ - try { -/*@egen*/ - begin="function" ( Identifier() )?/*@bgen(jjtree) FormalParameterList */ - { - ASTFormalParameterList jjtn001 = new ASTFormalParameterList(JJTFORMALPARAMETERLIST); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ ( "(" ( FormalParameterList() )? ")" )/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ FunctionBody()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - /*{jjtThis.setCoord(begin,begin); }*/ - } - - void GeneratorFunctionExpression() : - {/*@bgen(jjtree) GeneratorFunctionExpression */ - ASTGeneratorFunctionExpression jjtn000 = new ASTGeneratorFunctionExpression(JJTGENERATORFUNCTIONEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/Token begin;} - {/*@bgen(jjtree) GeneratorFunctionExpression */ - try { -/*@egen*/ - begin="function*" ( Identifier() )?/*@bgen(jjtree) FormalParameterList */ - { - ASTFormalParameterList jjtn001 = new ASTFormalParameterList(JJTFORMALPARAMETERLIST); - boolean jjtc001 = true; - jjtree.openNodeScope(jjtn001); - jjtn001.jjtSetFirstToken(getToken(1)); - } - try { -/*@egen*/ ( "(" ( FormalParameterList() )? ")" )/*@bgen(jjtree)*/ - } catch (Throwable jjte001) { - if (jjtc001) { - jjtree.clearNodeScope(jjtn001); - jjtc001 = false; - } else { - jjtree.popNode(); - } - if (jjte001 instanceof RuntimeException) { - throw (RuntimeException)jjte001; - } - if (jjte001 instanceof ParseException) { - throw (ParseException)jjte001; - } - throw (Error)jjte001; - } finally { - if (jjtc001) { - jjtree.closeNodeScope(jjtn001, true); - jjtn001.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ FunctionBody()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - /*{jjtThis.setCoord(begin,begin); }*/ - } - - void FormalParameterList() : - {} - { - (Identifier()) ( "," (Identifier()) )* - } - - void FunctionBody() : - {/*@bgen(jjtree) Block */ - ASTBlock jjtn000 = new ASTBlock(JJTBLOCK); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) Block */ - try { -/*@egen*/ - < LBRACE > (SourceElements())? < RBRACE >/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - /* Section 14: Program * - - ASTProgram Program() #Program : - {} - { - JavaScript() - - { return jjtThis; } - } - /**/ - - void JavaScript() : - {/*@bgen(jjtree) JavaScript */ - ASTJavaScript jjtn000 = new ASTJavaScript(JJTJAVASCRIPT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) JavaScript */ - try { -/*@egen*/ - (SourceElements())?/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - - void SourceElements() : - {} - { - (SourceElement())+ - } - - void SourceElement() : - {} - { - LOOKAHEAD("function*" Identifier()) GeneratorFunctionDeclaration() | LOOKAHEAD("function" Identifier()) FunctionDeclaration() | Statement() - } - - - - - - /* - * Grammar for parsing JScript .NET contructs: ( import System; var contents : - * String = reader.ReadToEnd(); ) Refer: src/hostenv_jsc.js - */ - - void ImportStatement(): - {} - { - "import" Name() [ "." "*" ] EndStatement() - } - - - void Name(): - {} - { - ( LOOKAHEAD(2) < DOT > )* - } - - - void JScriptVarStatement() : - {/*@bgen(jjtree) VariableStatement */ - ASTVariableStatement jjtn000 = new ASTVariableStatement(JJTVARIABLESTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) VariableStatement */ - try { -/*@egen*/ - < VAR > JScriptVarDeclarationList() EndStatement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void JScriptVarDeclarationList() : - {/*@bgen(jjtree) #VariableDeclarationList(> 1) */ - ASTVariableDeclarationList jjtn000 = new ASTVariableDeclarationList(JJTVARIABLEDECLARATIONLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) #VariableDeclarationList(> 1) */ - try { -/*@egen*/ - JScriptVarDeclaration() ( < COMMA > JScriptVarDeclaration() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, jjtree.nodeArity() > 1); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - void JScriptVarDeclaration() : - {/*@bgen(jjtree) VariableDeclaration */ - ASTVariableDeclaration jjtn000 = new ASTVariableDeclaration(JJTVARIABLEDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtn000.jjtSetFirstToken(getToken(1)); -/*@egen*/} - {/*@bgen(jjtree) VariableDeclaration */ - try { -/*@egen*/ - Identifier() ":" ( Initialiser() )?/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtn000.jjtSetLastToken(getToken(0)); - } - } -/*@egen*/ - } - - Token EndStatement() : - {Token end;} - { - try - { - end=< SEMICOLON > - {return end;} - - }catch(ParseException e) - { - if(e.expectedTokenSet.size() > MAX_EXCEPTION_TOKEN_SIZE - || (e.expectedTokenSet.size() == 1 && e.expectedTokenSet.get(0).equals(";"))){ - - Token foundToken = getToken(1); - String line = "at line " + e.currentToken.beginLine + ", column " + e.currentToken.beginColumn; - String message = line+": did you forget a ';'?"; - if (foundToken != null){ - message+=" (possible errant token: "+ foundToken + ")"; - } - e = new ParseException(message); - SimpleNode currNode = getCurrentNode(); - exceptions.add(e); - ParseExceptionData excData = new ParseExceptionData(e); - if (currNode != null){ - currNode.setExceptionData(excData); - } - }else{ - error_skipto(e, SEMICOLON); - } - - // - } - - {return new Token(SEMICOLON);} - - } - -JAVACODE -void error_skipto(ParseException e, int kind) { -// ParseException e = generateParseException(); // generate the exception object. -// System.out.println(e.toString()); // print the error message - exceptions.add(e); - SimpleNode currNode = getCurrentNode(); - ParseExceptionData excData = new ParseExceptionData(e); - excData.setSkippedToToken(kind); - Token t = null; -// int braceCount = 0; - skipper: do { - Token test = getToken(1); -// System.out.println(exprBraceCount); - if(test == null || test.kind == END) - { -// System.out.println("I'm breaking here with:"+test); - break; - } - switch(test.kind) - { - case RBRACE: - exprBraceCount--; - if(exprBraceCount < 0) - break skipper; - break; - } - - - t = getNextToken(); - - if(t != null) - excData.addSkippedToken(t); -// System.out.println("Skipped: "+t+" token("+test+")"); - } while (t != null && (t.kind != kind && t.kind != EOF)); - // The above loop consumes tokens all the way up to a token of -// "kind". We use a do-while loop rather than a while because the -// current token is the one immediately before the erroneous token -// (in our case the token immediately before what should have been -// "if"/"while". - - if (currNode != null){ - currNode.setExceptionData(excData); - } - if(t == null || t.kind == EOF){ - throw new StopParseException(); - } -} - -JAVACODE -void error_noSkip(ParseException e) { - System.out.println("--------------NO SKIP-----------------"); -// ParseException e = generateParseException(); // generate the exception object. -// System.out.println(e.toString()); // print the error message - SimpleNode currNode = getCurrentNode(); - ParseExceptionData excData = new ParseExceptionData(e); - if (currNode != null){ - currNode.setExceptionData(excData); - } -} \ No newline at end of file diff --git a/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScriptConstants.java b/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScriptConstants.java deleted file mode 100644 index 636e6372b..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScriptConstants.java +++ /dev/null @@ -1,534 +0,0 @@ -/* Generated By:JJTree&JavaCC: Do not edit this line. LARAEcmaScriptConstants.java */ -package org.dojo.jsl.parser.ast; - - -/** - * Token literal values and constants. - * Generated by org.javacc.parser.OtherFilesGen#start() - */ -public interface LARAEcmaScriptConstants { - - /** End of File. */ - int EOF = 0; - /** RegularExpression Id. */ - int WHITE_SPACE = 1; - /** RegularExpression Id. */ - int TAB = 2; - /** RegularExpression Id. */ - int VT = 3; - /** RegularExpression Id. */ - int FF = 4; - /** RegularExpression Id. */ - int SP = 5; - /** RegularExpression Id. */ - int NBSP = 6; - /** RegularExpression Id. */ - int USP = 7; - /** RegularExpression Id. */ - int LINE_TERMINATOR = 8; - /** RegularExpression Id. */ - int LF = 9; - /** RegularExpression Id. */ - int CR = 10; - /** RegularExpression Id. */ - int LS = 11; - /** RegularExpression Id. */ - int PS = 12; - /** RegularExpression Id. */ - int SINGLE_LINE_COMMENT = 15; - /** RegularExpression Id. */ - int MULTI_LINE_COMMENT = 16; - /** RegularExpression Id. */ - int INCLUDE = 18; - /** RegularExpression Id. */ - int ASPECTDEF = 19; - /** RegularExpression Id. */ - int CODEDEF = 20; - /** RegularExpression Id. */ - int INPUT = 21; - /** RegularExpression Id. */ - int OUTPUT = 22; - /** RegularExpression Id. */ - int STATICDECL = 23; - /** RegularExpression Id. */ - int SELECT = 24; - /** RegularExpression Id. */ - int APPLY = 25; - /** RegularExpression Id. */ - int TO = 26; - /** RegularExpression Id. */ - int CALL = 27; - /** RegularExpression Id. */ - int RUN = 28; - /** RegularExpression Id. */ - int CMD = 29; - /** RegularExpression Id. */ - int CONDITION = 30; - /** RegularExpression Id. */ - int BEGIN = 31; - /** RegularExpression Id. */ - int INSERT = 32; - /** RegularExpression Id. */ - int EXEC = 33; - /** RegularExpression Id. */ - int OUTPUT_ACT = 34; - /** RegularExpression Id. */ - int BEFORE = 35; - /** RegularExpression Id. */ - int AFTER = 36; - /** RegularExpression Id. */ - int AROUND = 37; - /** RegularExpression Id. */ - int REPLACE = 38; - /** RegularExpression Id. */ - int DEFINE = 39; - /** RegularExpression Id. */ - int CHECK = 40; - /** RegularExpression Id. */ - int INITIALIZE = 41; - /** RegularExpression Id. */ - int FINALIZE = 42; - /** RegularExpression Id. */ - int END = 43; - /** RegularExpression Id. */ - int DYNAMIC = 44; - /** RegularExpression Id. */ - int SEQUENCIAL = 45; - /** RegularExpression Id. */ - int PARALLEL = 46; - /** RegularExpression Id. */ - int BREAK = 47; - /** RegularExpression Id. */ - int CONTINUE = 48; - /** RegularExpression Id. */ - int DELETE = 49; - /** RegularExpression Id. */ - int ELSE = 50; - /** RegularExpression Id. */ - int FOR = 51; - /** RegularExpression Id. */ - int FUNCTION = 52; - /** RegularExpression Id. */ - int FUNCTION_GEN = 53; - /** RegularExpression Id. */ - int IF = 54; - /** RegularExpression Id. */ - int IN = 55; - /** RegularExpression Id. */ - int OF = 56; - /** RegularExpression Id. */ - int EACH = 57; - /** RegularExpression Id. */ - int NEW = 58; - /** RegularExpression Id. */ - int RETURN = 59; - /** RegularExpression Id. */ - int YIELD = 60; - /** RegularExpression Id. */ - int THIS = 61; - /** RegularExpression Id. */ - int TYPEOF = 62; - /** RegularExpression Id. */ - int VAR = 63; - /** RegularExpression Id. */ - int VOID = 64; - /** RegularExpression Id. */ - int WHILE = 65; - /** RegularExpression Id. */ - int WITH = 66; - /** RegularExpression Id. */ - int CASE = 67; - /** RegularExpression Id. */ - int CATCH = 68; - /** RegularExpression Id. */ - int CLASS = 69; - /** RegularExpression Id. */ - int CONST = 70; - /** RegularExpression Id. */ - int DEBUGGER = 71; - /** RegularExpression Id. */ - int _DEFAULT = 72; - /** RegularExpression Id. */ - int DO = 73; - /** RegularExpression Id. */ - int ENUM = 74; - /** RegularExpression Id. */ - int EXTENDS = 75; - /** RegularExpression Id. */ - int FINALLY = 76; - /** RegularExpression Id. */ - int IMPORT = 77; - /** RegularExpression Id. */ - int SUPER = 78; - /** RegularExpression Id. */ - int SWITCH = 79; - /** RegularExpression Id. */ - int THROW = 80; - /** RegularExpression Id. */ - int TRY = 81; - /** RegularExpression Id. */ - int ARROW = 82; - /** RegularExpression Id. */ - int LBRACE = 83; - /** RegularExpression Id. */ - int RBRACE = 84; - /** RegularExpression Id. */ - int LPAREN = 85; - /** RegularExpression Id. */ - int RPAREN = 86; - /** RegularExpression Id. */ - int LBRACKET = 87; - /** RegularExpression Id. */ - int RBRACKET = 88; - /** RegularExpression Id. */ - int DOT = 89; - /** RegularExpression Id. */ - int SEMICOLON = 90; - /** RegularExpression Id. */ - int COMMA = 91; - /** RegularExpression Id. */ - int LT = 92; - /** RegularExpression Id. */ - int GT = 93; - /** RegularExpression Id. */ - int LE = 94; - /** RegularExpression Id. */ - int GE = 95; - /** RegularExpression Id. */ - int EQ = 96; - /** RegularExpression Id. */ - int NE = 97; - /** RegularExpression Id. */ - int MATCH = 98; - /** RegularExpression Id. */ - int SEQ = 99; - /** RegularExpression Id. */ - int SNEQ = 100; - /** RegularExpression Id. */ - int PLUS = 101; - /** RegularExpression Id. */ - int MINUS = 102; - /** RegularExpression Id. */ - int STAR = 103; - /** RegularExpression Id. */ - int REM = 104; - /** RegularExpression Id. */ - int INCR = 105; - /** RegularExpression Id. */ - int DECR = 106; - /** RegularExpression Id. */ - int LSHIFT = 107; - /** RegularExpression Id. */ - int RSHIFT = 108; - /** RegularExpression Id. */ - int RUNSHIFT = 109; - /** RegularExpression Id. */ - int BIT_AND = 110; - /** RegularExpression Id. */ - int BIT_OR = 111; - /** RegularExpression Id. */ - int XOR = 112; - /** RegularExpression Id. */ - int BANG = 113; - /** RegularExpression Id. */ - int TILDE = 114; - /** RegularExpression Id. */ - int SC_AND = 115; - /** RegularExpression Id. */ - int SC_OR = 116; - /** RegularExpression Id. */ - int HOOK = 117; - /** RegularExpression Id. */ - int NATURAL_JOIN = 118; - /** RegularExpression Id. */ - int COLON = 119; - /** RegularExpression Id. */ - int ASSIGN = 120; - /** RegularExpression Id. */ - int PLUSASSIGN = 121; - /** RegularExpression Id. */ - int MINUSASSIGN = 122; - /** RegularExpression Id. */ - int STARASSIGN = 123; - /** RegularExpression Id. */ - int REMASSIGN = 124; - /** RegularExpression Id. */ - int LSHIFTASSIGN = 125; - /** RegularExpression Id. */ - int RSIGNEDSHIFTASSIGN = 126; - /** RegularExpression Id. */ - int RUNSIGNEDSHIFTASSIGN = 127; - /** RegularExpression Id. */ - int ANDASSIGN = 128; - /** RegularExpression Id. */ - int ORASSIGN = 129; - /** RegularExpression Id. */ - int XORASSIGN = 130; - /** RegularExpression Id. */ - int INTANCE_OF = 131; - /** RegularExpression Id. */ - int DECIMAL_LITERAL = 132; - /** RegularExpression Id. */ - int NON_ZERO_DIGIT = 133; - /** RegularExpression Id. */ - int EXPONENT_PART = 134; - /** RegularExpression Id. */ - int DECIMAL_INTEGER_LITERAL = 135; - /** RegularExpression Id. */ - int HEX_INTEGER_LITERAL = 136; - /** RegularExpression Id. */ - int DECIMAL_DIGITS = 137; - /** RegularExpression Id. */ - int DECIMAL_DIGIT = 138; - /** RegularExpression Id. */ - int NULL_LITERAL = 139; - /** RegularExpression Id. */ - int BOOLEAN_LITERAL = 140; - /** RegularExpression Id. */ - int STRING_LITERAL = 141; - /** RegularExpression Id. */ - int DOUBLE_STRING_CHARACTERS = 142; - /** RegularExpression Id. */ - int SINGLE_STRING_CHARACTERS = 143; - /** RegularExpression Id. */ - int DOUBLE_STRING_CHARACTER = 144; - /** RegularExpression Id. */ - int SINGLE_STRING_CHARACTER = 145; - /** RegularExpression Id. */ - int ESCAPE_SEQUENCE = 146; - /** RegularExpression Id. */ - int CHARACTER_ESCAPE_SEQUENCE = 147; - /** RegularExpression Id. */ - int SINGLE_ESCAPE_CHARACTER = 148; - /** RegularExpression Id. */ - int NON_ESCAPE_CHARACTER = 149; - /** RegularExpression Id. */ - int HEX_ESCAPE_SEQUENCE = 150; - /** RegularExpression Id. */ - int CODE_LITERAL = 151; - /** RegularExpression Id. */ - int LABEL_IDENTIFIER = 152; - /** RegularExpression Id. */ - int IDENTIFIER_NAME = 153; - /** RegularExpression Id. */ - int IDENTIFIER_START = 154; - /** RegularExpression Id. */ - int IDENTIFIER_PART = 155; - /** RegularExpression Id. */ - int DOLLAR_SIGN = 156; - /** RegularExpression Id. */ - int AT_SIGN = 157; - /** RegularExpression Id. */ - int UNDER_SCORE = 158; - /** RegularExpression Id. */ - int UNICODE_LETTER = 159; - /** RegularExpression Id. */ - int UNICODE_COMBINING_MARK = 160; - /** RegularExpression Id. */ - int MC = 161; - /** RegularExpression Id. */ - int MN = 162; - /** RegularExpression Id. */ - int UNICODE_DIGIT = 163; - /** RegularExpression Id. */ - int UNICODE_CONNECTOR_PUNCTUATION = 164; - /** RegularExpression Id. */ - int UNICODE_ESCAPE_SEQUENCE = 165; - /** RegularExpression Id. */ - int HEX_DIGIT = 166; - /** RegularExpression Id. */ - int SLASHASSIGN = 167; - /** RegularExpression Id. */ - int SLASH = 168; - /** RegularExpression Id. */ - int REGULAR_EXPRESSION_LITERAL = 169; - /** RegularExpression Id. */ - int BACKSLASH_SEQUENCE = 170; - - /** Lexical state. */ - int DEFAULT = 0; - /** Lexical state. */ - int IN_REGEX = 1; - /** Lexical state. */ - int IN_SINGLE_LINE_COMMENT = 2; - /** Lexical state. */ - int IN_MULTI_LINE_COMMENT = 3; - /** Lexical state. */ - int IN_PATTERN = 4; - - /** Literal token values. */ - String[] tokenImage = { - "", - "", - "", - "\"\\u000b\"", - "", - "", - "\"\\u00a0\"", - "", - "", - "\"\\n\"", - "\"\\r\"", - "\"\\u2028\"", - "\"\\u2029\"", - "\"//\"", - "\"/*\"", - "", - "\"*/\"", - "", - "\"include\"", - "\"aspectdef\"", - "\"codedef\"", - "\"input\"", - "\"output\"", - "\"static\"", - "\"select\"", - "\"apply\"", - "\"to\"", - "\"call\"", - "\"run\"", - "\"cmd\"", - "\"condition\"", - "\"begin\"", - "\"insert\"", - "\"exec\"", - "\"out\"", - "\"before\"", - "\"after\"", - "\"around\"", - "\"replace\"", - "\"def\"", - "\"check\"", - "\"initialize\"", - "\"finalize\"", - "\"end\"", - "\"dynamic\"", - "\"seq\"", - "\"par\"", - "\"break\"", - "\"continue\"", - "\"delete\"", - "\"else\"", - "\"for\"", - "\"function\"", - "\"function*\"", - "\"if\"", - "\"in\"", - "\"of\"", - "\"each\"", - "\"new\"", - "\"return\"", - "\"yield\"", - "\"this\"", - "\"typeof\"", - "\"var\"", - "\"void\"", - "\"while\"", - "\"with\"", - "\"case\"", - "\"catch\"", - "\"class\"", - "\"const\"", - "\"debugger\"", - "\"default\"", - "\"do\"", - "\"enum\"", - "\"extends\"", - "\"finally\"", - "\"import\"", - "\"super\"", - "\"switch\"", - "\"throw\"", - "\"try\"", - "\"=>\"", - "\"{\"", - "\"}\"", - "\"(\"", - "\")\"", - "\"[\"", - "\"]\"", - "\".\"", - "\";\"", - "\",\"", - "\"<\"", - "\">\"", - "\"<=\"", - "\">=\"", - "\"==\"", - "\"!=\"", - "\"~=\"", - "\"===\"", - "\"!==\"", - "\"+\"", - "\"-\"", - "\"*\"", - "\"%\"", - "\"++\"", - "\"--\"", - "\"<<\"", - "\">>\"", - "\">>>\"", - "\"&\"", - "\"|\"", - "\"^\"", - "\"!\"", - "\"~\"", - "\"&&\"", - "\"||\"", - "\"?\"", - "\"::\"", - "\":\"", - "\"=\"", - "\"+=\"", - "\"-=\"", - "\"*=\"", - "\"%=\"", - "\"<<=\"", - "\">>=\"", - "\">>>=\"", - "\"&=\"", - "\"|=\"", - "\"^=\"", - "\"instanceof\"", - "", - "", - "", - "", - "", - "", - "", - "\"null\"", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "\"$\"", - "\"@\"", - "\"_\"", - "", - "", - "", - "", - "", - "", - "", - "", - "\"/=\"", - "\"/\"", - "", - "", - }; - -} diff --git a/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScriptTokenManager.java b/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScriptTokenManager.java deleted file mode 100644 index d513e71de..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScriptTokenManager.java +++ /dev/null @@ -1,5072 +0,0 @@ -/* LARAEcmaScriptTokenManager.java */ -/* Generated By:JJTree&JavaCC: Do not edit this line. LARAEcmaScriptTokenManager.java */ -package org.dojo.jsl.parser.ast; -import java.io.*; -import java.util.*; -import java.io.File; -import java.io.FileReader; -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import larac.utils.output.ErrorMsg; -import larac.objects.Enums.Types; -import larac.exceptions.ParseExceptionData; -import larac.exceptions.StopParseException; - -/** Token Manager. */ -@SuppressWarnings ("unused") -public class LARAEcmaScriptTokenManager implements LARAEcmaScriptConstants { - public int htmlTokenNestingLevel = 0; - public boolean expectActionScript = false; - - /** Debug output. */ - public java.io.PrintStream debugStream = System.out; - /** Set debug output. */ - public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } -private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1, long active2){ - switch (pos) - { - case 0: - if ((active0 & 0x6000000004000000L) != 0L || (active1 & 0x30000L) != 0L) - { - jjmatchedKind = 153; - return 9; - } - if ((active0 & 0x6000L) != 0L) - return 83; - if ((active1 & 0x2000000L) != 0L) - return 3; - if ((active0 & 0x38040000000000L) != 0L || (active1 & 0x1000L) != 0L) - { - jjmatchedKind = 153; - return 13; - } - if ((active0 & 0x9fc7fbfffbfc0000L) != 0L || (active1 & 0xefffL) != 0L || (active2 & 0x808L) != 0L) - { - jjmatchedKind = 153; - return 119; - } - if ((active1 & 0x1000010000000000L) != 0L) - return 42; - return -1; - case 1: - if ((active0 & 0x30000410400000L) != 0L || (active1 & 0x4000L) != 0L || (active2 & 0x800L) != 0L) - { - if (jjmatchedPos != 1) - { - jjmatchedKind = 153; - jjmatchedPos = 1; - } - return 65; - } - if ((active0 & 0xfe0ffdfaeb980000L) != 0L || (active1 & 0x1bdffL) != 0L) - { - if (jjmatchedPos != 1) - { - jjmatchedKind = 153; - jjmatchedPos = 1; - } - return 119; - } - if ((active0 & 0x1c0020104240000L) != 0L || (active1 & 0x200L) != 0L || (active2 & 0x8L) != 0L) - return 119; - if ((active1 & 0x20000L) != 0L) - { - if (jjmatchedPos != 1) - { - jjmatchedKind = 153; - jjmatchedPos = 1; - } - return 8; - } - return -1; - case 2: - if ((active1 & 0x400L) != 0L) - { - if (jjmatchedPos != 2) - { - jjmatchedKind = 153; - jjmatchedPos = 2; - } - return 65; - } - if ((active0 & 0x7a37977bcbbc0000L) != 0L || (active1 & 0x1f8ffL) != 0L || (active2 & 0x808L) != 0L) - { - if (jjmatchedPos != 2) - { - jjmatchedKind = 153; - jjmatchedPos = 2; - } - return 119; - } - if ((active0 & 0x8408688430400000L) != 0L || (active1 & 0x20100L) != 0L) - return 119; - return -1; - case 3: - if ((active0 & 0x50339759c3dc0000L) != 0L || (active1 & 0x1f972L) != 0L || (active2 & 0x8L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 3; - return 119; - } - if ((active0 & 0x2204000208000000L) != 0L || (active1 & 0x40dL) != 0L || (active2 & 0x800L) != 0L) - return 119; - if ((active0 & 0x800002000200000L) != 0L || (active1 & 0x80L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 3; - return 65; - } - return -1; - case 4: - if ((active0 & 0x4833166941980000L) != 0L || (active1 & 0xb880L) != 0L || (active2 & 0x8L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 4; - return 119; - } - if ((active0 & 0x440000L) != 0L || (active1 & 0x100L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 4; - return 65; - } - if ((active0 & 0x1000811082200000L) != 0L || (active1 & 0x14072L) != 0L) - return 119; - return -1; - case 5: - if ((active0 & 0x31164040180000L) != 0L || (active1 & 0x1980L) != 0L || (active2 & 0x8L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 5; - return 119; - } - if ((active0 & 0x4802002901c00000L) != 0L || (active1 & 0xa000L) != 0L) - return 119; - if ((active0 & 0x40000L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 5; - return 66; - } - return -1; - case 6: - if ((active0 & 0x1000000000000L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 6; - return 65; - } - if ((active0 & 0x30060040080000L) != 0L || (active1 & 0x80L) != 0L || (active2 & 0x8L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 6; - return 119; - } - if ((active0 & 0x40000L) != 0L) - return 67; - if ((active0 & 0x104000100000L) != 0L || (active1 & 0x1900L) != 0L) - return 119; - return -1; - case 7: - if ((active0 & 0x1000000000000L) != 0L) - return 66; - if ((active0 & 0x20040080000L) != 0L || (active2 & 0x8L) != 0L) - { - if (jjmatchedPos != 7) - { - jjmatchedKind = 153; - jjmatchedPos = 7; - } - return 119; - } - if ((active0 & 0x30040000000000L) != 0L || (active1 & 0x80L) != 0L) - return 119; - return -1; - case 8: - if ((active0 & 0x20000000000L) != 0L || (active2 & 0x8L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 8; - return 119; - } - if ((active0 & 0x40080000L) != 0L) - return 119; - return -1; - default : - return -1; - } -} -private final int jjStartNfa_0(int pos, long active0, long active1, long active2){ - return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1, active2), pos + 1); -} -private int jjStopAtPos(int pos, int kind) -{ - jjmatchedKind = kind; - jjmatchedPos = pos; - return pos + 1; -} -private int jjMoveStringLiteralDfa0_0(){ - switch(curChar) - { - case 33: - jjmatchedKind = 113; - return jjMoveStringLiteralDfa1_0(0x0L, 0x1200000000L, 0x0L); - case 37: - jjmatchedKind = 104; - return jjMoveStringLiteralDfa1_0(0x0L, 0x1000000000000000L, 0x0L); - case 38: - jjmatchedKind = 110; - return jjMoveStringLiteralDfa1_0(0x0L, 0x8000000000000L, 0x1L); - case 40: - return jjStopAtPos(0, 85); - case 41: - return jjStopAtPos(0, 86); - case 42: - jjmatchedKind = 103; - return jjMoveStringLiteralDfa1_0(0x0L, 0x800000000000000L, 0x0L); - case 43: - jjmatchedKind = 101; - return jjMoveStringLiteralDfa1_0(0x0L, 0x200020000000000L, 0x0L); - case 44: - return jjStopAtPos(0, 91); - case 45: - jjmatchedKind = 102; - return jjMoveStringLiteralDfa1_0(0x0L, 0x400040000000000L, 0x0L); - case 46: - return jjStartNfaWithStates_0(0, 89, 3); - case 47: - return jjMoveStringLiteralDfa1_0(0x6000L, 0x0L, 0x0L); - case 58: - jjmatchedKind = 119; - return jjMoveStringLiteralDfa1_0(0x0L, 0x40000000000000L, 0x0L); - case 59: - return jjStopAtPos(0, 90); - case 60: - jjmatchedKind = 92; - return jjMoveStringLiteralDfa1_0(0x0L, 0x2000080040000000L, 0x0L); - case 61: - jjmatchedKind = 120; - return jjMoveStringLiteralDfa1_0(0x0L, 0x900040000L, 0x0L); - case 62: - jjmatchedKind = 93; - return jjMoveStringLiteralDfa1_0(0x0L, 0xc000300080000000L, 0x0L); - case 63: - return jjStopAtPos(0, 117); - case 91: - return jjStopAtPos(0, 87); - case 93: - return jjStopAtPos(0, 88); - case 94: - jjmatchedKind = 112; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x4L); - case 97: - return jjMoveStringLiteralDfa1_0(0x3002080000L, 0x0L, 0x0L); - case 98: - return jjMoveStringLiteralDfa1_0(0x800880000000L, 0x0L, 0x0L); - case 99: - return jjMoveStringLiteralDfa1_0(0x1010068100000L, 0x78L, 0x0L); - case 100: - return jjMoveStringLiteralDfa1_0(0x2108000000000L, 0x380L, 0x0L); - case 101: - return jjMoveStringLiteralDfa1_0(0x204080200000000L, 0xc00L, 0x0L); - case 102: - return jjMoveStringLiteralDfa1_0(0x38040000000000L, 0x1000L, 0x0L); - case 105: - return jjMoveStringLiteralDfa1_0(0xc0020100240000L, 0x2000L, 0x8L); - case 110: - return jjMoveStringLiteralDfa1_0(0x400000000000000L, 0x0L, 0x800L); - case 111: - return jjMoveStringLiteralDfa1_0(0x100000400400000L, 0x0L, 0x0L); - case 112: - return jjMoveStringLiteralDfa1_0(0x400000000000L, 0x0L, 0x0L); - case 114: - return jjMoveStringLiteralDfa1_0(0x800004010000000L, 0x0L, 0x0L); - case 115: - return jjMoveStringLiteralDfa1_0(0x200001800000L, 0xc000L, 0x0L); - case 116: - return jjMoveStringLiteralDfa1_0(0x6000000004000000L, 0x30000L, 0x0L); - case 118: - return jjMoveStringLiteralDfa1_0(0x8000000000000000L, 0x1L, 0x0L); - case 119: - return jjMoveStringLiteralDfa1_0(0x0L, 0x6L, 0x0L); - case 121: - return jjMoveStringLiteralDfa1_0(0x1000000000000000L, 0x0L, 0x0L); - case 123: - return jjStopAtPos(0, 83); - case 124: - jjmatchedKind = 111; - return jjMoveStringLiteralDfa1_0(0x0L, 0x10000000000000L, 0x2L); - case 125: - return jjStopAtPos(0, 84); - case 126: - jjmatchedKind = 114; - return jjMoveStringLiteralDfa1_0(0x0L, 0x400000000L, 0x0L); - default : - return jjMoveNfa_0(0, 0); - } -} -private int jjMoveStringLiteralDfa1_0(long active0, long active1, long active2){ - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(0, active0, active1, active2); - return 1; - } - switch(curChar) - { - case 38: - if ((active1 & 0x8000000000000L) != 0L) - return jjStopAtPos(1, 115); - break; - case 42: - if ((active0 & 0x4000L) != 0L) - return jjStopAtPos(1, 14); - break; - case 43: - if ((active1 & 0x20000000000L) != 0L) - return jjStopAtPos(1, 105); - break; - case 45: - if ((active1 & 0x40000000000L) != 0L) - return jjStopAtPos(1, 106); - break; - case 47: - if ((active0 & 0x2000L) != 0L) - return jjStopAtPos(1, 13); - break; - case 58: - if ((active1 & 0x40000000000000L) != 0L) - return jjStopAtPos(1, 118); - break; - case 60: - if ((active1 & 0x80000000000L) != 0L) - { - jjmatchedKind = 107; - jjmatchedPos = 1; - } - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x2000000000000000L, active2, 0L); - case 61: - if ((active1 & 0x40000000L) != 0L) - return jjStopAtPos(1, 94); - else if ((active1 & 0x80000000L) != 0L) - return jjStopAtPos(1, 95); - else if ((active1 & 0x100000000L) != 0L) - { - jjmatchedKind = 96; - jjmatchedPos = 1; - } - else if ((active1 & 0x200000000L) != 0L) - { - jjmatchedKind = 97; - jjmatchedPos = 1; - } - else if ((active1 & 0x400000000L) != 0L) - return jjStopAtPos(1, 98); - else if ((active1 & 0x200000000000000L) != 0L) - return jjStopAtPos(1, 121); - else if ((active1 & 0x400000000000000L) != 0L) - return jjStopAtPos(1, 122); - else if ((active1 & 0x800000000000000L) != 0L) - return jjStopAtPos(1, 123); - else if ((active1 & 0x1000000000000000L) != 0L) - return jjStopAtPos(1, 124); - else if ((active2 & 0x1L) != 0L) - return jjStopAtPos(1, 128); - else if ((active2 & 0x2L) != 0L) - return jjStopAtPos(1, 129); - else if ((active2 & 0x4L) != 0L) - return jjStopAtPos(1, 130); - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x1800000000L, active2, 0L); - case 62: - if ((active1 & 0x40000L) != 0L) - return jjStopAtPos(1, 82); - else if ((active1 & 0x100000000000L) != 0L) - { - jjmatchedKind = 108; - jjmatchedPos = 1; - } - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0xc000200000000000L, active2, 0L); - case 97: - return jjMoveStringLiteralDfa2_0(active0, 0x8200400008000000L, active1, 0x18L, active2, 0L); - case 101: - return jjMoveStringLiteralDfa2_0(active0, 0xc0220c881000000L, active1, 0x180L, active2, 0L); - case 102: - if ((active0 & 0x40000000000000L) != 0L) - return jjStartNfaWithStates_0(1, 54, 119); - else if ((active0 & 0x100000000000000L) != 0L) - return jjStartNfaWithStates_0(1, 56, 119); - return jjMoveStringLiteralDfa2_0(active0, 0x1000000000L, active1, 0L, active2, 0L); - case 104: - return jjMoveStringLiteralDfa2_0(active0, 0x2000010000000000L, active1, 0x10002L, active2, 0L); - case 105: - return jjMoveStringLiteralDfa2_0(active0, 0x1000040000000000L, active1, 0x1004L, active2, 0L); - case 108: - return jjMoveStringLiteralDfa2_0(active0, 0x4000000000000L, active1, 0x20L, active2, 0L); - case 109: - return jjMoveStringLiteralDfa2_0(active0, 0x20000000L, active1, 0x2000L, active2, 0L); - case 110: - if ((active0 & 0x80000000000000L) != 0L) - { - jjmatchedKind = 55; - jjmatchedPos = 1; - } - return jjMoveStringLiteralDfa2_0(active0, 0xa0100240000L, active1, 0x400L, active2, 0x8L); - case 111: - if ((active0 & 0x4000000L) != 0L) - return jjStartNfaWithStates_0(1, 26, 119); - else if ((active1 & 0x200L) != 0L) - return jjStartNfaWithStates_0(1, 73, 119); - return jjMoveStringLiteralDfa2_0(active0, 0x9000040100000L, active1, 0x41L, active2, 0L); - case 112: - return jjMoveStringLiteralDfa2_0(active0, 0x2000000L, active1, 0L, active2, 0L); - case 114: - return jjMoveStringLiteralDfa2_0(active0, 0x802000000000L, active1, 0x20000L, active2, 0L); - case 115: - return jjMoveStringLiteralDfa2_0(active0, 0x80000L, active1, 0L, active2, 0L); - case 116: - return jjMoveStringLiteralDfa2_0(active0, 0x800000L, active1, 0L, active2, 0L); - case 117: - return jjMoveStringLiteralDfa2_0(active0, 0x30000410400000L, active1, 0x4000L, active2, 0x800L); - case 119: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x8000L, active2, 0L); - case 120: - return jjMoveStringLiteralDfa2_0(active0, 0x200000000L, active1, 0x800L, active2, 0L); - case 121: - return jjMoveStringLiteralDfa2_0(active0, 0x4000100000000000L, active1, 0L, active2, 0L); - case 124: - if ((active1 & 0x10000000000000L) != 0L) - return jjStopAtPos(1, 116); - break; - default : - break; - } - return jjStartNfa_0(0, active0, active1, active2); -} -private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1, long old2, long active2){ - if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) - return jjStartNfa_0(0, old0, old1, old2); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(1, active0, active1, active2); - return 2; - } - switch(curChar) - { - case 61: - if ((active1 & 0x800000000L) != 0L) - return jjStopAtPos(2, 99); - else if ((active1 & 0x1000000000L) != 0L) - return jjStopAtPos(2, 100); - else if ((active1 & 0x2000000000000000L) != 0L) - return jjStopAtPos(2, 125); - else if ((active1 & 0x4000000000000000L) != 0L) - return jjStopAtPos(2, 126); - break; - case 62: - if ((active1 & 0x200000000000L) != 0L) - { - jjmatchedKind = 109; - jjmatchedPos = 2; - } - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x8000000000000000L, active2, 0L); - case 97: - return jjMoveStringLiteralDfa3_0(active0, 0x800000L, active1, 0x20L, active2, 0L); - case 98: - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x80L, active2, 0L); - case 99: - return jjMoveStringLiteralDfa3_0(active0, 0x200000000040000L, active1, 0L, active2, 0L); - case 100: - if ((active0 & 0x20000000L) != 0L) - return jjStartNfaWithStates_0(2, 29, 119); - else if ((active0 & 0x80000000000L) != 0L) - return jjStartNfaWithStates_0(2, 43, 119); - return jjMoveStringLiteralDfa3_0(active0, 0x100000L, active1, 0L, active2, 0L); - case 101: - return jjMoveStringLiteralDfa3_0(active0, 0x1000810200000000L, active1, 0L, active2, 0L); - case 102: - if ((active0 & 0x8000000000L) != 0L) - { - jjmatchedKind = 39; - jjmatchedPos = 2; - } - return jjMoveStringLiteralDfa3_0(active0, 0x800000000L, active1, 0x100L, active2, 0L); - case 103: - return jjMoveStringLiteralDfa3_0(active0, 0x80000000L, active1, 0L, active2, 0L); - case 105: - return jjMoveStringLiteralDfa3_0(active0, 0x2000020000000000L, active1, 0x8003L, active2, 0L); - case 108: - return jjMoveStringLiteralDfa3_0(active0, 0x2000009000000L, active1, 0L, active2, 0x800L); - case 110: - if ((active0 & 0x10000000L) != 0L) - return jjStartNfaWithStates_0(2, 28, 119); - return jjMoveStringLiteralDfa3_0(active0, 0x31140040000000L, active1, 0x1040L, active2, 0L); - case 111: - return jjMoveStringLiteralDfa3_0(active0, 0x2000000000L, active1, 0L, active2, 0L); - case 112: - return jjMoveStringLiteralDfa3_0(active0, 0x4000004002280000L, active1, 0x6000L, active2, 0L); - case 113: - if ((active0 & 0x200000000000L) != 0L) - return jjStartNfaWithStates_0(2, 45, 119); - break; - case 114: - if ((active0 & 0x400000000000L) != 0L) - return jjStartNfaWithStates_0(2, 46, 119); - else if ((active0 & 0x8000000000000L) != 0L) - return jjStartNfaWithStates_0(2, 51, 119); - else if ((active0 & 0x8000000000000000L) != 0L) - return jjStartNfaWithStates_0(2, 63, 119); - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x10000L, active2, 0L); - case 115: - return jjMoveStringLiteralDfa3_0(active0, 0x4000100000000L, active1, 0x8L, active2, 0x8L); - case 116: - if ((active0 & 0x400000000L) != 0L) - { - jjmatchedKind = 34; - jjmatchedPos = 2; - } - return jjMoveStringLiteralDfa3_0(active0, 0x800001000400000L, active1, 0x814L, active2, 0L); - case 117: - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x400L, active2, 0L); - case 119: - if ((active0 & 0x400000000000000L) != 0L) - return jjStartNfaWithStates_0(2, 58, 119); - break; - case 121: - if ((active1 & 0x20000L) != 0L) - return jjStartNfaWithStates_0(2, 81, 119); - break; - default : - break; - } - return jjStartNfa_0(1, active0, active1, active2); -} -private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1, long old2, long active2){ - if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) - return jjStartNfa_0(1, old0, old1, old2); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(2, active0, active1, active2); - return 3; - } - switch(curChar) - { - case 61: - if ((active1 & 0x8000000000000000L) != 0L) - return jjStopAtPos(3, 127); - break; - case 97: - return jjMoveStringLiteralDfa4_0(active0, 0x940000000000L, active1, 0x1100L, active2, 0L); - case 99: - if ((active0 & 0x200000000L) != 0L) - return jjStartNfaWithStates_0(3, 33, 119); - return jjMoveStringLiteralDfa4_0(active0, 0x30010000000000L, active1, 0x10L, active2, 0L); - case 100: - if ((active1 & 0x1L) != 0L) - return jjStartNfaWithStates_0(3, 64, 119); - return jjMoveStringLiteralDfa4_0(active0, 0x40000000L, active1, 0L, active2, 0L); - case 101: - if ((active0 & 0x4000000000000L) != 0L) - return jjStartNfaWithStates_0(3, 50, 119); - else if ((active1 & 0x8L) != 0L) - return jjStartNfaWithStates_0(3, 67, 119); - return jjMoveStringLiteralDfa4_0(active0, 0x4002001101180000L, active1, 0x4800L, active2, 0L); - case 104: - if ((active0 & 0x200000000000000L) != 0L) - return jjStartNfaWithStates_0(3, 57, 119); - else if ((active1 & 0x4L) != 0L) - return jjStartNfaWithStates_0(3, 66, 119); - break; - case 105: - return jjMoveStringLiteralDfa4_0(active0, 0x80000000L, active1, 0L, active2, 0L); - case 108: - if ((active0 & 0x8000000L) != 0L) - return jjStartNfaWithStates_0(3, 27, 119); - else if ((active2 & 0x800L) != 0L) - return jjStartNfaWithStates_0(3, 139, 119); - return jjMoveStringLiteralDfa4_0(active0, 0x1000004002040000L, active1, 0x2L, active2, 0L); - case 109: - if ((active1 & 0x400L) != 0L) - return jjStartNfaWithStates_0(3, 74, 119); - break; - case 111: - return jjMoveStringLiteralDfa4_0(active0, 0x800000000L, active1, 0x12000L, active2, 0L); - case 112: - return jjMoveStringLiteralDfa4_0(active0, 0x400000L, active1, 0L, active2, 0L); - case 115: - if ((active0 & 0x2000000000000000L) != 0L) - return jjStartNfaWithStates_0(3, 61, 119); - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x60L, active2, 0L); - case 116: - return jjMoveStringLiteralDfa4_0(active0, 0x1020000800000L, active1, 0x8000L, active2, 0x8L); - case 117: - return jjMoveStringLiteralDfa4_0(active0, 0x800002000200000L, active1, 0x80L, active2, 0L); - default : - break; - } - return jjStartNfa_0(2, active0, active1, active2); -} -private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1, long old2, long active2){ - if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) - return jjStartNfa_0(2, old0, old1, old2); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(3, active0, active1, active2); - return 4; - } - switch(curChar) - { - case 97: - return jjMoveStringLiteralDfa5_0(active0, 0x4000000000L, active1, 0L, active2, 0x8L); - case 99: - return jjMoveStringLiteralDfa5_0(active0, 0x1080000L, active1, 0x8000L, active2, 0L); - case 100: - if ((active0 & 0x1000000000000000L) != 0L) - return jjStartNfaWithStates_0(4, 60, 119); - return jjMoveStringLiteralDfa5_0(active0, 0x100000L, active1, 0L, active2, 0L); - case 101: - if ((active1 & 0x2L) != 0L) - return jjStartNfaWithStates_0(4, 65, 119); - break; - case 103: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x80L, active2, 0L); - case 104: - if ((active1 & 0x10L) != 0L) - return jjStartNfaWithStates_0(4, 68, 119); - break; - case 105: - return jjMoveStringLiteralDfa5_0(active0, 0x1020040800000L, active1, 0L, active2, 0L); - case 107: - if ((active0 & 0x10000000000L) != 0L) - return jjStartNfaWithStates_0(4, 40, 119); - else if ((active0 & 0x800000000000L) != 0L) - return jjStartNfaWithStates_0(4, 47, 119); - break; - case 108: - return jjMoveStringLiteralDfa5_0(active0, 0x40000000000L, active1, 0x1000L, active2, 0L); - case 109: - return jjMoveStringLiteralDfa5_0(active0, 0x100000000000L, active1, 0L, active2, 0L); - case 110: - if ((active0 & 0x80000000L) != 0L) - return jjStartNfaWithStates_0(4, 31, 119); - return jjMoveStringLiteralDfa5_0(active0, 0x2000000000L, active1, 0x800L, active2, 0L); - case 111: - return jjMoveStringLiteralDfa5_0(active0, 0x4000000000000000L, active1, 0L, active2, 0L); - case 114: - if ((active0 & 0x1000000000L) != 0L) - return jjStartNfaWithStates_0(4, 36, 119); - else if ((active1 & 0x4000L) != 0L) - return jjStartNfaWithStates_0(4, 78, 119); - return jjMoveStringLiteralDfa5_0(active0, 0x800000900000000L, active1, 0x2000L, active2, 0L); - case 115: - if ((active1 & 0x20L) != 0L) - return jjStartNfaWithStates_0(4, 69, 119); - break; - case 116: - if ((active0 & 0x200000L) != 0L) - return jjStartNfaWithStates_0(4, 21, 119); - else if ((active1 & 0x40L) != 0L) - return jjStartNfaWithStates_0(4, 70, 119); - return jjMoveStringLiteralDfa5_0(active0, 0x32000000000000L, active1, 0L, active2, 0L); - case 117: - return jjMoveStringLiteralDfa5_0(active0, 0x440000L, active1, 0x100L, active2, 0L); - case 119: - if ((active1 & 0x10000L) != 0L) - return jjStartNfaWithStates_0(4, 80, 119); - break; - case 121: - if ((active0 & 0x2000000L) != 0L) - return jjStartNfaWithStates_0(4, 25, 119); - break; - default : - break; - } - return jjStartNfa_0(3, active0, active1, active2); -} -private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long active1, long old2, long active2){ - if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) - return jjStartNfa_0(3, old0, old1, old2); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(4, active0, active1, active2); - return 5; - } - switch(curChar) - { - case 97: - return jjMoveStringLiteralDfa6_0(active0, 0x20000000000L, active1, 0L, active2, 0L); - case 99: - if ((active0 & 0x800000L) != 0L) - return jjStartNfaWithStates_0(5, 23, 119); - return jjMoveStringLiteralDfa6_0(active0, 0x4000000000L, active1, 0L, active2, 0L); - case 100: - if ((active0 & 0x2000000000L) != 0L) - return jjStartNfaWithStates_0(5, 37, 119); - return jjMoveStringLiteralDfa6_0(active0, 0x40000L, active1, 0x800L, active2, 0L); - case 101: - if ((active0 & 0x800000000L) != 0L) - return jjStartNfaWithStates_0(5, 35, 119); - else if ((active0 & 0x2000000000000L) != 0L) - return jjStartNfaWithStates_0(5, 49, 119); - return jjMoveStringLiteralDfa6_0(active0, 0x100000L, active1, 0L, active2, 0L); - case 102: - if ((active0 & 0x4000000000000000L) != 0L) - return jjStartNfaWithStates_0(5, 62, 119); - break; - case 103: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x80L, active2, 0L); - case 104: - if ((active1 & 0x8000L) != 0L) - return jjStartNfaWithStates_0(5, 79, 119); - break; - case 105: - return jjMoveStringLiteralDfa6_0(active0, 0x30140000000000L, active1, 0L, active2, 0L); - case 108: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x1100L, active2, 0L); - case 110: - if ((active0 & 0x800000000000000L) != 0L) - return jjStartNfaWithStates_0(5, 59, 119); - return jjMoveStringLiteralDfa6_0(active0, 0x1000000000000L, active1, 0L, active2, 0x8L); - case 116: - if ((active0 & 0x400000L) != 0L) - return jjStartNfaWithStates_0(5, 22, 119); - else if ((active0 & 0x1000000L) != 0L) - return jjStartNfaWithStates_0(5, 24, 119); - else if ((active0 & 0x100000000L) != 0L) - return jjStartNfaWithStates_0(5, 32, 119); - else if ((active1 & 0x2000L) != 0L) - return jjStartNfaWithStates_0(5, 77, 119); - return jjMoveStringLiteralDfa6_0(active0, 0x40080000L, active1, 0L, active2, 0L); - default : - break; - } - return jjStartNfa_0(4, active0, active1, active2); -} -private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long active1, long old2, long active2){ - if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) - return jjStartNfa_0(4, old0, old1, old2); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(5, active0, active1, active2); - return 6; - } - switch(curChar) - { - case 99: - if ((active0 & 0x100000000000L) != 0L) - return jjStartNfaWithStates_0(6, 44, 119); - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0L, active2, 0x8L); - case 100: - return jjMoveStringLiteralDfa7_0(active0, 0x80000L, active1, 0L, active2, 0L); - case 101: - if ((active0 & 0x40000L) != 0L) - return jjStartNfaWithStates_0(6, 18, 67); - else if ((active0 & 0x4000000000L) != 0L) - return jjStartNfaWithStates_0(6, 38, 119); - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x80L, active2, 0L); - case 102: - if ((active0 & 0x100000L) != 0L) - return jjStartNfaWithStates_0(6, 20, 119); - break; - case 105: - return jjMoveStringLiteralDfa7_0(active0, 0x40000000L, active1, 0L, active2, 0L); - case 108: - return jjMoveStringLiteralDfa7_0(active0, 0x20000000000L, active1, 0L, active2, 0L); - case 111: - return jjMoveStringLiteralDfa7_0(active0, 0x30000000000000L, active1, 0L, active2, 0L); - case 115: - if ((active1 & 0x800L) != 0L) - return jjStartNfaWithStates_0(6, 75, 119); - break; - case 116: - if ((active1 & 0x100L) != 0L) - return jjStartNfaWithStates_0(6, 72, 119); - break; - case 117: - return jjMoveStringLiteralDfa7_0(active0, 0x1000000000000L, active1, 0L, active2, 0L); - case 121: - if ((active1 & 0x1000L) != 0L) - return jjStartNfaWithStates_0(6, 76, 119); - break; - case 122: - return jjMoveStringLiteralDfa7_0(active0, 0x40000000000L, active1, 0L, active2, 0L); - default : - break; - } - return jjStartNfa_0(5, active0, active1, active2); -} -private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long active1, long old2, long active2){ - if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) - return jjStartNfa_0(5, old0, old1, old2); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(6, active0, active1, active2); - return 7; - } - switch(curChar) - { - case 101: - if ((active0 & 0x40000000000L) != 0L) - return jjStartNfaWithStates_0(7, 42, 119); - else if ((active0 & 0x1000000000000L) != 0L) - return jjStartNfaWithStates_0(7, 48, 66); - return jjMoveStringLiteralDfa8_0(active0, 0x80000L, active1, 0L, active2, 0x8L); - case 105: - return jjMoveStringLiteralDfa8_0(active0, 0x20000000000L, active1, 0L, active2, 0L); - case 110: - if ((active0 & 0x10000000000000L) != 0L) - { - jjmatchedKind = 52; - jjmatchedPos = 7; - } - return jjMoveStringLiteralDfa8_0(active0, 0x20000000000000L, active1, 0L, active2, 0L); - case 111: - return jjMoveStringLiteralDfa8_0(active0, 0x40000000L, active1, 0L, active2, 0L); - case 114: - if ((active1 & 0x80L) != 0L) - return jjStartNfaWithStates_0(7, 71, 119); - break; - default : - break; - } - return jjStartNfa_0(6, active0, active1, active2); -} -private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long active1, long old2, long active2){ - if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) - return jjStartNfa_0(6, old0, old1, old2); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(7, active0, 0L, active2); - return 8; - } - switch(curChar) - { - case 42: - if ((active0 & 0x20000000000000L) != 0L) - return jjStopAtPos(8, 53); - break; - case 102: - if ((active0 & 0x80000L) != 0L) - return jjStartNfaWithStates_0(8, 19, 119); - break; - case 110: - if ((active0 & 0x40000000L) != 0L) - return jjStartNfaWithStates_0(8, 30, 119); - break; - case 111: - return jjMoveStringLiteralDfa9_0(active0, 0L, active2, 0x8L); - case 122: - return jjMoveStringLiteralDfa9_0(active0, 0x20000000000L, active2, 0L); - default : - break; - } - return jjStartNfa_0(7, active0, 0L, active2); -} -private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old2, long active2){ - if (((active0 &= old0) | (active2 &= old2)) == 0L) - return jjStartNfa_0(7, old0, 0L, old2); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(8, active0, 0L, active2); - return 9; - } - switch(curChar) - { - case 101: - if ((active0 & 0x20000000000L) != 0L) - return jjStartNfaWithStates_0(9, 41, 119); - break; - case 102: - if ((active2 & 0x8L) != 0L) - return jjStartNfaWithStates_0(9, 131, 119); - break; - default : - break; - } - return jjStartNfa_0(8, active0, 0L, active2); -} -private int jjStartNfaWithStates_0(int pos, int kind, int state) -{ - jjmatchedKind = kind; - jjmatchedPos = pos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return pos + 1; } - return jjMoveNfa_0(state, pos + 1); -} -static final long[] jjbitVec0 = { - 0x0L, 0x0L, 0x100000000L, 0x0L -}; -static final long[] jjbitVec1 = { - 0x30000000000L, 0x0L, 0x0L, 0x0L -}; -static final long[] jjbitVec2 = { - 0xfffffffefffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL -}; -static final long[] jjbitVec4 = { - 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL -}; -static final long[] jjbitVec5 = { - 0xfffffcffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL -}; -static final long[] jjbitVec6 = { - 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL -}; -static final long[] jjbitVec7 = { - 0x200002L, 0x0L, 0xf00000000L, 0x1200000000000000L -}; -static final long[] jjbitVec8 = { - 0x10000000000000L, 0x4000L, 0x100000000000L, 0x0L -}; -static final long[] jjbitVec9 = { - 0x1L, 0x0L, 0x0L, 0x0L -}; -static final long[] jjbitVec10 = { - 0x0L, 0x0L, 0x420040000000000L, 0xff7fffffff7fffffL -}; -static final long[] jjbitVec11 = { - 0xffffcffffffffL, 0xffffffffffff0000L, 0xf9ff3fffffffffffL, 0x401f00030003L -}; -static final long[] jjbitVec12 = { - 0xffffffffffffffffL, 0x400000700007fffL, 0xfffffffbffffd740L, 0xffffffcff7fffL -}; -static final long[] jjbitVec13 = { - 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffffff07bL, 0x33fffffffff199fL -}; -static final long[] jjbitVec14 = { - 0xfffe000000000000L, 0xfffffffe027fffffL, 0xbbfffffbfffe00ffL, 0x707ffffff0016L -}; -static final long[] jjbitVec15 = { - 0x7fffffe00000000L, 0xffff03ff003fffffL, 0xffffffffffffffffL, 0x1fff3dff9fefffffL -}; -static final long[] jjbitVec16 = { - 0xffff1fffffff0000L, 0x7ffL, 0x1ffffffffffffL, 0x0L -}; -static final long[] jjbitVec17 = { - 0xf3ffffffffffffeeL, 0xffcfff1f3fffL, 0xf3c5fdfffff99feeL, 0x3ffcfb080399fL -}; -static final long[] jjbitVec18 = { - 0xd36dfdfffff987ecL, 0x1fffc05e003987L, 0xf3edfdfffffbafeeL, 0xffc100013bbfL -}; -static final long[] jjbitVec19 = { - 0xf3cdfdfffff99feeL, 0xffc3b0c0398fL, 0xc3bfc718d63dc7ecL, 0xff8000803dc7L -}; -static final long[] jjbitVec20 = { - 0xc3effdfffffddfeeL, 0xffc300603ddfL, 0xc3effdfffffddfecL, 0xffc340603ddfL -}; -static final long[] jjbitVec21 = { - 0xc3fffdfffffddfecL, 0xffc300803dcfL, 0x2ffbfffffc7fffecL, 0xc0000ff5f847fL -}; -static final long[] jjbitVec22 = { - 0x7fffffffffffffeL, 0x3ff7fffL, 0xfbffecaefef02596L, 0x33ff3f5fL -}; -static final long[] jjbitVec23 = { - 0xc2a003ff03000001L, 0xfffe07ffffffffffL, 0x1ffffffffeff0fdfL, 0x40L -}; -static final long[] jjbitVec24 = { - 0x3c7f6fbffffffffL, 0x3ff03ffL, 0xffffffff00000000L, 0x7fffffffff003fL -}; -static final long[] jjbitVec25 = { - 0xffffffffffffffffL, 0xffffffff83ffffffL, 0xffffff07ffffffffL, 0x3ffffffffffffffL -}; -static final long[] jjbitVec26 = { - 0xffffffffffffff7fL, 0xffffffff3d7f3d7fL, 0x7f3d7fffffff3d7fL, 0xffff7fffff7f7f3dL -}; -static final long[] jjbitVec27 = { - 0xffffffff7f3d7fffL, 0x3fe0007ffff7fL, 0xffffffff00000000L, 0x1fffffffffffffL -}; -static final long[] jjbitVec28 = { - 0xffffffffffffffffL, 0x7fffffffffffffL, 0xffffffff07fffffeL, 0x7ffffffffffL -}; -static final long[] jjbitVec29 = { - 0x0L, 0x0L, 0xffffffffffffffffL, 0x3ff000fffffL -}; -static final long[] jjbitVec30 = { - 0xffffffff03ff0000L, 0xffffffffffffffL, 0x3ffffffffffL, 0x0L -}; -static final long[] jjbitVec31 = { - 0x1fb0e7800000000L, 0x0L, 0xffff000000000000L, 0x301L -}; -static final long[] jjbitVec32 = { - 0xe000000L, 0x0L, 0x0L, 0x0L -}; -static final long[] jjbitVec33 = { - 0xc00000L, 0x0L, 0x0L, 0x0L -}; -static final long[] jjbitVec34 = { - 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffff0fffffffL, 0x3ffffffffffffffL -}; -static final long[] jjbitVec35 = { - 0xffffffff3f3fffffL, 0x3fffffffaaff3f3fL, 0x5fdfffffffffffffL, 0x1fdc1fff0fcf1fdcL -}; -static final long[] jjbitVec36 = { - 0x8000000000000000L, 0x8000000000000001L, 0x0L, 0x21fff0000L -}; -static final long[] jjbitVec37 = { - 0x3fbbd503e2ffc84L, 0xffffffff00000000L, 0xfL, 0x0L -}; -static final long[] jjbitVec38 = { - 0x73efffe000000e0L, 0xfffffffffffffffeL, 0xfffffffe661fffffL, 0x7fffffffffffffffL -}; -static final long[] jjbitVec39 = { - 0xfffe1fffffffffe0L, 0xffffffffffffffffL, 0xffffff00007fffL, 0x0L -}; -static final long[] jjbitVec40 = { - 0x0L, 0x0L, 0x20000000000000L, 0x0L -}; -static final long[] jjbitVec41 = { - 0x0L, 0x0L, 0x2000000000L, 0x0L -}; -static final long[] jjbitVec42 = { - 0xffffffffffffffffL, 0xffffffffffffffffL, 0x1fffL, 0x0L -}; -static final long[] jjbitVec43 = { - 0x9800000004L, 0x0L, 0x0L, 0x0L -}; -static final long[] jjbitVec44 = { - 0x0L, 0x0L, 0x800000000L, 0x0L -}; -static final long[] jjbitVec45 = { - 0x3fffffffffffL, 0x0L, 0x0L, 0x0L -}; -static final long[] jjbitVec46 = { - 0x5f7ffdffe0f8007fL, 0xffffffffffffffdbL, 0x3ffffffffffffL, 0xfffffffffff80000L -}; -static final long[] jjbitVec47 = { - 0x3fffffffffffffffL, 0xffffffffffff0000L, 0xfffffffffffcffffL, 0xfff0000000000ffL -}; -static final long[] jjbitVec48 = { - 0x18000f00000000L, 0xffd700000000e000L, 0xffffffffffffffffL, 0x1fffffffffffffffL -}; -static final long[] jjbitVec49 = { - 0x87fffffe03ff0000L, 0xffffffe007fffffeL, 0x7fffffffffffffffL, 0x1cfcfcfcL -}; -static final long[] jjbitVec50 = { - 0x0L, 0x400000000000000L, 0xfffffffbffffd740L, 0xffffffcff7fffL -}; -static final long[] jjbitVec51 = { - 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffffff003L, 0x33fffffffff199fL -}; -static final long[] jjbitVec52 = { - 0xfffe000000000000L, 0xfffffffe027fffffL, 0xffL, 0x707ffffff0000L -}; -static final long[] jjbitVec53 = { - 0x7fffffe00000000L, 0xfffe0000000007ffL, 0xffffffffffffffffL, 0x1c000060002fffffL -}; -static final long[] jjbitVec54 = { - 0x1ffffffd0000L, 0x0L, 0x3fffffffffL, 0x0L -}; -static final long[] jjbitVec55 = { - 0x23ffffffffffffe0L, 0x3ff010000L, 0x3c5fdfffff99fe0L, 0x30003b0000000L -}; -static final long[] jjbitVec56 = { - 0x36dfdfffff987e0L, 0x1c00005e000000L, 0x23edfdfffffbafe0L, 0x100010000L -}; -static final long[] jjbitVec57 = { - 0x23cdfdfffff99fe0L, 0x3b0000000L, 0x3bfc718d63dc7e0L, 0x0L -}; -static final long[] jjbitVec58 = { - 0x3effdfffffddfe0L, 0x300000000L, 0x3effdfffffddfe0L, 0x340000000L -}; -static final long[] jjbitVec59 = { - 0x3fffdfffffddfe0L, 0x300000000L, 0x2ffbfffffc7fffe0L, 0x7fL -}; -static final long[] jjbitVec60 = { - 0xdfffffffffffeL, 0x7fL, 0xe00decaefef02596L, 0x3000005fL -}; -static final long[] jjbitVec61 = { - 0x1L, 0x7ffffffffffL, 0xf00L, 0x0L -}; -static final long[] jjbitVec62 = { - 0x6fbffffffffL, 0x3f0000L, 0xffffffff00000000L, 0x7fffffffff003fL -}; -static final long[] jjbitVec63 = { - 0xffffffff7f3d7fffL, 0x7ffff7fL, 0xffffffff00000000L, 0x1fffffffffffffL -}; -static final long[] jjbitVec64 = { - 0x0L, 0x0L, 0xfffffffffffffL, 0x0L -}; -static final long[] jjbitVec65 = { - 0xffffffff00000000L, 0xffffffffffffffL, 0x1ffffffffffL, 0x0L -}; -static final long[] jjbitVec66 = { - 0x0L, 0x8000000000000000L, 0x0L, 0x0L -}; -static final long[] jjbitVec67 = { - 0x73e03fe000000e0L, 0xfffffffffffffffeL, 0xfffffffe601fffffL, 0x77ffffffffffffffL -}; -static final long[] jjbitVec68 = { - 0x5f7ffdffa0f8007fL, 0xffffffffffffffdbL, 0x3ffffffffffffL, 0xfffffffffff80000L -}; -static final long[] jjbitVec69 = { - 0x0L, 0xffd7000000000000L, 0xffffffffffffffffL, 0x1fffffffffffffffL -}; -static final long[] jjbitVec70 = { - 0x7fffffe00000000L, 0xffffffc007fffffeL, 0x7fffffffffffffffL, 0x1cfcfcfcL -}; -static final long[] jjbitVec71 = { - 0xffffffffffffffffL, 0x700007fffL, 0x0L, 0x0L -}; -static final long[] jjbitVec72 = { - 0x0L, 0x0L, 0x78L, 0x0L -}; -static final long[] jjbitVec73 = { - 0x0L, 0x0L, 0xbbfffffbfffe0000L, 0x16L -}; -static final long[] jjbitVec74 = { - 0x0L, 0x10000003ff800L, 0x0L, 0x3d9f9fc00000L -}; -static final long[] jjbitVec75 = { - 0xffff000000020000L, 0x7ffL, 0x1ffc000000000L, 0x0L -}; -static final long[] jjbitVec76 = { - 0xd00000000000000eL, 0xc001e3fffL, 0xf00000000000000eL, 0xc0080399fL -}; -static final long[] jjbitVec77 = { - 0xd00000000000000cL, 0x3000000003987L, 0xd00000000000000eL, 0x3bbfL -}; -static final long[] jjbitVec78 = { - 0xd00000000000000eL, 0xc0398fL, 0xc00000000000000cL, 0x803dc7L -}; -static final long[] jjbitVec79 = { - 0xc00000000000000eL, 0x603ddfL, 0xc00000000000000cL, 0x603ddfL -}; -static final long[] jjbitVec80 = { - 0xc00000000000000cL, 0x803dcfL, 0xcL, 0xc0000ff5f8400L -}; -static final long[] jjbitVec81 = { - 0x7f2000000000000L, 0x7f80L, 0x1bf2000000000000L, 0x3f00L -}; -static final long[] jjbitVec82 = { - 0xc2a0000003000000L, 0xfffe000000000000L, 0x1ffffffffeff00dfL, 0x40L -}; -static final long[] jjbitVec83 = { - 0x3c7f00000000000L, 0x3c00000L, 0x0L, 0x0L -}; -static final long[] jjbitVec84 = { - 0x0L, 0x0L, 0xfff0000000000000L, 0xfffffL -}; -static final long[] jjbitVec85 = { - 0x0L, 0x0L, 0x20000000000L, 0x0L -}; -static final long[] jjbitVec86 = { - 0x0L, 0x0L, 0x0L, 0x21fff0000L -}; -static final long[] jjbitVec87 = { - 0xfc0000000000L, 0x0L, 0x6000000L, 0x0L -}; -static final long[] jjbitVec88 = { - 0x40000000L, 0x0L, 0x0L, 0x0L -}; -static final long[] jjbitVec89 = { - 0xf00000000L, 0x0L, 0x0L, 0x0L -}; -static final long[] jjbitVec90 = { - 0xc000000000000008L, 0x1e01L, 0xc00000000000000cL, 0x801981L -}; -static final long[] jjbitVec91 = { - 0xc000000000000008L, 0x1L, 0xc000000000000008L, 0x1a01L -}; -static final long[] jjbitVec92 = { - 0x400000000000000cL, 0x801981L, 0xc000000000000000L, 0x801dc6L -}; -static final long[] jjbitVec93 = { - 0xeL, 0x1eL, 0x400000000000000cL, 0x600d9fL -}; -static final long[] jjbitVec94 = { - 0xc00000000000000cL, 0x801dc1L, 0xcL, 0xc0000ff038000L -}; -static final long[] jjbitVec95 = { - 0xc000000000000000L, 0x8000000000000000L, 0x0L, 0x0L -}; -static final long[] jjbitVec96 = { - 0x102100000000000L, 0xc00000L, 0x0L, 0x0L -}; -static final long[] jjbitVec97 = { - 0x0L, 0x0L, 0xc040000000000000L, 0x1bfL -}; -static final long[] jjbitVec98 = { - 0xd000000000000004L, 0x3000000003987L, 0xd00000000000000eL, 0x3bbfL -}; -static final long[] jjbitVec99 = { - 0x1600L, 0x0L, 0x0L, 0x0L -}; -static final long[] jjbitVec100 = { - 0x0L, 0xffc000000000L, 0x0L, 0xffc000000000L -}; -static final long[] jjbitVec101 = { - 0x1000000L, 0x0L, 0x0L, 0x8000000000000000L -}; -static final long[] jjbitVec102 = { - 0x3ff0000L, 0x0L, 0x0L, 0x0L -}; -static final long[] jjbitVec103 = { - 0x0L, 0x3ff00000000L, 0x0L, 0x3ff000000000000L -}; -static final long[] jjbitVec104 = { - 0x0L, 0xffc000000000L, 0x0L, 0xff8000000000L -}; -static final long[] jjbitVec105 = { - 0x0L, 0xffc000000000L, 0x0L, 0x0L -}; -static final long[] jjbitVec106 = { - 0x0L, 0x3ff0000L, 0x0L, 0x3ff0000L -}; -static final long[] jjbitVec107 = { - 0x3ff00000000L, 0x0L, 0x0L, 0x0L -}; -static final long[] jjbitVec108 = { - 0x0L, 0x3ffL, 0x0L, 0x0L -}; -static final long[] jjbitVec109 = { - 0x0L, 0x3fe0000000000L, 0x0L, 0x0L -}; -static final long[] jjbitVec110 = { - 0x0L, 0x0L, 0x0L, 0x3ff00000000L -}; -static final long[] jjbitVec111 = { - 0x8000000000000000L, 0x1L, 0x0L, 0x0L -}; -static final long[] jjbitVec112 = { - 0x0L, 0x0L, 0x0L, 0x800000000000000L -}; -static final long[] jjbitVec113 = { - 0x18000000000000L, 0xe000L, 0x0L, 0x0L -}; -static final long[] jjbitVec114 = { - 0x8000000000000000L, 0x2000000000L, 0x0L, 0x0L -}; -private int jjMoveNfa_0(int startState, int curPos) -{ - int startsAt = 0; - jjnewStateCnt = 119; - int i = 1; - jjstateSet[0] = startState; - int kind = 0x7fffffff; - for (;;) - { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) - { - long l = 1L << curChar; - do - { - switch(jjstateSet[--i]) - { - case 67: - if ((0x3ff001000000000L & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - } - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(68); } - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(68); } - break; - case 83: - if ((0xffff7bffffffdbffL & l) != 0L) - { jjCheckNAddStates(0, 2); } - break; - case 8: - case 63: - if ((0x3ff001000000000L & l) == 0L) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - break; - case 13: - if ((0x3ff001000000000L & l) == 0L) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - break; - case 66: - if ((0x3ff001000000000L & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - } - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 71; - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 67; - break; - case 119: - if ((0x3ff001000000000L & l) == 0L) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - break; - case 0: - if ((0x3ff000000000000L & l) != 0L) - { - if (kind > 137) - kind = 137; - { jjCheckNAdd(113); } - } - else if ((0x100001a00L & l) != 0L) - { - if (kind > 1) - kind = 1; - } - else if ((0x2400L & l) != 0L) - { - if (kind > 8) - kind = 8; - } - else if (curChar == 47) - { jjAddStates(3, 4); } - else if (curChar == 36) - { jjAddStates(5, 6); } - else if (curChar == 35) - { - if (kind > 152) - kind = 152; - { jjCheckNAddTwoStates(50, 51); } - } - else if (curChar == 37) - jjstateSet[jjnewStateCnt++] = 42; - else if (curChar == 39) - { jjCheckNAddStates(7, 9); } - else if (curChar == 34) - { jjCheckNAddStates(10, 12); } - else if (curChar == 46) - { jjCheckNAdd(3); } - if ((0x3ff000000000000L & l) != 0L) - { - if (kind > 166) - kind = 166; - } - else if (curChar == 36) - jjstateSet[jjnewStateCnt++] = 60; - if ((0x3ff000000000000L & l) != 0L) - { - if (kind > 163) - kind = 163; - } - if ((0x3fe000000000000L & l) != 0L) - { - if (kind > 132) - kind = 132; - { jjCheckNAddStates(13, 17); } - } - else if (curChar == 48) - { - if (kind > 132) - kind = 132; - { jjCheckNAddStates(18, 20); } - } - break; - case 9: - if ((0x3ff001000000000L & l) == 0L) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - break; - case 65: - if ((0x3ff001000000000L & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - } - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 70; - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 66; - break; - case 1: - if ((0x2400L & l) != 0L && kind > 8) - kind = 8; - break; - case 2: - if (curChar == 46) - { jjCheckNAdd(3); } - break; - case 3: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 132) - kind = 132; - { jjCheckNAddTwoStates(3, 4); } - break; - case 5: - if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(6); } - break; - case 6: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 132) - kind = 132; - { jjCheckNAdd(6); } - break; - case 15: - if (curChar == 34) - { jjCheckNAddStates(10, 12); } - break; - case 16: - if ((0xfffffffbffffdbffL & l) != 0L) - { jjCheckNAddStates(10, 12); } - break; - case 18: - { jjCheckNAddStates(10, 12); } - break; - case 19: - if (curChar == 34 && kind > 141) - kind = 141; - break; - case 21: - case 26: - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(22); } - break; - case 22: - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(10, 12); } - break; - case 24: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 25; - break; - case 25: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 26; - break; - case 27: - if (curChar == 39) - { jjCheckNAddStates(7, 9); } - break; - case 28: - if ((0xffffff7fffffdbffL & l) != 0L) - { jjCheckNAddStates(7, 9); } - break; - case 30: - { jjCheckNAddStates(7, 9); } - break; - case 31: - if (curChar == 39 && kind > 141) - kind = 141; - break; - case 33: - case 38: - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(34); } - break; - case 34: - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(7, 9); } - break; - case 36: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 37; - break; - case 37: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 38; - break; - case 40: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 41; - break; - case 41: - if ((0x3ff000000000000L & l) != 0L && kind > 150) - kind = 150; - break; - case 43: - { jjCheckNAddTwoStates(43, 44); } - break; - case 45: - if ((0xffffffdfffffffffL & l) != 0L) - { jjCheckNAddTwoStates(46, 44); } - break; - case 46: - { jjCheckNAddTwoStates(46, 44); } - break; - case 47: - if (curChar == 37 && kind > 151) - kind = 151; - break; - case 48: - if (curChar == 37) - jjstateSet[jjnewStateCnt++] = 42; - break; - case 49: - if (curChar != 35) - break; - if (kind > 152) - kind = 152; - { jjCheckNAddTwoStates(50, 51); } - break; - case 50: - if ((0x3ff001000000000L & l) == 0L) - break; - if (kind > 152) - kind = 152; - { jjCheckNAddTwoStates(50, 51); } - break; - case 52: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 53; - break; - case 53: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 54; - break; - case 54: - case 58: - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(55); } - break; - case 55: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 152) - kind = 152; - { jjCheckNAddTwoStates(50, 51); } - break; - case 56: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 57; - break; - case 57: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 58; - break; - case 59: - if (curChar == 36) - jjstateSet[jjnewStateCnt++] = 60; - break; - case 60: - if ((0x41800000000L & l) != 0L && kind > 153) - kind = 153; - break; - case 61: - if (curChar == 36) - { jjAddStates(5, 6); } - break; - case 68: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - break; - case 69: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 70; - break; - case 70: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 71; - break; - case 71: - case 75: - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(68); } - break; - case 73: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 74; - break; - case 74: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 75; - break; - case 79: - if ((0x3ff000000000000L & l) != 0L && kind > 163) - kind = 163; - break; - case 81: - if ((0x3ff000000000000L & l) != 0L && kind > 166) - kind = 166; - break; - case 82: - if (curChar == 47) - { jjAddStates(3, 4); } - break; - case 84: - if ((0xffff7fffffffdbffL & l) != 0L) - { jjCheckNAddStates(0, 2); } - break; - case 86: - if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(0, 2); } - break; - case 87: - if (curChar != 47) - break; - if (kind > 169) - kind = 169; - { jjCheckNAddTwoStates(88, 89); } - break; - case 88: - if ((0x3ff001000000000L & l) == 0L) - break; - if (kind > 169) - kind = 169; - { jjCheckNAddTwoStates(88, 89); } - break; - case 90: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 91; - break; - case 91: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 92; - break; - case 92: - case 96: - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(93); } - break; - case 93: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 169) - kind = 169; - { jjCheckNAddTwoStates(88, 89); } - break; - case 94: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 95; - break; - case 95: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 96; - break; - case 98: - if (curChar != 48) - break; - if (kind > 132) - kind = 132; - { jjCheckNAddStates(18, 20); } - break; - case 99: - if (curChar != 46) - break; - if (kind > 132) - kind = 132; - { jjCheckNAddTwoStates(100, 101); } - break; - case 100: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 132) - kind = 132; - { jjCheckNAddTwoStates(100, 101); } - break; - case 102: - if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(103); } - break; - case 103: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 132) - kind = 132; - { jjCheckNAdd(103); } - break; - case 105: - if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(106); } - break; - case 106: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 132) - kind = 132; - { jjCheckNAdd(106); } - break; - case 108: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 136) - kind = 136; - jjstateSet[jjnewStateCnt++] = 108; - break; - case 109: - if ((0x3fe000000000000L & l) == 0L) - break; - if (kind > 132) - kind = 132; - { jjCheckNAddStates(13, 17); } - break; - case 110: - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(110, 99); } - break; - case 111: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 132) - kind = 132; - { jjCheckNAddTwoStates(111, 104); } - break; - case 112: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 135) - kind = 135; - { jjCheckNAdd(112); } - break; - case 113: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 137) - kind = 137; - { jjCheckNAdd(113); } - break; - case 115: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 116; - break; - case 116: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 117; - break; - case 117: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 118; - break; - case 118: - if ((0x3ff000000000000L & l) != 0L && kind > 165) - kind = 165; - break; - default : break; - } - } while(i != startsAt); - } - else if (curChar < 128) - { - long l = 1L << (curChar & 077); - do - { - switch(jjstateSet[--i]) - { - case 67: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - } - if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(68); } - else if (curChar == 117) - { jjAddStates(21, 22); } - if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(68); } - break; - case 83: - if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(0, 2); } - else if (curChar == 92) - { jjCheckNAdd(86); } - break; - case 8: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - } - if (curChar == 117) - { jjAddStates(21, 22); } - if (curChar == 117) - { jjCheckNAdd(7); } - break; - case 13: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - } - if (curChar == 117) - { jjAddStates(21, 22); } - else if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 12; - break; - case 66: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - } - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 71; - else if (curChar == 117) - { jjAddStates(21, 22); } - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 67; - break; - case 119: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - } - if (curChar == 117) - { jjAddStates(21, 22); } - break; - case 0: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - } - else if (curChar == 64) - { jjAddStates(5, 6); } - if ((0x7e0000007eL & l) != 0L) - { - if (kind > 166) - kind = 166; - } - else if (curChar == 117) - { jjCheckNAddTwoStates(73, 115); } - else if (curChar == 95) - { - if (kind > 164) - kind = 164; - } - else if (curChar == 120) - jjstateSet[jjnewStateCnt++] = 40; - else if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 9; - if (curChar == 102) - jjstateSet[jjnewStateCnt++] = 13; - break; - case 9: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - } - if (curChar == 117) - { jjAddStates(21, 22); } - else if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 8; - break; - case 65: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - } - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 70; - else if (curChar == 117) - { jjAddStates(21, 22); } - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 66; - break; - case 4: - if ((0x2000000020L & l) != 0L) - { jjAddStates(23, 24); } - break; - case 7: - if (curChar == 101 && kind > 140) - kind = 140; - break; - case 10: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 9; - break; - case 11: - if (curChar == 115) - { jjCheckNAdd(7); } - break; - case 12: - if (curChar == 108) - jjstateSet[jjnewStateCnt++] = 11; - break; - case 14: - if (curChar == 102) - jjstateSet[jjnewStateCnt++] = 13; - break; - case 16: - if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(10, 12); } - break; - case 17: - if (curChar == 92) - { jjAddStates(25, 27); } - break; - case 18: - { jjCheckNAddStates(10, 12); } - break; - case 20: - if (curChar == 120) - jjstateSet[jjnewStateCnt++] = 21; - break; - case 21: - case 26: - if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(22); } - break; - case 22: - if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(10, 12); } - break; - case 23: - if (curChar == 117) - jjstateSet[jjnewStateCnt++] = 24; - break; - case 24: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 25; - break; - case 25: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 26; - break; - case 28: - if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(7, 9); } - break; - case 29: - if (curChar == 92) - { jjAddStates(28, 30); } - break; - case 30: - { jjCheckNAddStates(7, 9); } - break; - case 32: - if (curChar == 120) - jjstateSet[jjnewStateCnt++] = 33; - break; - case 33: - case 38: - if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(34); } - break; - case 34: - if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(7, 9); } - break; - case 35: - if (curChar == 117) - jjstateSet[jjnewStateCnt++] = 36; - break; - case 36: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 37; - break; - case 37: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 38; - break; - case 39: - if (curChar == 120) - jjstateSet[jjnewStateCnt++] = 40; - break; - case 40: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 41; - break; - case 41: - if ((0x7e0000007eL & l) != 0L && kind > 150) - kind = 150; - break; - case 42: - if (curChar == 123) - { jjCheckNAddTwoStates(43, 44); } - break; - case 43: - if ((0xdfffffffffffffffL & l) != 0L) - { jjCheckNAddTwoStates(43, 44); } - break; - case 44: - if (curChar == 125) - { jjCheckNAddStates(31, 33); } - break; - case 45: - case 46: - if ((0xdfffffffffffffffL & l) != 0L) - { jjCheckNAddTwoStates(46, 44); } - break; - case 50: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 152) - kind = 152; - { jjCheckNAddTwoStates(50, 51); } - break; - case 51: - if (curChar == 117) - { jjAddStates(34, 35); } - break; - case 52: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 53; - break; - case 53: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 54; - break; - case 54: - case 58: - if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(55); } - break; - case 55: - if ((0x7e0000007eL & l) == 0L) - break; - if (kind > 152) - kind = 152; - { jjCheckNAddTwoStates(50, 51); } - break; - case 56: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 57; - break; - case 57: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 58; - break; - case 60: - if (curChar == 94 && kind > 153) - kind = 153; - break; - case 61: - if (curChar == 64) - { jjAddStates(5, 6); } - break; - case 62: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - break; - case 63: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - break; - case 64: - if (curChar == 117) - { jjAddStates(21, 22); } - break; - case 68: - if ((0x7e0000007eL & l) == 0L) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - break; - case 69: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 70; - break; - case 70: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 71; - break; - case 71: - case 75: - if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(68); } - break; - case 72: - if (curChar == 117) - { jjCheckNAdd(73); } - break; - case 73: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 74; - break; - case 74: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 75; - break; - case 80: - if (curChar == 95 && kind > 164) - kind = 164; - break; - case 81: - if ((0x7e0000007eL & l) != 0L && kind > 166) - kind = 166; - break; - case 84: - if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(0, 2); } - break; - case 85: - if (curChar == 92) - { jjCheckNAdd(86); } - break; - case 86: - { jjCheckNAddStates(0, 2); } - break; - case 88: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 169) - kind = 169; - { jjCheckNAddTwoStates(88, 89); } - break; - case 89: - if (curChar == 117) - { jjAddStates(36, 37); } - break; - case 90: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 91; - break; - case 91: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 92; - break; - case 92: - case 96: - if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(93); } - break; - case 93: - if ((0x7e0000007eL & l) == 0L) - break; - if (kind > 169) - kind = 169; - { jjCheckNAddTwoStates(88, 89); } - break; - case 94: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 95; - break; - case 95: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 96; - break; - case 97: - if (curChar == 92) - { jjCheckNAdd(86); } - break; - case 101: - if ((0x2000000020L & l) != 0L) - { jjAddStates(38, 39); } - break; - case 104: - if ((0x2000000020L & l) != 0L) - { jjAddStates(40, 41); } - break; - case 107: - if ((0x100000001000000L & l) != 0L) - { jjCheckNAdd(108); } - break; - case 108: - if ((0x7e0000007eL & l) == 0L) - break; - if (kind > 136) - kind = 136; - { jjCheckNAdd(108); } - break; - case 114: - if (curChar == 117) - { jjCheckNAddTwoStates(73, 115); } - break; - case 115: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 116; - break; - case 116: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 117; - break; - case 117: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 118; - break; - case 118: - if ((0x7e0000007eL & l) != 0L && kind > 165) - kind = 165; - break; - default : break; - } - } while(i != startsAt); - } - else - { - int hiByte = (curChar >> 8); - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - do - { - switch(jjstateSet[--i]) - { - case 67: - case 63: - if (!jjCanMove_4(hiByte, i1, i2, l1, l2)) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - break; - case 83: - case 84: - case 86: - if (jjCanMove_3(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(0, 2); } - break; - case 8: - if (!jjCanMove_4(hiByte, i1, i2, l1, l2)) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - break; - case 13: - if (!jjCanMove_4(hiByte, i1, i2, l1, l2)) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - break; - case 66: - if (!jjCanMove_4(hiByte, i1, i2, l1, l2)) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - break; - case 119: - if (!jjCanMove_4(hiByte, i1, i2, l1, l2)) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - break; - case 0: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { - if (kind > 1) - kind = 1; - } - if (jjCanMove_1(hiByte, i1, i2, l1, l2)) - { - if (kind > 8) - kind = 8; - } - if (jjCanMove_5(hiByte, i1, i2, l1, l2)) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - } - if (jjCanMove_6(hiByte, i1, i2, l1, l2)) - { - if (kind > 160) - kind = 160; - } - if (jjCanMove_7(hiByte, i1, i2, l1, l2)) - { - if (kind > 161) - kind = 161; - } - if (jjCanMove_8(hiByte, i1, i2, l1, l2)) - { - if (kind > 162) - kind = 162; - } - if (jjCanMove_9(hiByte, i1, i2, l1, l2)) - { - if (kind > 163) - kind = 163; - } - if (jjCanMove_10(hiByte, i1, i2, l1, l2)) - { - if (kind > 164) - kind = 164; - } - break; - case 9: - if (!jjCanMove_4(hiByte, i1, i2, l1, l2)) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - break; - case 65: - if (!jjCanMove_4(hiByte, i1, i2, l1, l2)) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - break; - case 1: - if (jjCanMove_1(hiByte, i1, i2, l1, l2) && kind > 8) - kind = 8; - break; - case 16: - if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(10, 12); } - break; - case 18: - if (jjCanMove_3(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(10, 12); } - break; - case 28: - if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(7, 9); } - break; - case 30: - if (jjCanMove_3(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(7, 9); } - break; - case 43: - if (jjCanMove_3(hiByte, i1, i2, l1, l2)) - { jjCheckNAddTwoStates(43, 44); } - break; - case 45: - case 46: - if (jjCanMove_3(hiByte, i1, i2, l1, l2)) - { jjCheckNAddTwoStates(46, 44); } - break; - case 50: - if (!jjCanMove_4(hiByte, i1, i2, l1, l2)) - break; - if (kind > 152) - kind = 152; - { jjAddStates(42, 43); } - break; - case 62: - if (!jjCanMove_5(hiByte, i1, i2, l1, l2)) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(63, 64); } - break; - case 76: - if (jjCanMove_6(hiByte, i1, i2, l1, l2) && kind > 160) - kind = 160; - break; - case 77: - if (jjCanMove_7(hiByte, i1, i2, l1, l2) && kind > 161) - kind = 161; - break; - case 78: - if (jjCanMove_8(hiByte, i1, i2, l1, l2) && kind > 162) - kind = 162; - break; - case 79: - if (jjCanMove_9(hiByte, i1, i2, l1, l2) && kind > 163) - kind = 163; - break; - case 80: - if (jjCanMove_10(hiByte, i1, i2, l1, l2) && kind > 164) - kind = 164; - break; - case 88: - if (!jjCanMove_4(hiByte, i1, i2, l1, l2)) - break; - if (kind > 169) - kind = 169; - { jjAddStates(44, 45); } - break; - default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break; - } - } while(i != startsAt); - } - if (kind != 0x7fffffff) - { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 119 - (jjnewStateCnt = startsAt))) - return curPos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return curPos; } - } -} -private int jjMoveStringLiteralDfa0_3(){ - switch(curChar) - { - case 42: - return jjMoveStringLiteralDfa1_3(0x10000L); - default : - return 1; - } -} -private int jjMoveStringLiteralDfa1_3(long active0){ - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return 1; - } - switch(curChar) - { - case 47: - if ((active0 & 0x10000L) != 0L) - return jjStopAtPos(1, 16); - break; - default : - return 2; - } - return 2; -} -private int jjMoveStringLiteralDfa0_2() -{ - return jjMoveNfa_2(4, 0); -} -private int jjMoveNfa_2(int startState, int curPos) -{ - int startsAt = 0; - jjnewStateCnt = 4; - int i = 1; - jjstateSet[0] = startState; - int kind = 0x7fffffff; - for (;;) - { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) - { - long l = 1L << curChar; - do - { - switch(jjstateSet[--i]) - { - case 4: - if ((0xffffffffffffdbffL & l) != 0L) - { - if (kind > 15) - kind = 15; - { jjCheckNAddStates(46, 48); } - } - else if ((0x2400L & l) != 0L) - { - if (kind > 15) - kind = 15; - } - if (curChar == 13) - jjstateSet[jjnewStateCnt++] = 2; - break; - case 0: - if ((0xffffffffffffdbffL & l) == 0L) - break; - kind = 15; - { jjCheckNAddStates(46, 48); } - break; - case 1: - if ((0x2400L & l) != 0L && kind > 15) - kind = 15; - break; - case 2: - if (curChar == 10 && kind > 15) - kind = 15; - break; - case 3: - if (curChar == 13) - jjstateSet[jjnewStateCnt++] = 2; - break; - default : break; - } - } while(i != startsAt); - } - else if (curChar < 128) - { - long l = 1L << (curChar & 077); - do - { - switch(jjstateSet[--i]) - { - case 4: - case 0: - kind = 15; - { jjCheckNAddStates(46, 48); } - break; - default : break; - } - } while(i != startsAt); - } - else - { - int hiByte = (curChar >> 8); - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - do - { - switch(jjstateSet[--i]) - { - case 4: - case 0: - if (!jjCanMove_3(hiByte, i1, i2, l1, l2)) - break; - if (kind > 15) - kind = 15; - { jjCheckNAddStates(46, 48); } - break; - default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break; - } - } while(i != startsAt); - } - if (kind != 0x7fffffff) - { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 4 - (jjnewStateCnt = startsAt))) - return curPos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return curPos; } - } -} -private int jjMoveStringLiteralDfa0_4() -{ - return 1; -} -private final int jjStopStringLiteralDfa_1(int pos, long active0, long active1, long active2){ - switch (pos) - { - case 0: - if ((active0 & 0x38040000000000L) != 0L || (active1 & 0x1000L) != 0L) - { - jjmatchedKind = 153; - return 14; - } - if ((active1 & 0x2000000L) != 0L) - return 3; - if ((active1 & 0x1000010000000000L) != 0L) - return 40; - if ((active0 & 0x9fc7fbfffbfc0000L) != 0L || (active1 & 0xefffL) != 0L || (active2 & 0x808L) != 0L) - { - jjmatchedKind = 153; - return 89; - } - if ((active0 & 0x6000000004000000L) != 0L || (active1 & 0x30000L) != 0L) - { - jjmatchedKind = 153; - return 10; - } - return -1; - case 1: - if ((active1 & 0x20000L) != 0L) - { - if (jjmatchedPos != 1) - { - jjmatchedKind = 153; - jjmatchedPos = 1; - } - return 9; - } - if ((active0 & 0x30000410400000L) != 0L || (active1 & 0x4000L) != 0L || (active2 & 0x800L) != 0L) - { - if (jjmatchedPos != 1) - { - jjmatchedKind = 153; - jjmatchedPos = 1; - } - return 63; - } - if ((active0 & 0xfe0ffdfaeb980000L) != 0L || (active1 & 0x1bdffL) != 0L) - { - if (jjmatchedPos != 1) - { - jjmatchedKind = 153; - jjmatchedPos = 1; - } - return 89; - } - if ((active0 & 0x1c0020104240000L) != 0L || (active1 & 0x200L) != 0L || (active2 & 0x8L) != 0L) - return 89; - return -1; - case 2: - if ((active0 & 0x7a37977bcbbc0000L) != 0L || (active1 & 0x1f8ffL) != 0L || (active2 & 0x808L) != 0L) - { - if (jjmatchedPos != 2) - { - jjmatchedKind = 153; - jjmatchedPos = 2; - } - return 89; - } - if ((active1 & 0x400L) != 0L) - { - if (jjmatchedPos != 2) - { - jjmatchedKind = 153; - jjmatchedPos = 2; - } - return 63; - } - if ((active0 & 0x8408688430400000L) != 0L || (active1 & 0x20100L) != 0L) - return 89; - return -1; - case 3: - if ((active0 & 0x800002000200000L) != 0L || (active1 & 0x80L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 3; - return 63; - } - if ((active0 & 0x50339759c3dc0000L) != 0L || (active1 & 0x1f972L) != 0L || (active2 & 0x8L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 3; - return 89; - } - if ((active0 & 0x2204000208000000L) != 0L || (active1 & 0x40dL) != 0L || (active2 & 0x800L) != 0L) - return 89; - return -1; - case 4: - if ((active0 & 0x4833166941980000L) != 0L || (active1 & 0xb880L) != 0L || (active2 & 0x8L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 4; - return 89; - } - if ((active0 & 0x440000L) != 0L || (active1 & 0x100L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 4; - return 63; - } - if ((active0 & 0x1000811082200000L) != 0L || (active1 & 0x14072L) != 0L) - return 89; - return -1; - case 5: - if ((active0 & 0x31164040180000L) != 0L || (active1 & 0x1980L) != 0L || (active2 & 0x8L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 5; - return 89; - } - if ((active0 & 0x40000L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 5; - return 64; - } - if ((active0 & 0x4802002901c00000L) != 0L || (active1 & 0xa000L) != 0L) - return 89; - return -1; - case 6: - if ((active0 & 0x1000000000000L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 6; - return 63; - } - if ((active0 & 0x40000L) != 0L) - return 65; - if ((active0 & 0x30060040080000L) != 0L || (active1 & 0x80L) != 0L || (active2 & 0x8L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 6; - return 89; - } - if ((active0 & 0x104000100000L) != 0L || (active1 & 0x1900L) != 0L) - return 89; - return -1; - case 7: - if ((active0 & 0x1000000000000L) != 0L) - return 64; - if ((active0 & 0x20040080000L) != 0L || (active2 & 0x8L) != 0L) - { - if (jjmatchedPos != 7) - { - jjmatchedKind = 153; - jjmatchedPos = 7; - } - return 89; - } - if ((active0 & 0x30040000000000L) != 0L || (active1 & 0x80L) != 0L) - return 89; - return -1; - case 8: - if ((active0 & 0x20000000000L) != 0L || (active2 & 0x8L) != 0L) - { - jjmatchedKind = 153; - jjmatchedPos = 8; - return 89; - } - if ((active0 & 0x40080000L) != 0L) - return 89; - return -1; - default : - return -1; - } -} -private final int jjStartNfa_1(int pos, long active0, long active1, long active2){ - return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0, active1, active2), pos + 1); -} -private int jjMoveStringLiteralDfa0_1(){ - switch(curChar) - { - case 33: - jjmatchedKind = 113; - return jjMoveStringLiteralDfa1_1(0x0L, 0x1200000000L, 0x0L); - case 37: - jjmatchedKind = 104; - return jjMoveStringLiteralDfa1_1(0x0L, 0x1000000000000000L, 0x0L); - case 38: - jjmatchedKind = 110; - return jjMoveStringLiteralDfa1_1(0x0L, 0x8000000000000L, 0x1L); - case 40: - return jjStopAtPos(0, 85); - case 41: - return jjStopAtPos(0, 86); - case 42: - jjmatchedKind = 103; - return jjMoveStringLiteralDfa1_1(0x0L, 0x800000000000000L, 0x0L); - case 43: - jjmatchedKind = 101; - return jjMoveStringLiteralDfa1_1(0x0L, 0x200020000000000L, 0x0L); - case 44: - return jjStopAtPos(0, 91); - case 45: - jjmatchedKind = 102; - return jjMoveStringLiteralDfa1_1(0x0L, 0x400040000000000L, 0x0L); - case 46: - return jjStartNfaWithStates_1(0, 89, 3); - case 47: - jjmatchedKind = 168; - return jjMoveStringLiteralDfa1_1(0x6000L, 0x0L, 0x8000000000L); - case 58: - jjmatchedKind = 119; - return jjMoveStringLiteralDfa1_1(0x0L, 0x40000000000000L, 0x0L); - case 59: - return jjStopAtPos(0, 90); - case 60: - jjmatchedKind = 92; - return jjMoveStringLiteralDfa1_1(0x0L, 0x2000080040000000L, 0x0L); - case 61: - jjmatchedKind = 120; - return jjMoveStringLiteralDfa1_1(0x0L, 0x900040000L, 0x0L); - case 62: - jjmatchedKind = 93; - return jjMoveStringLiteralDfa1_1(0x0L, 0xc000300080000000L, 0x0L); - case 63: - return jjStopAtPos(0, 117); - case 91: - return jjStopAtPos(0, 87); - case 93: - return jjStopAtPos(0, 88); - case 94: - jjmatchedKind = 112; - return jjMoveStringLiteralDfa1_1(0x0L, 0x0L, 0x4L); - case 97: - return jjMoveStringLiteralDfa1_1(0x3002080000L, 0x0L, 0x0L); - case 98: - return jjMoveStringLiteralDfa1_1(0x800880000000L, 0x0L, 0x0L); - case 99: - return jjMoveStringLiteralDfa1_1(0x1010068100000L, 0x78L, 0x0L); - case 100: - return jjMoveStringLiteralDfa1_1(0x2108000000000L, 0x380L, 0x0L); - case 101: - return jjMoveStringLiteralDfa1_1(0x204080200000000L, 0xc00L, 0x0L); - case 102: - return jjMoveStringLiteralDfa1_1(0x38040000000000L, 0x1000L, 0x0L); - case 105: - return jjMoveStringLiteralDfa1_1(0xc0020100240000L, 0x2000L, 0x8L); - case 110: - return jjMoveStringLiteralDfa1_1(0x400000000000000L, 0x0L, 0x800L); - case 111: - return jjMoveStringLiteralDfa1_1(0x100000400400000L, 0x0L, 0x0L); - case 112: - return jjMoveStringLiteralDfa1_1(0x400000000000L, 0x0L, 0x0L); - case 114: - return jjMoveStringLiteralDfa1_1(0x800004010000000L, 0x0L, 0x0L); - case 115: - return jjMoveStringLiteralDfa1_1(0x200001800000L, 0xc000L, 0x0L); - case 116: - return jjMoveStringLiteralDfa1_1(0x6000000004000000L, 0x30000L, 0x0L); - case 118: - return jjMoveStringLiteralDfa1_1(0x8000000000000000L, 0x1L, 0x0L); - case 119: - return jjMoveStringLiteralDfa1_1(0x0L, 0x6L, 0x0L); - case 121: - return jjMoveStringLiteralDfa1_1(0x1000000000000000L, 0x0L, 0x0L); - case 123: - return jjStopAtPos(0, 83); - case 124: - jjmatchedKind = 111; - return jjMoveStringLiteralDfa1_1(0x0L, 0x10000000000000L, 0x2L); - case 125: - return jjStopAtPos(0, 84); - case 126: - jjmatchedKind = 114; - return jjMoveStringLiteralDfa1_1(0x0L, 0x400000000L, 0x0L); - default : - return jjMoveNfa_1(0, 0); - } -} -private int jjMoveStringLiteralDfa1_1(long active0, long active1, long active2){ - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_1(0, active0, active1, active2); - return 1; - } - switch(curChar) - { - case 38: - if ((active1 & 0x8000000000000L) != 0L) - return jjStopAtPos(1, 115); - break; - case 42: - if ((active0 & 0x4000L) != 0L) - return jjStopAtPos(1, 14); - break; - case 43: - if ((active1 & 0x20000000000L) != 0L) - return jjStopAtPos(1, 105); - break; - case 45: - if ((active1 & 0x40000000000L) != 0L) - return jjStopAtPos(1, 106); - break; - case 47: - if ((active0 & 0x2000L) != 0L) - return jjStopAtPos(1, 13); - break; - case 58: - if ((active1 & 0x40000000000000L) != 0L) - return jjStopAtPos(1, 118); - break; - case 60: - if ((active1 & 0x80000000000L) != 0L) - { - jjmatchedKind = 107; - jjmatchedPos = 1; - } - return jjMoveStringLiteralDfa2_1(active0, 0L, active1, 0x2000000000000000L, active2, 0L); - case 61: - if ((active1 & 0x40000000L) != 0L) - return jjStopAtPos(1, 94); - else if ((active1 & 0x80000000L) != 0L) - return jjStopAtPos(1, 95); - else if ((active1 & 0x100000000L) != 0L) - { - jjmatchedKind = 96; - jjmatchedPos = 1; - } - else if ((active1 & 0x200000000L) != 0L) - { - jjmatchedKind = 97; - jjmatchedPos = 1; - } - else if ((active1 & 0x400000000L) != 0L) - return jjStopAtPos(1, 98); - else if ((active1 & 0x200000000000000L) != 0L) - return jjStopAtPos(1, 121); - else if ((active1 & 0x400000000000000L) != 0L) - return jjStopAtPos(1, 122); - else if ((active1 & 0x800000000000000L) != 0L) - return jjStopAtPos(1, 123); - else if ((active1 & 0x1000000000000000L) != 0L) - return jjStopAtPos(1, 124); - else if ((active2 & 0x1L) != 0L) - return jjStopAtPos(1, 128); - else if ((active2 & 0x2L) != 0L) - return jjStopAtPos(1, 129); - else if ((active2 & 0x4L) != 0L) - return jjStopAtPos(1, 130); - else if ((active2 & 0x8000000000L) != 0L) - return jjStopAtPos(1, 167); - return jjMoveStringLiteralDfa2_1(active0, 0L, active1, 0x1800000000L, active2, 0L); - case 62: - if ((active1 & 0x40000L) != 0L) - return jjStopAtPos(1, 82); - else if ((active1 & 0x100000000000L) != 0L) - { - jjmatchedKind = 108; - jjmatchedPos = 1; - } - return jjMoveStringLiteralDfa2_1(active0, 0L, active1, 0xc000200000000000L, active2, 0L); - case 97: - return jjMoveStringLiteralDfa2_1(active0, 0x8200400008000000L, active1, 0x18L, active2, 0L); - case 101: - return jjMoveStringLiteralDfa2_1(active0, 0xc0220c881000000L, active1, 0x180L, active2, 0L); - case 102: - if ((active0 & 0x40000000000000L) != 0L) - return jjStartNfaWithStates_1(1, 54, 89); - else if ((active0 & 0x100000000000000L) != 0L) - return jjStartNfaWithStates_1(1, 56, 89); - return jjMoveStringLiteralDfa2_1(active0, 0x1000000000L, active1, 0L, active2, 0L); - case 104: - return jjMoveStringLiteralDfa2_1(active0, 0x2000010000000000L, active1, 0x10002L, active2, 0L); - case 105: - return jjMoveStringLiteralDfa2_1(active0, 0x1000040000000000L, active1, 0x1004L, active2, 0L); - case 108: - return jjMoveStringLiteralDfa2_1(active0, 0x4000000000000L, active1, 0x20L, active2, 0L); - case 109: - return jjMoveStringLiteralDfa2_1(active0, 0x20000000L, active1, 0x2000L, active2, 0L); - case 110: - if ((active0 & 0x80000000000000L) != 0L) - { - jjmatchedKind = 55; - jjmatchedPos = 1; - } - return jjMoveStringLiteralDfa2_1(active0, 0xa0100240000L, active1, 0x400L, active2, 0x8L); - case 111: - if ((active0 & 0x4000000L) != 0L) - return jjStartNfaWithStates_1(1, 26, 89); - else if ((active1 & 0x200L) != 0L) - return jjStartNfaWithStates_1(1, 73, 89); - return jjMoveStringLiteralDfa2_1(active0, 0x9000040100000L, active1, 0x41L, active2, 0L); - case 112: - return jjMoveStringLiteralDfa2_1(active0, 0x2000000L, active1, 0L, active2, 0L); - case 114: - return jjMoveStringLiteralDfa2_1(active0, 0x802000000000L, active1, 0x20000L, active2, 0L); - case 115: - return jjMoveStringLiteralDfa2_1(active0, 0x80000L, active1, 0L, active2, 0L); - case 116: - return jjMoveStringLiteralDfa2_1(active0, 0x800000L, active1, 0L, active2, 0L); - case 117: - return jjMoveStringLiteralDfa2_1(active0, 0x30000410400000L, active1, 0x4000L, active2, 0x800L); - case 119: - return jjMoveStringLiteralDfa2_1(active0, 0L, active1, 0x8000L, active2, 0L); - case 120: - return jjMoveStringLiteralDfa2_1(active0, 0x200000000L, active1, 0x800L, active2, 0L); - case 121: - return jjMoveStringLiteralDfa2_1(active0, 0x4000100000000000L, active1, 0L, active2, 0L); - case 124: - if ((active1 & 0x10000000000000L) != 0L) - return jjStopAtPos(1, 116); - break; - default : - break; - } - return jjStartNfa_1(0, active0, active1, active2); -} -private int jjMoveStringLiteralDfa2_1(long old0, long active0, long old1, long active1, long old2, long active2){ - if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) - return jjStartNfa_1(0, old0, old1, old2); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_1(1, active0, active1, active2); - return 2; - } - switch(curChar) - { - case 61: - if ((active1 & 0x800000000L) != 0L) - return jjStopAtPos(2, 99); - else if ((active1 & 0x1000000000L) != 0L) - return jjStopAtPos(2, 100); - else if ((active1 & 0x2000000000000000L) != 0L) - return jjStopAtPos(2, 125); - else if ((active1 & 0x4000000000000000L) != 0L) - return jjStopAtPos(2, 126); - break; - case 62: - if ((active1 & 0x200000000000L) != 0L) - { - jjmatchedKind = 109; - jjmatchedPos = 2; - } - return jjMoveStringLiteralDfa3_1(active0, 0L, active1, 0x8000000000000000L, active2, 0L); - case 97: - return jjMoveStringLiteralDfa3_1(active0, 0x800000L, active1, 0x20L, active2, 0L); - case 98: - return jjMoveStringLiteralDfa3_1(active0, 0L, active1, 0x80L, active2, 0L); - case 99: - return jjMoveStringLiteralDfa3_1(active0, 0x200000000040000L, active1, 0L, active2, 0L); - case 100: - if ((active0 & 0x20000000L) != 0L) - return jjStartNfaWithStates_1(2, 29, 89); - else if ((active0 & 0x80000000000L) != 0L) - return jjStartNfaWithStates_1(2, 43, 89); - return jjMoveStringLiteralDfa3_1(active0, 0x100000L, active1, 0L, active2, 0L); - case 101: - return jjMoveStringLiteralDfa3_1(active0, 0x1000810200000000L, active1, 0L, active2, 0L); - case 102: - if ((active0 & 0x8000000000L) != 0L) - { - jjmatchedKind = 39; - jjmatchedPos = 2; - } - return jjMoveStringLiteralDfa3_1(active0, 0x800000000L, active1, 0x100L, active2, 0L); - case 103: - return jjMoveStringLiteralDfa3_1(active0, 0x80000000L, active1, 0L, active2, 0L); - case 105: - return jjMoveStringLiteralDfa3_1(active0, 0x2000020000000000L, active1, 0x8003L, active2, 0L); - case 108: - return jjMoveStringLiteralDfa3_1(active0, 0x2000009000000L, active1, 0L, active2, 0x800L); - case 110: - if ((active0 & 0x10000000L) != 0L) - return jjStartNfaWithStates_1(2, 28, 89); - return jjMoveStringLiteralDfa3_1(active0, 0x31140040000000L, active1, 0x1040L, active2, 0L); - case 111: - return jjMoveStringLiteralDfa3_1(active0, 0x2000000000L, active1, 0L, active2, 0L); - case 112: - return jjMoveStringLiteralDfa3_1(active0, 0x4000004002280000L, active1, 0x6000L, active2, 0L); - case 113: - if ((active0 & 0x200000000000L) != 0L) - return jjStartNfaWithStates_1(2, 45, 89); - break; - case 114: - if ((active0 & 0x400000000000L) != 0L) - return jjStartNfaWithStates_1(2, 46, 89); - else if ((active0 & 0x8000000000000L) != 0L) - return jjStartNfaWithStates_1(2, 51, 89); - else if ((active0 & 0x8000000000000000L) != 0L) - return jjStartNfaWithStates_1(2, 63, 89); - return jjMoveStringLiteralDfa3_1(active0, 0L, active1, 0x10000L, active2, 0L); - case 115: - return jjMoveStringLiteralDfa3_1(active0, 0x4000100000000L, active1, 0x8L, active2, 0x8L); - case 116: - if ((active0 & 0x400000000L) != 0L) - { - jjmatchedKind = 34; - jjmatchedPos = 2; - } - return jjMoveStringLiteralDfa3_1(active0, 0x800001000400000L, active1, 0x814L, active2, 0L); - case 117: - return jjMoveStringLiteralDfa3_1(active0, 0L, active1, 0x400L, active2, 0L); - case 119: - if ((active0 & 0x400000000000000L) != 0L) - return jjStartNfaWithStates_1(2, 58, 89); - break; - case 121: - if ((active1 & 0x20000L) != 0L) - return jjStartNfaWithStates_1(2, 81, 89); - break; - default : - break; - } - return jjStartNfa_1(1, active0, active1, active2); -} -private int jjMoveStringLiteralDfa3_1(long old0, long active0, long old1, long active1, long old2, long active2){ - if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) - return jjStartNfa_1(1, old0, old1, old2); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_1(2, active0, active1, active2); - return 3; - } - switch(curChar) - { - case 61: - if ((active1 & 0x8000000000000000L) != 0L) - return jjStopAtPos(3, 127); - break; - case 97: - return jjMoveStringLiteralDfa4_1(active0, 0x940000000000L, active1, 0x1100L, active2, 0L); - case 99: - if ((active0 & 0x200000000L) != 0L) - return jjStartNfaWithStates_1(3, 33, 89); - return jjMoveStringLiteralDfa4_1(active0, 0x30010000000000L, active1, 0x10L, active2, 0L); - case 100: - if ((active1 & 0x1L) != 0L) - return jjStartNfaWithStates_1(3, 64, 89); - return jjMoveStringLiteralDfa4_1(active0, 0x40000000L, active1, 0L, active2, 0L); - case 101: - if ((active0 & 0x4000000000000L) != 0L) - return jjStartNfaWithStates_1(3, 50, 89); - else if ((active1 & 0x8L) != 0L) - return jjStartNfaWithStates_1(3, 67, 89); - return jjMoveStringLiteralDfa4_1(active0, 0x4002001101180000L, active1, 0x4800L, active2, 0L); - case 104: - if ((active0 & 0x200000000000000L) != 0L) - return jjStartNfaWithStates_1(3, 57, 89); - else if ((active1 & 0x4L) != 0L) - return jjStartNfaWithStates_1(3, 66, 89); - break; - case 105: - return jjMoveStringLiteralDfa4_1(active0, 0x80000000L, active1, 0L, active2, 0L); - case 108: - if ((active0 & 0x8000000L) != 0L) - return jjStartNfaWithStates_1(3, 27, 89); - else if ((active2 & 0x800L) != 0L) - return jjStartNfaWithStates_1(3, 139, 89); - return jjMoveStringLiteralDfa4_1(active0, 0x1000004002040000L, active1, 0x2L, active2, 0L); - case 109: - if ((active1 & 0x400L) != 0L) - return jjStartNfaWithStates_1(3, 74, 89); - break; - case 111: - return jjMoveStringLiteralDfa4_1(active0, 0x800000000L, active1, 0x12000L, active2, 0L); - case 112: - return jjMoveStringLiteralDfa4_1(active0, 0x400000L, active1, 0L, active2, 0L); - case 115: - if ((active0 & 0x2000000000000000L) != 0L) - return jjStartNfaWithStates_1(3, 61, 89); - return jjMoveStringLiteralDfa4_1(active0, 0L, active1, 0x60L, active2, 0L); - case 116: - return jjMoveStringLiteralDfa4_1(active0, 0x1020000800000L, active1, 0x8000L, active2, 0x8L); - case 117: - return jjMoveStringLiteralDfa4_1(active0, 0x800002000200000L, active1, 0x80L, active2, 0L); - default : - break; - } - return jjStartNfa_1(2, active0, active1, active2); -} -private int jjMoveStringLiteralDfa4_1(long old0, long active0, long old1, long active1, long old2, long active2){ - if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) - return jjStartNfa_1(2, old0, old1, old2); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_1(3, active0, active1, active2); - return 4; - } - switch(curChar) - { - case 97: - return jjMoveStringLiteralDfa5_1(active0, 0x4000000000L, active1, 0L, active2, 0x8L); - case 99: - return jjMoveStringLiteralDfa5_1(active0, 0x1080000L, active1, 0x8000L, active2, 0L); - case 100: - if ((active0 & 0x1000000000000000L) != 0L) - return jjStartNfaWithStates_1(4, 60, 89); - return jjMoveStringLiteralDfa5_1(active0, 0x100000L, active1, 0L, active2, 0L); - case 101: - if ((active1 & 0x2L) != 0L) - return jjStartNfaWithStates_1(4, 65, 89); - break; - case 103: - return jjMoveStringLiteralDfa5_1(active0, 0L, active1, 0x80L, active2, 0L); - case 104: - if ((active1 & 0x10L) != 0L) - return jjStartNfaWithStates_1(4, 68, 89); - break; - case 105: - return jjMoveStringLiteralDfa5_1(active0, 0x1020040800000L, active1, 0L, active2, 0L); - case 107: - if ((active0 & 0x10000000000L) != 0L) - return jjStartNfaWithStates_1(4, 40, 89); - else if ((active0 & 0x800000000000L) != 0L) - return jjStartNfaWithStates_1(4, 47, 89); - break; - case 108: - return jjMoveStringLiteralDfa5_1(active0, 0x40000000000L, active1, 0x1000L, active2, 0L); - case 109: - return jjMoveStringLiteralDfa5_1(active0, 0x100000000000L, active1, 0L, active2, 0L); - case 110: - if ((active0 & 0x80000000L) != 0L) - return jjStartNfaWithStates_1(4, 31, 89); - return jjMoveStringLiteralDfa5_1(active0, 0x2000000000L, active1, 0x800L, active2, 0L); - case 111: - return jjMoveStringLiteralDfa5_1(active0, 0x4000000000000000L, active1, 0L, active2, 0L); - case 114: - if ((active0 & 0x1000000000L) != 0L) - return jjStartNfaWithStates_1(4, 36, 89); - else if ((active1 & 0x4000L) != 0L) - return jjStartNfaWithStates_1(4, 78, 89); - return jjMoveStringLiteralDfa5_1(active0, 0x800000900000000L, active1, 0x2000L, active2, 0L); - case 115: - if ((active1 & 0x20L) != 0L) - return jjStartNfaWithStates_1(4, 69, 89); - break; - case 116: - if ((active0 & 0x200000L) != 0L) - return jjStartNfaWithStates_1(4, 21, 89); - else if ((active1 & 0x40L) != 0L) - return jjStartNfaWithStates_1(4, 70, 89); - return jjMoveStringLiteralDfa5_1(active0, 0x32000000000000L, active1, 0L, active2, 0L); - case 117: - return jjMoveStringLiteralDfa5_1(active0, 0x440000L, active1, 0x100L, active2, 0L); - case 119: - if ((active1 & 0x10000L) != 0L) - return jjStartNfaWithStates_1(4, 80, 89); - break; - case 121: - if ((active0 & 0x2000000L) != 0L) - return jjStartNfaWithStates_1(4, 25, 89); - break; - default : - break; - } - return jjStartNfa_1(3, active0, active1, active2); -} -private int jjMoveStringLiteralDfa5_1(long old0, long active0, long old1, long active1, long old2, long active2){ - if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) - return jjStartNfa_1(3, old0, old1, old2); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_1(4, active0, active1, active2); - return 5; - } - switch(curChar) - { - case 97: - return jjMoveStringLiteralDfa6_1(active0, 0x20000000000L, active1, 0L, active2, 0L); - case 99: - if ((active0 & 0x800000L) != 0L) - return jjStartNfaWithStates_1(5, 23, 89); - return jjMoveStringLiteralDfa6_1(active0, 0x4000000000L, active1, 0L, active2, 0L); - case 100: - if ((active0 & 0x2000000000L) != 0L) - return jjStartNfaWithStates_1(5, 37, 89); - return jjMoveStringLiteralDfa6_1(active0, 0x40000L, active1, 0x800L, active2, 0L); - case 101: - if ((active0 & 0x800000000L) != 0L) - return jjStartNfaWithStates_1(5, 35, 89); - else if ((active0 & 0x2000000000000L) != 0L) - return jjStartNfaWithStates_1(5, 49, 89); - return jjMoveStringLiteralDfa6_1(active0, 0x100000L, active1, 0L, active2, 0L); - case 102: - if ((active0 & 0x4000000000000000L) != 0L) - return jjStartNfaWithStates_1(5, 62, 89); - break; - case 103: - return jjMoveStringLiteralDfa6_1(active0, 0L, active1, 0x80L, active2, 0L); - case 104: - if ((active1 & 0x8000L) != 0L) - return jjStartNfaWithStates_1(5, 79, 89); - break; - case 105: - return jjMoveStringLiteralDfa6_1(active0, 0x30140000000000L, active1, 0L, active2, 0L); - case 108: - return jjMoveStringLiteralDfa6_1(active0, 0L, active1, 0x1100L, active2, 0L); - case 110: - if ((active0 & 0x800000000000000L) != 0L) - return jjStartNfaWithStates_1(5, 59, 89); - return jjMoveStringLiteralDfa6_1(active0, 0x1000000000000L, active1, 0L, active2, 0x8L); - case 116: - if ((active0 & 0x400000L) != 0L) - return jjStartNfaWithStates_1(5, 22, 89); - else if ((active0 & 0x1000000L) != 0L) - return jjStartNfaWithStates_1(5, 24, 89); - else if ((active0 & 0x100000000L) != 0L) - return jjStartNfaWithStates_1(5, 32, 89); - else if ((active1 & 0x2000L) != 0L) - return jjStartNfaWithStates_1(5, 77, 89); - return jjMoveStringLiteralDfa6_1(active0, 0x40080000L, active1, 0L, active2, 0L); - default : - break; - } - return jjStartNfa_1(4, active0, active1, active2); -} -private int jjMoveStringLiteralDfa6_1(long old0, long active0, long old1, long active1, long old2, long active2){ - if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) - return jjStartNfa_1(4, old0, old1, old2); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_1(5, active0, active1, active2); - return 6; - } - switch(curChar) - { - case 99: - if ((active0 & 0x100000000000L) != 0L) - return jjStartNfaWithStates_1(6, 44, 89); - return jjMoveStringLiteralDfa7_1(active0, 0L, active1, 0L, active2, 0x8L); - case 100: - return jjMoveStringLiteralDfa7_1(active0, 0x80000L, active1, 0L, active2, 0L); - case 101: - if ((active0 & 0x40000L) != 0L) - return jjStartNfaWithStates_1(6, 18, 65); - else if ((active0 & 0x4000000000L) != 0L) - return jjStartNfaWithStates_1(6, 38, 89); - return jjMoveStringLiteralDfa7_1(active0, 0L, active1, 0x80L, active2, 0L); - case 102: - if ((active0 & 0x100000L) != 0L) - return jjStartNfaWithStates_1(6, 20, 89); - break; - case 105: - return jjMoveStringLiteralDfa7_1(active0, 0x40000000L, active1, 0L, active2, 0L); - case 108: - return jjMoveStringLiteralDfa7_1(active0, 0x20000000000L, active1, 0L, active2, 0L); - case 111: - return jjMoveStringLiteralDfa7_1(active0, 0x30000000000000L, active1, 0L, active2, 0L); - case 115: - if ((active1 & 0x800L) != 0L) - return jjStartNfaWithStates_1(6, 75, 89); - break; - case 116: - if ((active1 & 0x100L) != 0L) - return jjStartNfaWithStates_1(6, 72, 89); - break; - case 117: - return jjMoveStringLiteralDfa7_1(active0, 0x1000000000000L, active1, 0L, active2, 0L); - case 121: - if ((active1 & 0x1000L) != 0L) - return jjStartNfaWithStates_1(6, 76, 89); - break; - case 122: - return jjMoveStringLiteralDfa7_1(active0, 0x40000000000L, active1, 0L, active2, 0L); - default : - break; - } - return jjStartNfa_1(5, active0, active1, active2); -} -private int jjMoveStringLiteralDfa7_1(long old0, long active0, long old1, long active1, long old2, long active2){ - if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) - return jjStartNfa_1(5, old0, old1, old2); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_1(6, active0, active1, active2); - return 7; - } - switch(curChar) - { - case 101: - if ((active0 & 0x40000000000L) != 0L) - return jjStartNfaWithStates_1(7, 42, 89); - else if ((active0 & 0x1000000000000L) != 0L) - return jjStartNfaWithStates_1(7, 48, 64); - return jjMoveStringLiteralDfa8_1(active0, 0x80000L, active1, 0L, active2, 0x8L); - case 105: - return jjMoveStringLiteralDfa8_1(active0, 0x20000000000L, active1, 0L, active2, 0L); - case 110: - if ((active0 & 0x10000000000000L) != 0L) - { - jjmatchedKind = 52; - jjmatchedPos = 7; - } - return jjMoveStringLiteralDfa8_1(active0, 0x20000000000000L, active1, 0L, active2, 0L); - case 111: - return jjMoveStringLiteralDfa8_1(active0, 0x40000000L, active1, 0L, active2, 0L); - case 114: - if ((active1 & 0x80L) != 0L) - return jjStartNfaWithStates_1(7, 71, 89); - break; - default : - break; - } - return jjStartNfa_1(6, active0, active1, active2); -} -private int jjMoveStringLiteralDfa8_1(long old0, long active0, long old1, long active1, long old2, long active2){ - if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) - return jjStartNfa_1(6, old0, old1, old2); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_1(7, active0, 0L, active2); - return 8; - } - switch(curChar) - { - case 42: - if ((active0 & 0x20000000000000L) != 0L) - return jjStopAtPos(8, 53); - break; - case 102: - if ((active0 & 0x80000L) != 0L) - return jjStartNfaWithStates_1(8, 19, 89); - break; - case 110: - if ((active0 & 0x40000000L) != 0L) - return jjStartNfaWithStates_1(8, 30, 89); - break; - case 111: - return jjMoveStringLiteralDfa9_1(active0, 0L, active2, 0x8L); - case 122: - return jjMoveStringLiteralDfa9_1(active0, 0x20000000000L, active2, 0L); - default : - break; - } - return jjStartNfa_1(7, active0, 0L, active2); -} -private int jjMoveStringLiteralDfa9_1(long old0, long active0, long old2, long active2){ - if (((active0 &= old0) | (active2 &= old2)) == 0L) - return jjStartNfa_1(7, old0, 0L, old2); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_1(8, active0, 0L, active2); - return 9; - } - switch(curChar) - { - case 101: - if ((active0 & 0x20000000000L) != 0L) - return jjStartNfaWithStates_1(9, 41, 89); - break; - case 102: - if ((active2 & 0x8L) != 0L) - return jjStartNfaWithStates_1(9, 131, 89); - break; - default : - break; - } - return jjStartNfa_1(8, active0, 0L, active2); -} -private int jjStartNfaWithStates_1(int pos, int kind, int state) -{ - jjmatchedKind = kind; - jjmatchedPos = pos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return pos + 1; } - return jjMoveNfa_1(state, pos + 1); -} -private int jjMoveNfa_1(int startState, int curPos) -{ - int startsAt = 0; - jjnewStateCnt = 89; - int i = 1; - jjstateSet[0] = startState; - int kind = 0x7fffffff; - for (;;) - { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) - { - long l = 1L << curChar; - do - { - switch(jjstateSet[--i]) - { - case 89: - case 61: - if ((0x3ff001000000000L & l) == 0L) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - break; - case 14: - if ((0x3ff001000000000L & l) == 0L) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - break; - case 65: - if ((0x3ff001000000000L & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - } - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(66); } - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(66); } - break; - case 9: - if ((0x3ff001000000000L & l) == 0L) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - break; - case 10: - if ((0x3ff001000000000L & l) == 0L) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - break; - case 0: - if ((0x3ff000000000000L & l) != 0L) - { - if (kind > 137) - kind = 137; - { jjCheckNAdd(7); } - } - else if ((0x100001a00L & l) != 0L) - { - if (kind > 1) - kind = 1; - } - else if ((0x2400L & l) != 0L) - { - if (kind > 8) - kind = 8; - } - else if (curChar == 36) - { jjAddStates(49, 50); } - else if (curChar == 35) - { - if (kind > 152) - kind = 152; - { jjCheckNAddTwoStates(48, 49); } - } - else if (curChar == 37) - jjstateSet[jjnewStateCnt++] = 40; - else if (curChar == 39) - { jjCheckNAddStates(51, 53); } - else if (curChar == 34) - { jjCheckNAddStates(54, 56); } - else if (curChar == 46) - { jjCheckNAdd(3); } - if ((0x3fe000000000000L & l) != 0L) - { - if (kind > 132) - kind = 132; - { jjCheckNAddStates(57, 61); } - } - else if (curChar == 48) - { - if (kind > 132) - kind = 132; - { jjCheckNAddStates(62, 64); } - } - else if (curChar == 36) - jjstateSet[jjnewStateCnt++] = 58; - break; - case 64: - if ((0x3ff001000000000L & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - } - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 69; - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 65; - break; - case 63: - if ((0x3ff001000000000L & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - } - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 68; - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 64; - break; - case 1: - if ((0x2400L & l) != 0L && kind > 8) - kind = 8; - break; - case 2: - if (curChar == 46) - { jjCheckNAdd(3); } - break; - case 3: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 132) - kind = 132; - { jjCheckNAddTwoStates(3, 4); } - break; - case 5: - if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(6); } - break; - case 6: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 132) - kind = 132; - { jjCheckNAdd(6); } - break; - case 7: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 137) - kind = 137; - { jjCheckNAdd(7); } - break; - case 16: - if (curChar == 34) - { jjCheckNAddStates(54, 56); } - break; - case 17: - if ((0xfffffffbffffdbffL & l) != 0L) - { jjCheckNAddStates(54, 56); } - break; - case 19: - { jjCheckNAddStates(54, 56); } - break; - case 20: - if (curChar == 34 && kind > 141) - kind = 141; - break; - case 22: - case 27: - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(23); } - break; - case 23: - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(54, 56); } - break; - case 25: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 26; - break; - case 26: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 27; - break; - case 28: - if (curChar == 39) - { jjCheckNAddStates(51, 53); } - break; - case 29: - if ((0xffffff7fffffdbffL & l) != 0L) - { jjCheckNAddStates(51, 53); } - break; - case 31: - { jjCheckNAddStates(51, 53); } - break; - case 32: - if (curChar == 39 && kind > 141) - kind = 141; - break; - case 34: - case 39: - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(35); } - break; - case 35: - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(51, 53); } - break; - case 37: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 38; - break; - case 38: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 39; - break; - case 41: - { jjCheckNAddTwoStates(41, 42); } - break; - case 43: - if ((0xffffffdfffffffffL & l) != 0L) - { jjCheckNAddTwoStates(44, 42); } - break; - case 44: - { jjCheckNAddTwoStates(44, 42); } - break; - case 45: - if (curChar == 37 && kind > 151) - kind = 151; - break; - case 46: - if (curChar == 37) - jjstateSet[jjnewStateCnt++] = 40; - break; - case 47: - if (curChar != 35) - break; - if (kind > 152) - kind = 152; - { jjCheckNAddTwoStates(48, 49); } - break; - case 48: - if ((0x3ff001000000000L & l) == 0L) - break; - if (kind > 152) - kind = 152; - { jjCheckNAddTwoStates(48, 49); } - break; - case 50: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 51; - break; - case 51: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 52; - break; - case 52: - case 56: - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(53); } - break; - case 53: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 152) - kind = 152; - { jjCheckNAddTwoStates(48, 49); } - break; - case 54: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 55; - break; - case 55: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 56; - break; - case 57: - if (curChar == 36) - jjstateSet[jjnewStateCnt++] = 58; - break; - case 58: - if ((0x41800000000L & l) != 0L && kind > 153) - kind = 153; - break; - case 59: - if (curChar == 36) - { jjAddStates(49, 50); } - break; - case 66: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - break; - case 67: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 68; - break; - case 68: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 69; - break; - case 69: - case 73: - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(66); } - break; - case 71: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 72; - break; - case 72: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 73; - break; - case 74: - if (curChar != 48) - break; - if (kind > 132) - kind = 132; - { jjCheckNAddStates(62, 64); } - break; - case 75: - if (curChar != 46) - break; - if (kind > 132) - kind = 132; - { jjCheckNAddTwoStates(76, 77); } - break; - case 76: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 132) - kind = 132; - { jjCheckNAddTwoStates(76, 77); } - break; - case 78: - if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(79); } - break; - case 79: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 132) - kind = 132; - { jjCheckNAdd(79); } - break; - case 81: - if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(82); } - break; - case 82: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 132) - kind = 132; - { jjCheckNAdd(82); } - break; - case 84: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 136) - kind = 136; - jjstateSet[jjnewStateCnt++] = 84; - break; - case 85: - if ((0x3fe000000000000L & l) == 0L) - break; - if (kind > 132) - kind = 132; - { jjCheckNAddStates(57, 61); } - break; - case 86: - if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(86, 75); } - break; - case 87: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 132) - kind = 132; - { jjCheckNAddTwoStates(87, 80); } - break; - case 88: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 135) - kind = 135; - { jjCheckNAdd(88); } - break; - default : break; - } - } while(i != startsAt); - } - else if (curChar < 128) - { - long l = 1L << (curChar & 077); - do - { - switch(jjstateSet[--i]) - { - case 89: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - } - if (curChar == 117) - { jjAddStates(65, 66); } - break; - case 14: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - } - if (curChar == 117) - { jjAddStates(65, 66); } - else if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 13; - break; - case 65: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - } - if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(66); } - else if (curChar == 117) - { jjAddStates(65, 66); } - if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(66); } - break; - case 9: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - } - if (curChar == 117) - { jjAddStates(65, 66); } - if (curChar == 117) - { jjCheckNAdd(8); } - break; - case 10: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - } - if (curChar == 117) - { jjAddStates(65, 66); } - else if (curChar == 114) - jjstateSet[jjnewStateCnt++] = 9; - break; - case 0: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - } - else if (curChar == 64) - { jjAddStates(49, 50); } - if (curChar == 117) - jjstateSet[jjnewStateCnt++] = 71; - else if (curChar == 102) - jjstateSet[jjnewStateCnt++] = 14; - else if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 10; - break; - case 64: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - } - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 69; - else if (curChar == 117) - { jjAddStates(65, 66); } - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 65; - break; - case 63: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - } - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 68; - else if (curChar == 117) - { jjAddStates(65, 66); } - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 64; - break; - case 4: - if ((0x2000000020L & l) != 0L) - { jjAddStates(23, 24); } - break; - case 8: - if (curChar == 101 && kind > 140) - kind = 140; - break; - case 11: - if (curChar == 116) - jjstateSet[jjnewStateCnt++] = 10; - break; - case 12: - if (curChar == 115) - { jjCheckNAdd(8); } - break; - case 13: - if (curChar == 108) - jjstateSet[jjnewStateCnt++] = 12; - break; - case 15: - if (curChar == 102) - jjstateSet[jjnewStateCnt++] = 14; - break; - case 17: - if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(54, 56); } - break; - case 18: - if (curChar == 92) - { jjAddStates(67, 69); } - break; - case 19: - { jjCheckNAddStates(54, 56); } - break; - case 21: - if (curChar == 120) - jjstateSet[jjnewStateCnt++] = 22; - break; - case 22: - case 27: - if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(23); } - break; - case 23: - if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(54, 56); } - break; - case 24: - if (curChar == 117) - jjstateSet[jjnewStateCnt++] = 25; - break; - case 25: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 26; - break; - case 26: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 27; - break; - case 29: - if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(51, 53); } - break; - case 30: - if (curChar == 92) - { jjAddStates(70, 72); } - break; - case 31: - { jjCheckNAddStates(51, 53); } - break; - case 33: - if (curChar == 120) - jjstateSet[jjnewStateCnt++] = 34; - break; - case 34: - case 39: - if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(35); } - break; - case 35: - if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(51, 53); } - break; - case 36: - if (curChar == 117) - jjstateSet[jjnewStateCnt++] = 37; - break; - case 37: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 38; - break; - case 38: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 39; - break; - case 40: - if (curChar == 123) - { jjCheckNAddTwoStates(41, 42); } - break; - case 41: - if ((0xdfffffffffffffffL & l) != 0L) - { jjCheckNAddTwoStates(41, 42); } - break; - case 42: - if (curChar == 125) - { jjCheckNAddStates(73, 75); } - break; - case 43: - case 44: - if ((0xdfffffffffffffffL & l) != 0L) - { jjCheckNAddTwoStates(44, 42); } - break; - case 48: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 152) - kind = 152; - { jjCheckNAddTwoStates(48, 49); } - break; - case 49: - if (curChar == 117) - { jjAddStates(76, 77); } - break; - case 50: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 51; - break; - case 51: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 52; - break; - case 52: - case 56: - if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(53); } - break; - case 53: - if ((0x7e0000007eL & l) == 0L) - break; - if (kind > 152) - kind = 152; - { jjCheckNAddTwoStates(48, 49); } - break; - case 54: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 55; - break; - case 55: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 56; - break; - case 58: - if (curChar == 94 && kind > 153) - kind = 153; - break; - case 59: - if (curChar == 64) - { jjAddStates(49, 50); } - break; - case 60: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - break; - case 61: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - break; - case 62: - if (curChar == 117) - { jjAddStates(65, 66); } - break; - case 66: - if ((0x7e0000007eL & l) == 0L) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - break; - case 67: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 68; - break; - case 68: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 69; - break; - case 69: - case 73: - if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(66); } - break; - case 70: - if (curChar == 117) - jjstateSet[jjnewStateCnt++] = 71; - break; - case 71: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 72; - break; - case 72: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 73; - break; - case 77: - if ((0x2000000020L & l) != 0L) - { jjAddStates(78, 79); } - break; - case 80: - if ((0x2000000020L & l) != 0L) - { jjAddStates(80, 81); } - break; - case 83: - if ((0x100000001000000L & l) != 0L) - { jjCheckNAdd(84); } - break; - case 84: - if ((0x7e0000007eL & l) == 0L) - break; - if (kind > 136) - kind = 136; - { jjCheckNAdd(84); } - break; - default : break; - } - } while(i != startsAt); - } - else - { - int hiByte = (curChar >> 8); - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - do - { - switch(jjstateSet[--i]) - { - case 89: - case 61: - if (!jjCanMove_4(hiByte, i1, i2, l1, l2)) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - break; - case 14: - if (!jjCanMove_4(hiByte, i1, i2, l1, l2)) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - break; - case 65: - if (!jjCanMove_4(hiByte, i1, i2, l1, l2)) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - break; - case 9: - if (!jjCanMove_4(hiByte, i1, i2, l1, l2)) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - break; - case 10: - if (!jjCanMove_4(hiByte, i1, i2, l1, l2)) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - break; - case 0: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { - if (kind > 1) - kind = 1; - } - if (jjCanMove_1(hiByte, i1, i2, l1, l2)) - { - if (kind > 8) - kind = 8; - } - if (jjCanMove_5(hiByte, i1, i2, l1, l2)) - { - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - } - break; - case 64: - if (!jjCanMove_4(hiByte, i1, i2, l1, l2)) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - break; - case 63: - if (!jjCanMove_4(hiByte, i1, i2, l1, l2)) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - break; - case 1: - if (jjCanMove_1(hiByte, i1, i2, l1, l2) && kind > 8) - kind = 8; - break; - case 17: - if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(54, 56); } - break; - case 19: - if (jjCanMove_3(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(54, 56); } - break; - case 29: - if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(51, 53); } - break; - case 31: - if (jjCanMove_3(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(51, 53); } - break; - case 41: - if (jjCanMove_3(hiByte, i1, i2, l1, l2)) - { jjCheckNAddTwoStates(41, 42); } - break; - case 43: - case 44: - if (jjCanMove_3(hiByte, i1, i2, l1, l2)) - { jjCheckNAddTwoStates(44, 42); } - break; - case 48: - if (!jjCanMove_4(hiByte, i1, i2, l1, l2)) - break; - if (kind > 152) - kind = 152; - { jjAddStates(82, 83); } - break; - case 60: - if (!jjCanMove_5(hiByte, i1, i2, l1, l2)) - break; - if (kind > 153) - kind = 153; - { jjCheckNAddTwoStates(61, 62); } - break; - default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break; - } - } while(i != startsAt); - } - if (kind != 0x7fffffff) - { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 89 - (jjnewStateCnt = startsAt))) - return curPos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return curPos; } - } -} - -/** Token literal values. */ -public static final String[] jjstrLiteralImages = { -null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, "\151\156\143\154\165\144\145", -"\141\163\160\145\143\164\144\145\146", "\143\157\144\145\144\145\146", "\151\156\160\165\164", -"\157\165\164\160\165\164", "\163\164\141\164\151\143", "\163\145\154\145\143\164", -"\141\160\160\154\171", "\164\157", "\143\141\154\154", "\162\165\156", "\143\155\144", -"\143\157\156\144\151\164\151\157\156", "\142\145\147\151\156", "\151\156\163\145\162\164", "\145\170\145\143", -"\157\165\164", "\142\145\146\157\162\145", "\141\146\164\145\162", -"\141\162\157\165\156\144", "\162\145\160\154\141\143\145", "\144\145\146", "\143\150\145\143\153", -"\151\156\151\164\151\141\154\151\172\145", "\146\151\156\141\154\151\172\145", "\145\156\144", -"\144\171\156\141\155\151\143", "\163\145\161", "\160\141\162", "\142\162\145\141\153", -"\143\157\156\164\151\156\165\145", "\144\145\154\145\164\145", "\145\154\163\145", "\146\157\162", -"\146\165\156\143\164\151\157\156", "\146\165\156\143\164\151\157\156\52", "\151\146", "\151\156", "\157\146", -"\145\141\143\150", "\156\145\167", "\162\145\164\165\162\156", "\171\151\145\154\144", -"\164\150\151\163", "\164\171\160\145\157\146", "\166\141\162", "\166\157\151\144", -"\167\150\151\154\145", "\167\151\164\150", "\143\141\163\145", "\143\141\164\143\150", -"\143\154\141\163\163", "\143\157\156\163\164", "\144\145\142\165\147\147\145\162", -"\144\145\146\141\165\154\164", "\144\157", "\145\156\165\155", "\145\170\164\145\156\144\163", -"\146\151\156\141\154\154\171", "\151\155\160\157\162\164", "\163\165\160\145\162", -"\163\167\151\164\143\150", "\164\150\162\157\167", "\164\162\171", "\75\76", "\173", "\175", "\50", -"\51", "\133", "\135", "\56", "\73", "\54", "\74", "\76", "\74\75", "\76\75", -"\75\75", "\41\75", "\176\75", "\75\75\75", "\41\75\75", "\53", "\55", "\52", "\45", -"\53\53", "\55\55", "\74\74", "\76\76", "\76\76\76", "\46", "\174", "\136", "\41", -"\176", "\46\46", "\174\174", "\77", "\72\72", "\72", "\75", "\53\75", "\55\75", -"\52\75", "\45\75", "\74\74\75", "\76\76\75", "\76\76\76\75", "\46\75", "\174\75", -"\136\75", "\151\156\163\164\141\156\143\145\157\146", null, null, null, null, null, null, -null, "\156\165\154\154", null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, "\57\75", "\57", null, null, }; -protected Token jjFillToken() -{ - final Token t; - final String curTokenImage; - final int beginLine; - final int endLine; - final int beginColumn; - final int endColumn; - if (jjmatchedPos < 0) - { - if (image == null) - curTokenImage = ""; - else - curTokenImage = image.toString(); - beginLine = endLine = input_stream.getEndLine(); - beginColumn = endColumn = input_stream.getEndColumn(); - } - else - { - String im = jjstrLiteralImages[jjmatchedKind]; - curTokenImage = (im == null) ? input_stream.GetImage() : im; - beginLine = input_stream.getBeginLine(); - beginColumn = input_stream.getBeginColumn(); - endLine = input_stream.getEndLine(); - endColumn = input_stream.getEndColumn(); - } - t = Token.newToken(jjmatchedKind, curTokenImage); - - t.beginLine = beginLine; - t.endLine = endLine; - t.beginColumn = beginColumn; - t.endColumn = endColumn; - - return t; -} -static final int[] jjnextStates = { - 84, 85, 87, 83, 97, 62, 72, 28, 29, 31, 16, 17, 19, 110, 99, 111, - 104, 112, 99, 104, 107, 65, 69, 5, 6, 18, 20, 23, 30, 32, 35, 44, - 45, 47, 52, 56, 90, 94, 102, 103, 105, 106, 50, 51, 88, 89, 0, 1, - 3, 60, 70, 29, 30, 32, 17, 18, 20, 86, 75, 87, 80, 88, 75, 80, - 83, 63, 67, 19, 21, 24, 31, 33, 36, 42, 43, 45, 50, 54, 78, 79, - 81, 82, 48, 49, -}; -private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) -{ - switch(hiByte) - { - case 0: - return ((jjbitVec0[i2] & l2) != 0L); - default : - return false; - } -} -private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) -{ - switch(hiByte) - { - case 32: - return ((jjbitVec1[i2] & l2) != 0L); - default : - return false; - } -} -private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2) -{ - switch(hiByte) - { - case 0: - return ((jjbitVec4[i2] & l2) != 0L); - case 32: - return ((jjbitVec5[i2] & l2) != 0L); - default : - if ((jjbitVec2[i1] & l1) != 0L) - return true; - return false; - } -} -private static final boolean jjCanMove_3(int hiByte, int i1, int i2, long l1, long l2) -{ - switch(hiByte) - { - case 0: - return ((jjbitVec4[i2] & l2) != 0L); - default : - if ((jjbitVec6[i1] & l1) != 0L) - return true; - return false; - } -} -private static final boolean jjCanMove_4(int hiByte, int i1, int i2, long l1, long l2) -{ - switch(hiByte) - { - case 0: - return ((jjbitVec10[i2] & l2) != 0L); - case 2: - return ((jjbitVec11[i2] & l2) != 0L); - case 3: - return ((jjbitVec12[i2] & l2) != 0L); - case 4: - return ((jjbitVec13[i2] & l2) != 0L); - case 5: - return ((jjbitVec14[i2] & l2) != 0L); - case 6: - return ((jjbitVec15[i2] & l2) != 0L); - case 7: - return ((jjbitVec16[i2] & l2) != 0L); - case 9: - return ((jjbitVec17[i2] & l2) != 0L); - case 10: - return ((jjbitVec18[i2] & l2) != 0L); - case 11: - return ((jjbitVec19[i2] & l2) != 0L); - case 12: - return ((jjbitVec20[i2] & l2) != 0L); - case 13: - return ((jjbitVec21[i2] & l2) != 0L); - case 14: - return ((jjbitVec22[i2] & l2) != 0L); - case 15: - return ((jjbitVec23[i2] & l2) != 0L); - case 16: - return ((jjbitVec24[i2] & l2) != 0L); - case 17: - return ((jjbitVec25[i2] & l2) != 0L); - case 18: - return ((jjbitVec26[i2] & l2) != 0L); - case 19: - return ((jjbitVec27[i2] & l2) != 0L); - case 20: - return ((jjbitVec6[i2] & l2) != 0L); - case 22: - return ((jjbitVec28[i2] & l2) != 0L); - case 23: - return ((jjbitVec29[i2] & l2) != 0L); - case 24: - return ((jjbitVec30[i2] & l2) != 0L); - case 25: - return ((jjbitVec31[i2] & l2) != 0L); - case 26: - return ((jjbitVec32[i2] & l2) != 0L); - case 29: - return ((jjbitVec33[i2] & l2) != 0L); - case 30: - return ((jjbitVec34[i2] & l2) != 0L); - case 31: - return ((jjbitVec35[i2] & l2) != 0L); - case 32: - return ((jjbitVec36[i2] & l2) != 0L); - case 33: - return ((jjbitVec37[i2] & l2) != 0L); - case 48: - return ((jjbitVec38[i2] & l2) != 0L); - case 49: - return ((jjbitVec39[i2] & l2) != 0L); - case 77: - return ((jjbitVec40[i2] & l2) != 0L); - case 159: - return ((jjbitVec41[i2] & l2) != 0L); - case 164: - return ((jjbitVec42[i2] & l2) != 0L); - case 168: - return ((jjbitVec43[i2] & l2) != 0L); - case 215: - return ((jjbitVec44[i2] & l2) != 0L); - case 250: - return ((jjbitVec45[i2] & l2) != 0L); - case 251: - return ((jjbitVec46[i2] & l2) != 0L); - case 253: - return ((jjbitVec47[i2] & l2) != 0L); - case 254: - return ((jjbitVec48[i2] & l2) != 0L); - case 255: - return ((jjbitVec49[i2] & l2) != 0L); - default : - if ((jjbitVec8[i1] & l1) != 0L) - if ((jjbitVec9[i2] & l2) == 0L) - return false; - else - return true; - if ((jjbitVec7[i1] & l1) != 0L) - return true; - return false; - } -} -private static final boolean jjCanMove_5(int hiByte, int i1, int i2, long l1, long l2) -{ - switch(hiByte) - { - case 0: - return ((jjbitVec10[i2] & l2) != 0L); - case 2: - return ((jjbitVec11[i2] & l2) != 0L); - case 3: - return ((jjbitVec50[i2] & l2) != 0L); - case 4: - return ((jjbitVec51[i2] & l2) != 0L); - case 5: - return ((jjbitVec52[i2] & l2) != 0L); - case 6: - return ((jjbitVec53[i2] & l2) != 0L); - case 7: - return ((jjbitVec54[i2] & l2) != 0L); - case 9: - return ((jjbitVec55[i2] & l2) != 0L); - case 10: - return ((jjbitVec56[i2] & l2) != 0L); - case 11: - return ((jjbitVec57[i2] & l2) != 0L); - case 12: - return ((jjbitVec58[i2] & l2) != 0L); - case 13: - return ((jjbitVec59[i2] & l2) != 0L); - case 14: - return ((jjbitVec60[i2] & l2) != 0L); - case 15: - return ((jjbitVec61[i2] & l2) != 0L); - case 16: - return ((jjbitVec62[i2] & l2) != 0L); - case 17: - return ((jjbitVec25[i2] & l2) != 0L); - case 18: - return ((jjbitVec26[i2] & l2) != 0L); - case 19: - return ((jjbitVec63[i2] & l2) != 0L); - case 20: - return ((jjbitVec6[i2] & l2) != 0L); - case 22: - return ((jjbitVec28[i2] & l2) != 0L); - case 23: - return ((jjbitVec64[i2] & l2) != 0L); - case 24: - return ((jjbitVec65[i2] & l2) != 0L); - case 30: - return ((jjbitVec34[i2] & l2) != 0L); - case 31: - return ((jjbitVec35[i2] & l2) != 0L); - case 32: - return ((jjbitVec66[i2] & l2) != 0L); - case 33: - return ((jjbitVec37[i2] & l2) != 0L); - case 48: - return ((jjbitVec67[i2] & l2) != 0L); - case 49: - return ((jjbitVec39[i2] & l2) != 0L); - case 77: - return ((jjbitVec40[i2] & l2) != 0L); - case 159: - return ((jjbitVec41[i2] & l2) != 0L); - case 164: - return ((jjbitVec42[i2] & l2) != 0L); - case 215: - return ((jjbitVec44[i2] & l2) != 0L); - case 250: - return ((jjbitVec45[i2] & l2) != 0L); - case 251: - return ((jjbitVec68[i2] & l2) != 0L); - case 253: - return ((jjbitVec47[i2] & l2) != 0L); - case 254: - return ((jjbitVec69[i2] & l2) != 0L); - case 255: - return ((jjbitVec70[i2] & l2) != 0L); - default : - if ((jjbitVec8[i1] & l1) != 0L) - if ((jjbitVec9[i2] & l2) == 0L) - return false; - else - return true; - if ((jjbitVec7[i1] & l1) != 0L) - return true; - return false; - } -} -private static final boolean jjCanMove_6(int hiByte, int i1, int i2, long l1, long l2) -{ - switch(hiByte) - { - case 3: - return ((jjbitVec71[i2] & l2) != 0L); - case 4: - return ((jjbitVec72[i2] & l2) != 0L); - case 5: - return ((jjbitVec73[i2] & l2) != 0L); - case 6: - return ((jjbitVec74[i2] & l2) != 0L); - case 7: - return ((jjbitVec75[i2] & l2) != 0L); - case 9: - return ((jjbitVec76[i2] & l2) != 0L); - case 10: - return ((jjbitVec77[i2] & l2) != 0L); - case 11: - return ((jjbitVec78[i2] & l2) != 0L); - case 12: - return ((jjbitVec79[i2] & l2) != 0L); - case 13: - return ((jjbitVec80[i2] & l2) != 0L); - case 14: - return ((jjbitVec81[i2] & l2) != 0L); - case 15: - return ((jjbitVec82[i2] & l2) != 0L); - case 16: - return ((jjbitVec83[i2] & l2) != 0L); - case 23: - return ((jjbitVec84[i2] & l2) != 0L); - case 24: - return ((jjbitVec85[i2] & l2) != 0L); - case 25: - return ((jjbitVec31[i2] & l2) != 0L); - case 26: - return ((jjbitVec32[i2] & l2) != 0L); - case 29: - return ((jjbitVec33[i2] & l2) != 0L); - case 32: - return ((jjbitVec86[i2] & l2) != 0L); - case 48: - return ((jjbitVec87[i2] & l2) != 0L); - case 168: - return ((jjbitVec43[i2] & l2) != 0L); - case 251: - return ((jjbitVec88[i2] & l2) != 0L); - case 254: - return ((jjbitVec89[i2] & l2) != 0L); - default : - return false; - } -} -private static final boolean jjCanMove_7(int hiByte, int i1, int i2, long l1, long l2) -{ - switch(hiByte) - { - case 9: - return ((jjbitVec90[i2] & l2) != 0L); - case 10: - return ((jjbitVec91[i2] & l2) != 0L); - case 11: - return ((jjbitVec92[i2] & l2) != 0L); - case 12: - return ((jjbitVec93[i2] & l2) != 0L); - case 13: - return ((jjbitVec94[i2] & l2) != 0L); - case 15: - return ((jjbitVec95[i2] & l2) != 0L); - case 16: - return ((jjbitVec96[i2] & l2) != 0L); - case 23: - return ((jjbitVec97[i2] & l2) != 0L); - case 25: - return ((jjbitVec31[i2] & l2) != 0L); - case 26: - return ((jjbitVec32[i2] & l2) != 0L); - case 29: - return ((jjbitVec33[i2] & l2) != 0L); - case 168: - return ((jjbitVec43[i2] & l2) != 0L); - default : - return false; - } -} -private static final boolean jjCanMove_8(int hiByte, int i1, int i2, long l1, long l2) -{ - switch(hiByte) - { - case 3: - return ((jjbitVec71[i2] & l2) != 0L); - case 4: - return ((jjbitVec72[i2] & l2) != 0L); - case 5: - return ((jjbitVec73[i2] & l2) != 0L); - case 6: - return ((jjbitVec74[i2] & l2) != 0L); - case 7: - return ((jjbitVec75[i2] & l2) != 0L); - case 9: - return ((jjbitVec76[i2] & l2) != 0L); - case 10: - return ((jjbitVec98[i2] & l2) != 0L); - case 11: - return ((jjbitVec78[i2] & l2) != 0L); - case 12: - return ((jjbitVec79[i2] & l2) != 0L); - case 13: - return ((jjbitVec80[i2] & l2) != 0L); - case 14: - return ((jjbitVec81[i2] & l2) != 0L); - case 15: - return ((jjbitVec82[i2] & l2) != 0L); - case 16: - return ((jjbitVec83[i2] & l2) != 0L); - case 23: - return ((jjbitVec84[i2] & l2) != 0L); - case 24: - return ((jjbitVec85[i2] & l2) != 0L); - case 32: - return ((jjbitVec86[i2] & l2) != 0L); - case 48: - return ((jjbitVec87[i2] & l2) != 0L); - case 251: - return ((jjbitVec88[i2] & l2) != 0L); - case 254: - return ((jjbitVec89[i2] & l2) != 0L); - default : - return false; - } -} -private static final boolean jjCanMove_9(int hiByte, int i1, int i2, long l1, long l2) -{ - switch(hiByte) - { - case 6: - return ((jjbitVec103[i2] & l2) != 0L); - case 11: - return ((jjbitVec104[i2] & l2) != 0L); - case 13: - return ((jjbitVec105[i2] & l2) != 0L); - case 14: - return ((jjbitVec106[i2] & l2) != 0L); - case 15: - return ((jjbitVec107[i2] & l2) != 0L); - case 16: - return ((jjbitVec108[i2] & l2) != 0L); - case 19: - return ((jjbitVec109[i2] & l2) != 0L); - case 23: - return ((jjbitVec110[i2] & l2) != 0L); - default : - if ((jjbitVec101[i1] & l1) != 0L) - if ((jjbitVec102[i2] & l2) == 0L) - return false; - else - return true; - if ((jjbitVec99[i1] & l1) != 0L) - if ((jjbitVec100[i2] & l2) == 0L) - return false; - else - return true; - return false; - } -} -private static final boolean jjCanMove_10(int hiByte, int i1, int i2, long l1, long l2) -{ - switch(hiByte) - { - case 32: - return ((jjbitVec111[i2] & l2) != 0L); - case 48: - return ((jjbitVec112[i2] & l2) != 0L); - case 254: - return ((jjbitVec113[i2] & l2) != 0L); - case 255: - return ((jjbitVec114[i2] & l2) != 0L); - default : - return false; - } -} - -int curLexState = 0; -int defaultLexState = 0; -int jjnewStateCnt; -int jjround; -int jjmatchedPos; -int jjmatchedKind; - -/** Get the next Token. */ -public Token getNextToken() -{ - Token specialToken = null; - Token matchedToken; - int curPos = 0; - - EOFLoop : - for (;;) - { - try - { - curChar = input_stream.BeginToken(); - } - catch(Exception e) - { - jjmatchedKind = 0; - jjmatchedPos = -1; - matchedToken = jjFillToken(); - matchedToken.specialToken = specialToken; - return matchedToken; - } - image = jjimage; - image.setLength(0); - jjimageLen = 0; - - for (;;) - { - switch(curLexState) - { - case 0: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_0(); - break; - case 1: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_1(); - break; - case 2: - jjmatchedKind = 15; - jjmatchedPos = -1; - curPos = 0; - curPos = jjMoveStringLiteralDfa0_2(); - if (jjmatchedPos < 0 || (jjmatchedPos == 0 && jjmatchedKind > 17)) - { - jjmatchedKind = 17; - jjmatchedPos = 0; - } - break; - case 3: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_3(); - if (jjmatchedPos == 0 && jjmatchedKind > 17) - { - jjmatchedKind = 17; - } - break; - case 4: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_4(); - if (jjmatchedPos == 0 && jjmatchedKind > 17) - { - jjmatchedKind = 17; - } - break; - } - if (jjmatchedKind != 0x7fffffff) - { - if (jjmatchedPos + 1 < curPos) - input_stream.backup(curPos - jjmatchedPos - 1); - if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) - { - matchedToken = jjFillToken(); - matchedToken.specialToken = specialToken; - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - return matchedToken; - } - else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) - { - if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) - { - matchedToken = jjFillToken(); - if (specialToken == null) - specialToken = matchedToken; - else - { - matchedToken.specialToken = specialToken; - specialToken = (specialToken.next = matchedToken); - } - SkipLexicalActions(matchedToken); - } - else - SkipLexicalActions(null); - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - continue EOFLoop; - } - jjimageLen += jjmatchedPos + 1; - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - curPos = 0; - jjmatchedKind = 0x7fffffff; - try { - curChar = input_stream.readChar(); - continue; - } - catch (java.io.IOException e1) { } - } - int error_line = input_stream.getEndLine(); - int error_column = input_stream.getEndColumn(); - String error_after = null; - boolean EOFSeen = false; - try { input_stream.readChar(); input_stream.backup(1); } - catch (java.io.IOException e1) { - EOFSeen = true; - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - if (curChar == '\n' || curChar == '\r') { - error_line++; - error_column = 0; - } - else - error_column++; - } - if (!EOFSeen) { - input_stream.backup(1); - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - } - throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); - } - } -} - -void SkipLexicalActions(Token matchedToken) -{ - switch(jjmatchedKind) - { - default : - break; - } -} -void MoreLexicalActions() -{ - jjimageLen += (lengthOfMatch = jjmatchedPos + 1); - switch(jjmatchedKind) - { - default : - break; - } -} -void TokenLexicalActions(Token matchedToken) -{ - switch(jjmatchedKind) - { - default : - break; - } -} -private void jjCheckNAdd(int state) -{ - if (jjrounds[state] != jjround) - { - jjstateSet[jjnewStateCnt++] = state; - jjrounds[state] = jjround; - } -} -private void jjAddStates(int start, int end) -{ - do { - jjstateSet[jjnewStateCnt++] = jjnextStates[start]; - } while (start++ != end); -} -private void jjCheckNAddTwoStates(int state1, int state2) -{ - jjCheckNAdd(state1); - jjCheckNAdd(state2); -} - -private void jjCheckNAddStates(int start, int end) -{ - do { - jjCheckNAdd(jjnextStates[start]); - } while (start++ != end); -} - - /** Constructor. */ - public LARAEcmaScriptTokenManager(JavaCharStream stream){ - - if (JavaCharStream.staticFlag) - throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); - - input_stream = stream; - } - - /** Constructor. */ - public LARAEcmaScriptTokenManager (JavaCharStream stream, int lexState){ - ReInit(stream); - SwitchTo(lexState); - } - - /** Reinitialise parser. */ - - public void ReInit(JavaCharStream stream) - { - - - jjmatchedPos = - jjnewStateCnt = - 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); - } - - private void ReInitRounds() - { - int i; - jjround = 0x80000001; - for (i = 119; i-- > 0;) - jjrounds[i] = 0x80000000; - } - - /** Reinitialise parser. */ - public void ReInit(JavaCharStream stream, int lexState) - - { - ReInit(stream); - SwitchTo(lexState); - } - - /** Switch to specified lex state. */ - public void SwitchTo(int lexState) - { - if (lexState >= 5 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else - curLexState = lexState; - } - - -/** Lexer state names. */ -public static final String[] lexStateNames = { - "DEFAULT", - "IN_REGEX", - "IN_SINGLE_LINE_COMMENT", - "IN_MULTI_LINE_COMMENT", - "IN_PATTERN", -}; - -/** Lex State array. */ -public static final int[] jjnewLexState = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 0, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 1, -1, -}; -static final long[] jjtoToken = { - 0xfffffffffffc0001L, 0xffffffffffffffffL, 0x3fe03c03f9fL, -}; -static final long[] jjtoSkip = { - 0x18102L, 0x0L, 0x0L, -}; -static final long[] jjtoSpecial = { - 0x18000L, 0x0L, 0x0L, -}; -static final long[] jjtoMore = { - 0x26000L, 0x0L, 0x100000000L, -}; - protected JavaCharStream input_stream; - - private final int[] jjrounds = new int[119]; - private final int[] jjstateSet = new int[2 * 119]; - private final StringBuilder jjimage = new StringBuilder(); - private StringBuilder image = jjimage; - private int jjimageLen; - private int lengthOfMatch; - protected int curChar; -} diff --git a/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScriptTreeConstants.java b/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScriptTreeConstants.java deleted file mode 100644 index 00201ea56..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/LARAEcmaScriptTreeConstants.java +++ /dev/null @@ -1,203 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. LARAEcmaScriptTreeConstants.java Version 7.0.12 */ -package org.dojo.jsl.parser.ast; - -public interface LARAEcmaScriptTreeConstants -{ - public int JJTVOID = 0; - public int JJTIDENTIFIER = 1; - public int JJTSTART = 2; - public int JJTASSIGNMENTEXPRESSION = 3; - public int JJTIMPORT = 4; - public int JJTFILEPATH = 5; - public int JJTCODEDEF = 6; - public int JJTFORMALPARAMETERLIST = 7; - public int JJTINPUT = 8; - public int JJTOUTPUT = 9; - public int JJTSTATIC = 10; - public int JJTINITIALIZE = 11; - public int JJTFINALIZE = 12; - public int JJTCHECK = 13; - public int JJTASPECTDEF = 14; - public int JJTSELECT = 15; - public int JJTJOIN = 16; - public int JJTPOINTCUT = 17; - public int JJTORFILTERSEXPR = 18; - public int JJTPOINTCUTFILTERS = 19; - public int JJTANDFILTERSEXPR = 20; - public int JJTFILTER = 21; - public int JJTAROUNDAPPLY = 22; - public int JJTAPPLIES = 23; - public int JJTAPPLY = 24; - public int JJTTO = 25; - public int JJTACTION = 26; - public int JJTCOMPOSITEREFERENCE = 27; - public int JJTCALL = 28; - public int JJTRUN = 29; - public int JJTCMD = 30; - public int JJTINSERT = 31; - public int JJTPERFORM = 32; - public int JJTFUNCTIONCALLPARAMETERS = 33; - public int JJTOUTPUTACT = 34; - public int JJTDEFINE = 35; - public int JJTCONDITION = 36; - public int JJTFOR = 37; - public int JJTTHISREFERENCE = 38; - public int JJTPARENEXPRESSION = 39; - public int JJTLITERAL = 40; - public int JJTARRAYLITERAL = 41; - public int JJTEMPTYPOSITIONS = 42; - public int JJTOBJECTLITERAL = 43; - public int JJTLITERALFIELD = 44; - public int JJTALLOCATIONEXPRESSION = 45; - public int JJTPROPERTYVALUEREFERENCE = 46; - public int JJTPROPERTYIDENTIFIERREFERENCE = 47; - public int JJTNAMEDARGUMENT = 48; - public int JJTPOSTFIXEXPRESSION = 49; - public int JJTOPERATOR = 50; - public int JJTUNARYEXPRESSION = 51; - public int JJTBINARYEXPRESSIONSEQUENCE = 52; - public int JJTANDEXPRESSIONSEQUENCE = 53; - public int JJTOREXPRESSIONSEQUENCE = 54; - public int JJTCONDITIONALEXPRESSION = 55; - public int JJTEXPRESSIONLIST = 56; - public int JJTBLOCK = 57; - public int JJTSTATEMENTLIST = 58; - public int JJTVARIABLESTATEMENT = 59; - public int JJTVARIABLEDECLARATIONLIST = 60; - public int JJTVARIABLEDECLARATION = 61; - public int JJTEMPTYEXPRESSION = 62; - public int JJTEMPTYSTATEMENT = 63; - public int JJTEXPRESSIONSTATEMENT = 64; - public int JJTIFSTATEMENT = 65; - public int JJTDOSTATEMENT = 66; - public int JJTWHILESTATEMENT = 67; - public int JJTFORVARINSTATEMENT = 68; - public int JJTFORINSTATEMENT = 69; - public int JJTPREASSIGNMENTLIST = 70; - public int JJTFORCONDITIONLIST = 71; - public int JJTPOSTASSIGNMENTLIST = 72; - public int JJTFORSTATEMENT = 73; - public int JJTFORVARSTATEMENT = 74; - public int JJTCONTINUESTATEMENT = 75; - public int JJTBREAKSTATEMENT = 76; - public int JJTRETURNSTATEMENT = 77; - public int JJTYIELDSTATEMENT = 78; - public int JJTYIELDSTAR = 79; - public int JJTWITHSTATEMENT = 80; - public int JJTSWITCHSTATEMENT = 81; - public int JJTCASEGROUPS = 82; - public int JJTCASEGROUP = 83; - public int JJTCASEGUARD = 84; - public int JJTLABELLEDSTATEMENT = 85; - public int JJTTHROWSTATEMENT = 86; - public int JJTTRYSTATEMENT = 87; - public int JJTCATCHCLAUSE = 88; - public int JJTFINALLYCLAUSE = 89; - public int JJTFUNCTIONDECLARATION = 90; - public int JJTGENERATORFUNCTIONDECLARATION = 91; - public int JJTARROWFUNCTIONEXPRESSION = 92; - public int JJTFUNCTIONEXPRESSION = 93; - public int JJTGENERATORFUNCTIONEXPRESSION = 94; - public int JJTJAVASCRIPT = 95; - - - public String[] jjtNodeName = { - "void", - "Identifier", - "Start", - "AssignmentExpression", - "Import", - "FilePath", - "CodeDef", - "FormalParameterList", - "Input", - "Output", - "Static", - "Initialize", - "Finalize", - "Check", - "AspectDef", - "Select", - "Join", - "Pointcut", - "OrFiltersExpr", - "PointcutFilters", - "ANDFiltersExpr", - "Filter", - "AroundApply", - "Applies", - "Apply", - "To", - "Action", - "CompositeReference", - "Call", - "Run", - "Cmd", - "Insert", - "Perform", - "FunctionCallParameters", - "OutputAct", - "Define", - "Condition", - "For", - "ThisReference", - "ParenExpression", - "Literal", - "ArrayLiteral", - "EmptyPositions", - "ObjectLiteral", - "LiteralField", - "AllocationExpression", - "PropertyValueReference", - "PropertyIdentifierReference", - "NamedArgument", - "PostfixExpression", - "Operator", - "UnaryExpression", - "BinaryExpressionSequence", - "AndExpressionSequence", - "OrExpressionSequence", - "ConditionalExpression", - "ExpressionList", - "Block", - "StatementList", - "VariableStatement", - "VariableDeclarationList", - "VariableDeclaration", - "EmptyExpression", - "EmptyStatement", - "ExpressionStatement", - "IfStatement", - "DoStatement", - "WhileStatement", - "ForVarInStatement", - "ForInStatement", - "PreAssignmentList", - "ForConditionList", - "PostAssignmentList", - "ForStatement", - "ForVarStatement", - "ContinueStatement", - "BreakStatement", - "ReturnStatement", - "YieldStatement", - "YieldStar", - "WithStatement", - "SwitchStatement", - "CaseGroups", - "CaseGroup", - "CaseGuard", - "LabelledStatement", - "ThrowStatement", - "TryStatement", - "CatchClause", - "FinallyClause", - "FunctionDeclaration", - "GeneratorFunctionDeclaration", - "ArrowFunctionExpression", - "FunctionExpression", - "GeneratorFunctionExpression", - "JavaScript", - }; -} -/* JavaCC - OriginalChecksum=b7cc01a355f87089dd5cd6deabc99a95 (do not edit this line) */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/LARAParserBase.java b/LARAC/src/org/dojo/jsl/parser/ast/LARAParserBase.java deleted file mode 100644 index 5a1ff78c0..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/LARAParserBase.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright 2015 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.dojo.jsl.parser.ast; - -import java.util.Stack; - -public class LARAParserBase implements LARAEcmaScriptTreeConstants, - LARAEcmaScriptConstants { - - Stack nodeStack = new Stack<>(); - - // ArrayList functions = new ArrayList(); - // ArrayList variables = new ArrayList(); - - protected void jjtreeOpenNodeScope(SimpleNode astNode) { - nodeStack.push(astNode); - } - - protected void jjtreeCloseNodeScope(SimpleNode astNode) { - if (nodeStack.size() > 0) { - nodeStack.pop(); - } - - // if (astNode instanceof ASTFunctionDef) - // addFunction((ASTFunctionDef) astNode); - // else if (astNode instanceof ASTPoint) - // addVariable(astNode); - } - - protected SimpleNode getCurrentNode() { - if (nodeStack.size() > 0) { - return nodeStack.peek(); - } - return null; - } - - // void addFunction(ASTFunctionDef function) - // { - // functions.add(function); - // } - // - // public ArrayList getFunctions() - // { - // return functions; - // } - // - // void addVariable (SimpleNode varNode) - // { - // variables.add(varNode); - // } - // - // public ArrayList getVriables() - // { - // return variables; - // } -} diff --git a/LARAC/src/org/dojo/jsl/parser/ast/Node.java b/LARAC/src/org/dojo/jsl/parser/ast/Node.java deleted file mode 100644 index c06f68d62..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/Node.java +++ /dev/null @@ -1,38 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. Node.java Version 7.0 */ -/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=true,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ -package org.dojo.jsl.parser.ast; - -/* All AST nodes must implement this interface. It provides basic - machinery for constructing the parent and child relationships - between nodes. */ - -public -interface Node { - - /** This method is called after the node has been made the current - node. It indicates that child nodes can now be added to it. */ - public void jjtOpen(); - - /** This method is called after all the child nodes have been - added. */ - public void jjtClose(); - - /** This pair of methods are used to inform the node of its - parent. */ - public void jjtSetParent(Node n); - public Node jjtGetParent(); - - /** This method tells the node to add its argument to the node's - list of children. */ - public void jjtAddChild(Node n, int i); - - /** This method returns a child node. The children are numbered - from zero, left to right. */ - public Node jjtGetChild(int i); - - /** Return the number of children the node has. */ - public int jjtGetNumChildren(); - - public int getId(); -} -/* JavaCC - OriginalChecksum=b35e9d784b187d71d84b7438426a3c21 (do not edit this line) */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/ParseException.java b/LARAC/src/org/dojo/jsl/parser/ast/ParseException.java deleted file mode 100644 index 719cd5bfe..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/ParseException.java +++ /dev/null @@ -1,213 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ -/* JavaCCOptions:KEEP_LINE_COL=null */ -package org.dojo.jsl.parser.ast; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.function.Function; - -import tdrc.utils.StringUtils; - -/** - * This exception is thrown when parse errors are encountered. You can explicitly create objects of this exception type - * by calling the method generateParseException in the generated parser. - * - * You can modify this class to customize your error reporting mechanisms so long as you retain the public fields. - */ -@SuppressWarnings("all") -public class ParseException extends Exception { - - /** - * The version identifier for this Serializable class. Increment only if the serialized form of the class - * changes. - */ - private static final long serialVersionUID = 1L; - - /** - * This constructor is used by the method "generateParseException" in the generated parser. Calling this constructor - * generates a new object of this type with the fields "currentToken", "expectedTokenSequences", and "tokenImage" - * set. - */ - public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal) { - super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); - currentToken = currentTokenVal; - expectedTokenSequences = expectedTokenSequencesVal; - tokenImage = tokenImageVal; - nextToken = currentTokenVal.next; - errorMessage = getMessage().substring(getMessage().indexOf(":") + 1); - expectedTokenSet = buildSequenceList(expectedTokenSequences, tokenImage); - } - - private static List buildSequenceList(int[][] expectedTokenSequences, String[] tokenImage) { - // this.expectedTokenSet = new HashSet<>(); - List tokens = new ArrayList<>(); - for (int i = 0; i < expectedTokenSequences.length; i++) { - for (int j = 0; j < expectedTokenSequences[i].length; j++) { - String token = (tokenImage[expectedTokenSequences[i][j]]); - if (!tokens.contains(token)) { - tokens.add(token); - } - } - } - String semiColon = tokenImage[LARAEcmaScriptConstants.SEMICOLON]; - if (tokens.contains(semiColon)) { - Collections.rotate(tokens.subList(0, tokens.indexOf(semiColon) + 1), 1); - } - return tokens; - } - - /** - * The following constructors are for use by you for whatever purpose you can think of. Constructing the exception - * in this manner makes the exception behave in the normal way - i.e., as documented in the class "Throwable". The - * fields "errorToken", "expectedTokenSequences", and "tokenImage" do not contain relevant information. The JavaCC - * generated code does not use these constructors. - */ - - public ParseException() { - super(); - } - - /** Constructor with message. */ - public ParseException(String message) { - super(message); - } - - /** - * This is the last token that has been consumed successfully. If this object has been created due to a parse error, - * the token followng this token will (therefore) be the first error token. - */ - public Token currentToken; - private Token nextToken; - private String errorMessage; - - /** - * Each entry in this array is an array of integers. Each array of integers represents a sequence of tokens (by - * their ordinal values) that is expected at this point of the parse. - */ - public int[][] expectedTokenSequences; - public List expectedTokenSet; - - /** - * This is a reference to the "tokenImage" array of the generated parser within which the parse error occurred. This - * array is defined in the generated ...Constants interface. - */ - public String[] tokenImage; - - /** - * It uses "currentToken" and "expectedTokenSequences" to generate a parse error message and returns it. If this - * object has been created due to a parse error, and you do not catch it (it gets thrown from the parser) the - * correct error message gets displayed. - */ - private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { - String eol = System.getProperty("line.separator", "\n"); - StringBuffer expected = new StringBuffer(); - int maxSize = 0; - List expectedList = buildSequenceList(expectedTokenSequences, tokenImage); - for (int i = 0; i < expectedTokenSequences.length; i++) { - if (maxSize < expectedTokenSequences[i].length) { - maxSize = expectedTokenSequences[i].length; - } - } - // String semiColon = tokenImage[LARAEcmaScriptConstants.SEMICOLON]; - // if (expectedList.contains(semiColon)) { - // Collections.rotate(expectedList.subList(0, expectedList.indexOf(semiColon) + 1), 1); - // } - - Function quote2tick = s -> s.replace("\"", "'"); - String expectedListStr = "\n\t" + StringUtils.join(expectedList, quote2tick, "\n\t"); - expected.append(expectedListStr); - // String retval = "Parse Exception: encountered ";// token "; - Token nextToken = currentToken.next; - String retval = "at line " + nextToken.beginLine + ", column " + nextToken.beginColumn + ":"; - String errorMessage = "encountered "; - Token tok = nextToken; - for (int i = 0; i < maxSize; i++) { - - if (tok.kind == 0) { - errorMessage += tokenImage[0]; - break; - } - errorMessage += " \""; - errorMessage += add_escapes(tok.image); - errorMessage += "\""; - tok = tok.next; - } - - errorMessage += ", "; - if (expectedTokenSequences.length == 1) { - errorMessage += "was expecting: "; // + eol + " "; - } else { - errorMessage += "was expecting: "; // + eol + " "; - } - errorMessage += expected.toString(); - - return retval + errorMessage; - } - - /** - * The end of line string for this machine. - */ - protected String eol = System.getProperty("line.separator", "\n"); - - /** - * Used to convert raw characters to their escaped version when these raw version cannot be used as part of an ASCII - * string literal. - */ - static String add_escapes(String str) { - StringBuffer retval = new StringBuffer(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) { - case 0: - continue; - case '\b': - retval.append("\\b"); - continue; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u" + s.substring(s.length() - 4, s.length())); - } else { - retval.append(ch); - } - continue; - } - } - return retval.toString(); - } - - public String getErrorMessage() { - return errorMessage; - } - - public Token getNextToken() { - return nextToken; - } - -} -/* - * JavaCC - OriginalChecksum=aa856bee2d7bc1f2756879db49b0ff38 (do not edit this - * line) - */ \ No newline at end of file diff --git a/LARAC/src/org/dojo/jsl/parser/ast/SimpleNode.java b/LARAC/src/org/dojo/jsl/parser/ast/SimpleNode.java deleted file mode 100644 index 96158682f..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/SimpleNode.java +++ /dev/null @@ -1,719 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. SimpleNode.java Version 4.3 */ -/* - * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, - * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true - */ -/* - * Copyright 2013 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ -package org.dojo.jsl.parser.ast; - -import larac.LaraC; -import larac.exceptions.LARACompilerException; -import larac.exceptions.ParseExceptionData; -import larac.objects.Enums; -import larac.objects.Enums.Types; -import larac.objects.Variable; -import larac.utils.OrganizeUtils; -import org.apache.commons.lang3.StringEscapeUtils; -import org.lara.language.specification.dsl.LanguageSpecification; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import pt.up.fe.specs.util.Preconditions; -import pt.up.fe.specs.util.exceptions.NotImplementedException; -import tdrc.utils.StringUtils; - -import java.util.*; -import java.util.stream.Collectors; - -public class SimpleNode implements Node { - // protected int beginLine = -1; - // protected int endLine = -1; - // protected int beginColumn = -1; - // protected int endColumn = -1; - // public int lineNumber = 0; - protected Node parent; - protected Node[] children; - protected int id; - protected Object value; - protected String label = ""; - protected LARAEcmaScript parser; - protected boolean insertTag = true; - // private boolean coords = false; - protected boolean isTemplate = false; - protected ParseExceptionData exceptionData; - protected Token firstToken; - protected Token lastToken; - - public SimpleNode(int i) { - this(null, i); - } - - public SimpleNode(LARAEcmaScript p, int i) { - id = i; - parser = p; - } - - /////////////////////////////////////////////////////// - ////////////// Node Related Methods /////////////////// - /////////////////////////////////////////////////////// - - @Override - public void jjtOpen() { - // System.out.println("OPENING a " + LARAEcmaScriptTreeConstants.jjtNodeName[id]); - } - - @Override - public void jjtClose() { - } - - @Override - public void jjtSetParent(Node n) { - parent = n; - } - - @Override - public Node jjtGetParent() { - return parent; - } - - @Override - public void jjtAddChild(Node n, int i) { - if (getChildren() == null) { - setChildren(new Node[i + 1]); - } else if (i >= getChildren().length) { - final Node c[] = new Node[i + 1]; - System.arraycopy(getChildren(), 0, c, 0, getChildren().length); - setChildren(c); - } - getChildren()[i] = n; - } - - public void appendChildAsFirst(Node n) { - if (getChildren() == null) { - setChildren(new Node[1]); - } else { - final Node c[] = new Node[children.length + 1]; - System.arraycopy(getChildren(), 0, c, 1, getChildren().length); - setChildren(c); - } - getChildren()[0] = n; - } - - /** - * Returns a child as a {@link Node} - */ - @Override - public Node jjtGetChild(int i) { - return getChildren()[i]; - } - - /** - * Returns a child casted as {@link SimpleNode} - * - * @param i - * @return - */ - public SimpleNode getChild(int i) { - return (SimpleNode) getChildren()[i]; - } - - public T getChildAs(int i, Class cast) { - Node childI = children[i]; - Preconditions.checkArgument(cast.isInstance(childI), - "Cannot cast node of type " + LARAEcmaScriptTreeConstants.jjtNodeName[this.id] + " to " - + cast.getName()); - return cast.cast(childI); - } - - @Override - public int jjtGetNumChildren() { - return (getChildren() == null) ? 0 : getChildren().length; - } - - /** - * @param children the children to set - */ - public void setChildren(Node[] children) { - this.children = children; - } - - /** - * @return the children - */ - public Node[] getChildren() { - return children; - } - - /** - * @return the children - */ - public List getSimpleNodeChildren() { - return Arrays.asList(children).stream().map(n -> (SimpleNode) n).collect(Collectors.toList()); - } - - public void jjtSetValue(Object value) { - this.value = value; - } - - public Object jjtGetValue() { - return value; - } - - /* - * You can override these two methods in subclasses of SimpleNode to - * customize the way the node appears when the tree is dumped. If your - * output uses more than one line you should override toString(String), - * otherwise overriding toString() is probably all you need to do. - */ - - @Override - public String toString() { - return LARAEcmaScriptTreeConstants.jjtNodeName[id] + (value != null ? " [" + value + "]" : ""); - } - - public String toString(String prefix) { - return prefix + toString(); - } - - /* - * Override this method if you want to customize how the node dumps out its - * children. - */ - - public void dump(String prefix) { - LaraC lara = getLara(); - String string = toString(prefix); - // Token specialToken = jjtGetFirstToken().specialToken; - // if (specialToken != null) { - // string += " special: " + specialToken.image; - // } - if (lara == null) { - System.out.println(string); - } else { - lara.println(string); - } - if (getChildren() != null) { - for (int i = 0; i < getChildren().length; ++i) { - final SimpleNode n = (SimpleNode) getChildren()[i]; - if (n != null) { - n.dump(prefix + " "); - } - } - } - } - - public String dumpToString(String prefix) { - String out = toString(prefix) + "\n"; - if (getChildren() != null) { - for (int i = 0; i < getChildren().length; ++i) { - final SimpleNode n = (SimpleNode) getChildren()[i]; - if (n != null) { - out += n.dumpToString(prefix + "\t"); - } - } - } - return out; - } - - public void associateChild(SimpleNode child, int i) { - jjtAddChild(child, i); - child.parent = this; - } - - public LaraC getLara() { - if (parent == null) { - return null; - } - return ((SimpleNode) parent).getLara(); - } - - protected SimpleNode getParentById(int id) { - if (this.id == id) { - return this; - } - if (parent != null) { - return ((SimpleNode) parent).getParentById(id); - } - return null; - } - - public RuntimeException newException(String error) { - // if (beginColumn != -1) { - // String message = "in line " + beginLine + ", column " + beginColumn + ": " + error; - // return new LARACompilerException(message); - // } - String message = "in line " + jjtGetFirstToken().beginLine + ", column " + jjtGetFirstToken().beginColumn + ": " - + error; - return new LARACompilerException(message); - - // if (parent != null) { - // return ((SimpleNode) parent).newException(error); - // } - // - // return new LARACompilerException(error); - // throw new LaraException(error); - } - - public ParseExceptionData getExceptionData() { - return exceptionData; - } - - public void setExceptionData(ParseExceptionData exceptionData) { - this.exceptionData = exceptionData; - } - - public Token jjtGetFirstToken() { - return firstToken; - } - - public void jjtSetFirstToken(Token token) { - firstToken = token; - } - - public Token jjtGetLastToken() { - return lastToken; - } - - public void jjtSetLastToken(Token token) { - lastToken = token; - } - - protected ASTAspectDef getAspectDefForDeclStmt(String typeOfStatement) { - return getAncestorOfType(ASTAspectDef.class) - .orElseThrow( - () -> new LARACompilerException( - typeOfStatement + " statement can only be used inside an aspectdef")); - } - - public Optional getAncestorOfType(Class type) { - if (parent == null) { - return Optional.empty(); - } - - if (type.isInstance(parent)) { - return Optional.of(type.cast(parent)); - } - return ((SimpleNode) parent).getAncestorOfType(type); - } - - public List getDescendantsOfType(Class type) { - - if (children == null || children.length == 0) { - return Collections.emptyList(); - } - List descendants = new ArrayList<>(); - for (Node node : children) { - SimpleNode simpleNode = (SimpleNode) node; - if (type.isInstance(node)) { - descendants.add(type.cast(simpleNode)); - } - descendants.addAll(simpleNode.getDescendantsOfType(type)); - - } - - return descendants; - } - - /** - * Verifies if a node is equal or descendant of this node - * - * @param descendant - * @return - */ - public boolean isDescendant(Node descendant) { - if (equals(descendant)) { - return true; - } - if (children == null || children.length == 0) { - return false; - } - - for (Node node : children) { - SimpleNode simpleNode = (SimpleNode) node; - boolean childDescendant = simpleNode.isDescendant(descendant); - if (childDescendant) { - return true; - } - } - return false; - } - - /////////////////////////////////////////////////////// - //////////// Organize Related Methods ///////////////// - /////////////////////////////////////////////////////// - public Object organizeFirst(Object obj, int i) { - getLara().warnln( - "Organize(Object,int): Node \"" + LARAEcmaScriptTreeConstants.jjtNodeName[id] - + "\" not supported"); - return null; - } - - public Object organize(Object obj) { - getLara().warnln("Organize(Object,ASTSelect): Node \"" + LARAEcmaScriptTreeConstants.jjtNodeName[id] - + "\" not supported"); - return null; - } - - public void declareGlobal(LaraC lara) { - throw new RuntimeException("Global declaration is not supported for node type '" - + LARAEcmaScriptTreeConstants.jjtNodeName[id] + "'"); - } - - public boolean hasFilter() { - return false; - } - - public String organize(String type, LanguageSpecification langSpec) { - // getLara().warnln("Organize: Node \"" + LARAEcmaScriptTreeConstants.jjtNodeName[id] + "\" not supported"); - // return null; - throw new RuntimeException( - "Organize: Node \"" + LARAEcmaScriptTreeConstants.jjtNodeName[id] + "\" not supported"); - } - - public Types getExpressionType() { - // getLara().warnln("ExpressionType: Node - // \""+LARAEcmaScriptTreeConstants.jjtNodeName[id]+ - // "\" not supported\n"); - return Types.getDefault(); - } - - public Object organize(Object obj, Object obj2) { - getLara() - .warnln("Organize(2): Node \"" + LARAEcmaScriptTreeConstants.jjtNodeName[id] + "\" not supported"); - return null; - } - - public void secondOrganize(ASTSelect sel) { - if (children != null) { - for (final Node n : children) { - ((SimpleNode) n).secondOrganize(sel); - } - } - } - - public Variable lookup(String var) { - if (parent == null) { - getLara().warnln("Variable was not found: " + var); - return null; - } - return ((SimpleNode) parent).lookup(var); - } - - public Variable lookupNoError(String var) { - if (parent == null) { - return null; - } - return ((SimpleNode) parent).lookupNoError(var); - } - - public HashMap getHMVars() { - if (parent == null) { - throw newException("Could not found any SymbolTable for variables. Last node was: " + toString()); - } - - return ((SimpleNode) parent).getHMVars(); - } - - public Variable lookupLastJPVariable() { - getLara().warnln( - "lookupLastJPVariable: Node \"" + LARAEcmaScriptTreeConstants.jjtNodeName[id] - + "\" not supported"); - return null; - } - - protected SimpleNode lookupLabel(String label) { - if (this.label.equals(label)) { - return this; - } - if (parent != null) { - return ((SimpleNode) parent).lookupLabel(label); - } - return null; - } - - public void organizeLHS(Types type) { - getLara().warnln( - "organizeLHS(1): Node \"" + LARAEcmaScriptTreeConstants.jjtNodeName[id] + "\" not supported"); - } - - public void organizePointcutReference(ASTPointcut pc) { - } - - public void organizeActionReference(ASTPointcut pc) { - } - - public String getMethodId() { - return null; - } - - public String getVarName() { - throw newException( - "getVarName(0): Node \"" + LARAEcmaScriptTreeConstants.jjtNodeName[id] + "\" not supported"); - // return null; - } - - public void setIdVar(Variable var) { - } - - public List getCodeArguments(String code) { - final List codeParams = new ArrayList<>(OrganizeUtils.getTagValues(code)); - return codeParams; - } - - protected void verifyCodeArguments(List codeParams) { - for (final String param : codeParams) { - - // Change this to accept a[0], a[0][0][0], a(), a(0,1)... - // - // if (param.contains("[") || param.contains("(")) { - // throw newException("Complex reference using \"[ ]\" and/or \"( )\" : " + param - // + ". Only simple reference can be defined here."); - // } - if (param.startsWith("$")) { - continue; - } - if (param.contains(".")) { - if (lookup(param.substring(0, param.indexOf("."))) == null) { - throw newException("Variable '" + param.substring(0, param.indexOf(".")) + "' is undefined"); - } - - } else if (lookup(param) == null) { - throw newException("Variable '" + param + "' is undefined"); - } - } - } - - public String nodeCoords() { - final LaraC lara = getLara(); - String path = ""; - if (lara != null) { - path = lara.getLaraPath(); - } - return path + ":" + firstToken.beginLine + ":" + firstToken.beginColumn + ":" + lastToken.endLine - + ":" - + lastToken.endColumn; - } - - public String getCoords() { - return nodeCoords(); - } - - /////////////////////////////////////////////////////// - //////////// TO REMOVE //////////////// - /////////////////////////////////////////////////////// - - // public String getCoords() { - // String coords = lookDownCoords(); - // if (coords != null) { - // return coords; - // } - // coords = lookupCoords(); - // if (coords != null) { - // return coords; - // } - // final LaraC lara = getLara(); - // return lara.getLaraPath() + ":0:0:0:0"; - // } - // /** - // * Should be replace with this.firstToken and lastToken - // * - // * @param begin - // * @param end - // */ - // @Deprecated - // public void setCoord(Token begin, Token end) { - // beginLine = begin.beginLine; - // endLine = end.endLine; - // beginColumn = begin.beginColumn; - // endColumn = end.endColumn; - // setCoords(true); - // } - // /** - // * @param coords - // * the coords to set - // */ - // public void setCoords(boolean coords) { - // this.coords = coords; - // } - // - // /** - // * @return the coords - // */ - // public boolean hasCoords() { - // return coords; - // } - - // public String lookDownCoords() { - // if (hasCoords()) { - // return nodeCoords(); - // } - // if (children != null) { - // for (final Node child : children) { - // final String coords = ((SimpleNode) child).lookDownCoords(); - // if (coords != null) { - // return coords; - // } - // } - // } - // return null; - // } - // - // public String lookupCoords() { - // if (hasCoords()) { - // return nodeCoords(); - // } - // if (parent != null) { - // return ((SimpleNode) parent).lookupCoords(); - // } - // return null; - // } - - /////////////////////////////////////////////////////// - //////////// Aspect-IR Related Methods //////////////// - /////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////// - //////////// XML Related Methods ////////////////////// - /////////////////////////////////////////////////////// - - public void toXML(Document doc, Element parent) { - getLara().warnln( - "toXML(Document,Element): Node \"" + LARAEcmaScriptTreeConstants.jjtNodeName[id] - + "\" not supported"); - final Element el = doc.createElement(LARAEcmaScriptTreeConstants.jjtNodeName[id]); - if (value != null) { - el.setAttribute("value", value.toString()); - } - el.setAttribute("isSupported", "false"); - parent.appendChild(el); - } - - public void globalToXML(Document doc, Element parent) { - throw new RuntimeException("Global declaration to XML is not supported for node type '" - + LARAEcmaScriptTreeConstants.jjtNodeName[id] + "'"); - - } - - public Element getFilterElement(Document doc) { - // getLara().warnln("Get Filter Element: Node \""+LARAEcmaScriptTreeConstants.jjtNodeName[id]+"\" not - // supported"); - return null; - } - - public Element getXML(Document doc) { - return doc.createElement("getXML:NOT_DONE"); - } - - public void toXMLTemplate(Document doc, Element callEl) { - throw newException( - "When using actions, parameters of type 'template' can only be of type: \n\t-> literal string\n\t-> literal code\n\t-> codedef"); - } - - public void codeTemplateArgumentsToXML(Document doc, Element parent, List codeParams) { - for (final String param : codeParams) { - - final Element propertyKeyEl = doc.createElement("key"); - parent.appendChild(propertyKeyEl); - propertyKeyEl.setAttribute("name", Enums.SYMBOL_BEGIN + param + Enums.SYMBOL_END); - SimpleNode expression = OrganizeUtils.parseExpression(param.trim()); - expression.toXML(doc, propertyKeyEl); - } - } - - /** - * Return the LARA source code of the AST
- * This code is not equal to the input as it is automatically generated - * - * @return - */ - public final String toSource() { - return toSource(0); - } - - /** - * Return the LARA source code of the AST - * - * @param indentation - * @return - * @see SimpleNode#toSource() - */ - public String toSource(int indentation) { - throw new NotImplementedException( - "To source method not supported for AST node type " + LARAEcmaScriptTreeConstants.jjtNodeName[id]); - } - - protected static String indent(int indentation) { - return StringUtils.repeat("\t", indentation); - } - - public void addXMLComent(Element el) { - - List comments = new ArrayList(); - Token special = jjtGetFirstToken().specialToken; - while (special != null) { - comments.add(special.image); - special = special.specialToken; - } - if (!comments.isEmpty()) { - Collections.reverse(comments); - escapeHTML(el, StringUtils.join(comments, "\n")); - // base64(el, comment); - } - } - - /** - * @param el - * @param comment - */ - // private void base64(Element el, String comment) { - // try { - // String content = DatatypeConverter.printBase64Binary(comment.getBytes("UTF-8")); - // el.setAttribute("comment", content); - // } catch (UnsupportedEncodingException e) { - // getLara().warnln( - // "Could not add the following comment(s) to aspect-ir: " + comment.toString() + ". Reason: " - // + e.getMessage()); - // } - // } - - /** - * @param el - * @param string - */ - private static void escapeHTML(Element el, String string) { - String content; - content = StringEscapeUtils.escapeHtml4(string); - el.setAttribute("comment", content); - } - - protected void addCoords(Element el) { - final LaraC lara = getLara(); - String path = ""; - if (lara != null) { - path = lara.getLaraPath(); - } - String coordStr = path + ":" + jjtGetFirstToken().beginLine + ":" + jjtGetFirstToken().beginColumn + ":" - + jjtGetLastToken().endLine - + ":" + jjtGetLastToken().endColumn; - el.setAttribute("coord", coordStr); - } - - public int getId() { - return id; - } -} - -/* - * JavaCC - OriginalChecksum=d27917bd78bc237db3717563f5dd3d25 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/Token.java b/LARAC/src/org/dojo/jsl/parser/ast/Token.java deleted file mode 100644 index bf1a3299e..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/Token.java +++ /dev/null @@ -1,132 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. Token.java Version 7.0 */ -/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COLUMN=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ -package org.dojo.jsl.parser.ast; - -/** - * Describes the input token stream. - */ - -public class Token implements java.io.Serializable { - - /** - * The version identifier for this Serializable class. - * Increment only if the serialized form of the - * class changes. - */ - private static final long serialVersionUID = 1L; - - /** - * An integer that describes the kind of this token. This numbering - * system is determined by JavaCCParser, and a table of these numbers is - * stored in the file ...Constants.java. - */ - public int kind; - - /** The line number of the first character of this Token. */ - public int beginLine; - /** The column number of the first character of this Token. */ - public int beginColumn; - /** The line number of the last character of this Token. */ - public int endLine; - /** The column number of the last character of this Token. */ - public int endColumn; - - /** - * The string image of the token. - */ - public String image; - - /** - * A reference to the next regular (non-special) token from the input - * stream. If this is the last token from the input stream, or if the - * token manager has not read tokens beyond this one, this field is - * set to null. This is true only if this token is also a regular - * token. Otherwise, see below for a description of the contents of - * this field. - */ - public Token next; - - /** - * This field is used to access special tokens that occur prior to this - * token, but after the immediately preceding regular (non-special) token. - * If there are no such special tokens, this field is set to null. - * When there are more than one such special token, this field refers - * to the last of these special tokens, which in turn refers to the next - * previous special token through its specialToken field, and so on - * until the first special token (whose specialToken field is null). - * The next fields of special tokens refer to other special tokens that - * immediately follow it (without an intervening regular token). If there - * is no such token, this field is null. - */ - public Token specialToken; - - /** - * An optional attribute value of the Token. - * Tokens which are not used as syntactic sugar will often contain - * meaningful values that will be used later on by the compiler or - * interpreter. This attribute value is often different from the image. - * Any subclass of Token that actually wants to return a non-null value can - * override this method as appropriate. - */ - public Object getValue() { - return null; - } - - /** - * No-argument constructor - */ - public Token() {} - - /** - * Constructs a new token for the specified Image. - */ - public Token(int kind) - { - this(kind, null); - } - - /** - * Constructs a new token for the specified Image and Kind. - */ - public Token(int kind, String image) - { - this.kind = kind; - this.image = image; - } - - /** - * Returns the image. - */ - @Override - public String toString() - { - return image; - } - - /** - * Returns a new Token object, by default. However, if you want, you - * can create and return subclass objects based on the value of ofKind. - * Simply add the cases to the switch for all those special cases. - * For example, if you have a subclass of Token called IDToken that - * you want to create if ofKind is ID, simply add something like : - * - * case MyParserConstants.ID : return new IDToken(ofKind, image); - * - * to the following switch statement. Then you can cast matchedToken - * variable to the appropriate type and use sit in your lexical actions. - */ - public static Token newToken(int ofKind, String image) - { - switch(ofKind) - { - default : return new Token(ofKind, image); - } - } - - public static Token newToken(int ofKind) - { - return newToken(ofKind, null); - } - -} -/* JavaCC - OriginalChecksum=a5eed70842fec789f0bf58b1376f5659 (do not edit this line) */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/TokenMgrError.java b/LARAC/src/org/dojo/jsl/parser/ast/TokenMgrError.java deleted file mode 100644 index 68eaac5cd..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/TokenMgrError.java +++ /dev/null @@ -1,174 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ -/* JavaCCOptions: */ -package org.dojo.jsl.parser.ast; - -/** Token Manager Error. */ -@SuppressWarnings("all") -public class TokenMgrError extends Error { - - /** - * The version identifier for this Serializable class. Increment only if the serialized form of the class - * changes. - */ - private static final long serialVersionUID = 1L; - - /* - * Ordinals for various reasons why an Error of this type can be thrown. - */ - - /** - * Lexical error occurred. - */ - static final int LEXICAL_ERROR = 0; - - /** - * An attempt was made to create a second instance of a static token manager. - */ - static final int STATIC_LEXER_ERROR = 1; - - /** - * Tried to change to an invalid lexical state. - */ - static final int INVALID_LEXICAL_STATE = 2; - - /** - * Detected (and bailed out of) an infinite loop in the token manager. - */ - static final int LOOP_DETECTED = 3; - - /** - * Indicates the reason why the exception is thrown. It will have one of the above 4 values. - */ - int errorCode; - - private int errorLine; - - private int errorColumn; - - private String lexicalError; - - /** - * Replaces unprintable characters by their escaped (or unicode escaped) equivalents in the given string - */ - protected static final String addEscapes(String str) { - StringBuffer retval = new StringBuffer(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) { - case 0: - continue; - case '\b': - retval.append("\\b"); - continue; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u" + s.substring(s.length() - 4, s.length())); - } else { - retval.append(ch); - } - continue; - } - } - return retval.toString(); - } - - /** - * Returns a detailed message for the Error when it is thrown by the token manager to indicate a lexical error. - * Parameters : EOFSeen : indicates if EOF caused the lexical error curLexState : lexical state in which this error - * occurred errorLine : line number when the error occurred errorColumn : column number when the error occurred - * errorAfter : prefix that was seen before this error occurred curchar : the offending character Note: You can - * customize the lexical error message by modifying this method. - */ - protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, - String errorAfter, char curChar) { - String lexicalError = generateLexicalError(EOFSeen, errorAfter, curChar); - return ("at line " + errorLine + ", column " + errorColumn + ". " + lexicalError); - } - - private static String generateLexicalError(boolean EOFSeen, String errorAfter, char curChar) { - String string = "Lexical error: encountered " - + (EOFSeen ? " " - : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") - + "after : \"" + addEscapes(errorAfter) + "\""; - return string; - } - - /** - * You can also modify the body of this method to customize your error messages. For example, cases like - * LOOP_DETECTED and INVALID_LEXICAL_STATE are not of end-users concern, so you can return something like : - * - * "Internal Error : Please file a bug report .... " - * - * from this method for such cases in the release version of your parser. - */ - @Override - public String getMessage() { - return super.getMessage(); - } - - /* - * Constructors of various flavors follow. - */ - - /** No arg constructor. */ - public TokenMgrError() { - } - - /** Constructor with message and reason. */ - public TokenMgrError(String message, int reason) { - super(message); - errorCode = reason; - } - - /** Full Constructor. */ - public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar, - int reason) { - this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, (char) curChar), reason); - this.errorLine = errorLine; - this.errorColumn = errorColumn; - lexicalError = generateLexicalError(EOFSeen, errorAfter, (char) curChar); - - } - - public int getErrorCode() { - return errorCode; - } - - public int getErrorLine() { - return errorLine; - } - - public int getErrorColumn() { - return errorColumn; - } - - public String getLexicalError() { - return lexicalError; - } -} -/* - * JavaCC - OriginalChecksum=fd878cd9d356d43d5dde3f58d32a5265 (do not edit this - * line) - */ diff --git a/LARAC/src/org/dojo/jsl/parser/ast/utils/ASTJSImport.java b/LARAC/src/org/dojo/jsl/parser/ast/utils/ASTJSImport.java deleted file mode 100644 index 23321a098..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/utils/ASTJSImport.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright 2021 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.dojo.jsl.parser.ast.utils; - -import java.util.List; -import java.util.stream.Collectors; - -import org.dojo.jsl.parser.ast.SimpleNode; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import pt.up.fe.specs.util.SpecsCheck; - -public class ASTJSImport extends SimpleNode { - - private static final String NODE_NAME = "JSImport"; - - private final List qualifiedImport; - - public ASTJSImport(List qualifiedImport) { - super(-1); - - this.qualifiedImport = qualifiedImport; - } - - @Override - public Object organize(Object obj) { - // Do nothing - return null; - } - - @Override - public void globalToXML(Document doc, Element parent) { - SpecsCheck.checkArgument(parent.getNodeName().equals("aspects"), - () -> "Expected node to be 'aspects', is '" + parent.getNodeName() + "'"); - - // HACK: To avoid regeneration the Java classes from XML, using attributes Statement already has - final Element statementDeclEl = doc.createElement("declaration"); - statementDeclEl.setAttribute("name", NODE_NAME); - // statementDeclEl.setAttribute("coord", path); - statementDeclEl.setAttribute("desc", qualifiedImport.stream().collect(Collectors.joining("/", "", ".js"))); - - // parent.appendChild(statementDeclEl); - - // Get first node that is not a JSImport, or null if there are no nodes or only has imports - var insertPoint = getInsertPoint(parent); - parent.insertBefore(statementDeclEl, insertPoint); - - toXML(doc, statementDeclEl); - } - - private Node getInsertPoint(Element parent) { - var nodeList = parent.getChildNodes(); - - for (int i = 0; i < nodeList.getLength(); i++) { - var item = nodeList.item(i); - - // If JSImport, skip - if (item.getNodeName().equals("declaration") && - NODE_NAME.equals(item.getAttributes().getNamedItem("name").getNodeValue())) { - continue; - } - - // Found item - return item; - } - - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - // Do nothing - } - - @Override - public String toString() { - return "JSScript (" + qualifiedImport + ")"; - } -} diff --git a/LARAC/src/org/dojo/jsl/parser/ast/utils/ASTLaraImport.java b/LARAC/src/org/dojo/jsl/parser/ast/utils/ASTLaraImport.java deleted file mode 100644 index 2faa0d880..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/utils/ASTLaraImport.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright 2021 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.dojo.jsl.parser.ast.utils; - -import java.util.List; -import java.util.stream.Collectors; - -import org.dojo.jsl.parser.ast.SimpleNode; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import pt.up.fe.specs.util.SpecsCheck; - -public class ASTLaraImport extends SimpleNode { - - private static final String NODE_NAME = "LaraImport"; - - private final List qualifiedImport; - - public ASTLaraImport(List qualifiedImport) { - super(-1); - - this.qualifiedImport = qualifiedImport; - } - - @Override - public Object organize(Object obj) { - // Do nothing - return null; - } - - @Override - public void globalToXML(Document doc, Element parent) { - SpecsCheck.checkArgument(parent.getNodeName().equals("aspects"), - () -> "Expected node to be 'aspects', is '" + parent.getNodeName() + "'"); - - // HACK: To avoid regeneration the Java classes from XML, using attributes Statement already has - final Element statementDeclEl = doc.createElement("declaration"); - statementDeclEl.setAttribute("name", NODE_NAME); - statementDeclEl.setAttribute("desc", - "laraImport(\'" + qualifiedImport.stream().collect(Collectors.joining(".")) + "\')"); - - // Get first node that is not a LaraImport, or null if there are no nodes or only has imports - var insertPoint = getInsertPoint(parent); - parent.insertBefore(statementDeclEl, insertPoint); - - toXML(doc, statementDeclEl); - } - - private Node getInsertPoint(Element parent) { - var nodeList = parent.getChildNodes(); - - for (int i = 0; i < nodeList.getLength(); i++) { - var item = nodeList.item(i); - - // If LaraImport, skip - if (item.getNodeName().equals("declaration") && - NODE_NAME.equals(item.getAttributes().getNamedItem("name").getNodeValue())) { - continue; - } - - // Found item - return item; - } - - return null; - } - - @Override - public void toXML(Document doc, Element parent) { - // Do nothing - } - - @Override - public String toString() { - return "LaraImport (" + qualifiedImport + ")"; - } -} diff --git a/LARAC/src/org/dojo/jsl/parser/ast/utils/ASTScriptImport.java b/LARAC/src/org/dojo/jsl/parser/ast/utils/ASTScriptImport.java deleted file mode 100644 index 6bbff690c..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/utils/ASTScriptImport.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright 2021 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.dojo.jsl.parser.ast.utils; - -import java.io.InputStream; - -import org.dojo.jsl.parser.ast.SimpleNode; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import larac.LaraC; -import pt.up.fe.specs.util.SpecsCheck; -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.lazy.Lazy; -import pt.up.fe.specs.util.utilities.Incrementer; - -public class ASTScriptImport extends SimpleNode { - - private static final ThreadLocal CURRENT_INDEX = ThreadLocal.withInitial(() -> new Incrementer()); - - private final String path; - private final Lazy scriptContents; - - public ASTScriptImport(InputStream scriptContents, String path) { - super(-1); - - // To ensure the stream is read only once - this.scriptContents = Lazy.newInstance(() -> SpecsIo.read(scriptContents)); - this.path = path; - } - - public String getScriptContents() { - return scriptContents.get(); - } - - @Override - public Object organize(Object obj) { - // Do nothing - return null; - } - - @Override - public void declareGlobal(LaraC lara) { - lara.aspectIR().addGlobalElement("ScriptImport_" + CURRENT_INDEX.get().getAndIncrement(), this); - } - - @Override - public void globalToXML(Document doc, Element parent) { - SpecsCheck.checkArgument(parent.getNodeName().equals("aspects"), - () -> "Expected node to be 'aspects', is '" + parent.getNodeName() + "'"); - - // HACK: To avoid regeneration the Java classes from XML, using attributes Statement already has - final Element statementDeclEl = doc.createElement("declaration"); - statementDeclEl.setAttribute("name", "ScriptImport"); - statementDeclEl.setAttribute("coord", path); - statementDeclEl.setAttribute("desc", scriptContents.get()); - // statementDeclEl.setAttribute("script", scriptContents.get()); - // final Element statementDeclEl = doc.createElement("scriptImport"); - // statementDeclEl.setNodeValue(scriptContents.get()); - - // System.out.println("PARENT: " + parent.getNodeName()); - // final Element statementDeclEl = doc.createElement("scriptImport"); - // statementDeclEl.setNodeValue(scriptContents.get()); - // statementDeclEl.setAttribute("name", "scriptImport"); - // statementDeclEl.setAttribute("path", path); - // statementDeclEl.setAttribute("script", scriptContents.get()); - // statementDeclEl.setAttribute("coord", getCoords()); - // addXMLComent(statementDeclEl); - parent.appendChild(statementDeclEl); - toXML(doc, statementDeclEl); - } - - @Override - public void toXML(Document doc, Element parent) { - // Do nothing - } - - @Override - public String toString() { - return "ImportedScript (" + path + ")"; - } -} diff --git a/LARAC/src/org/dojo/jsl/parser/ast/utils/LARACConstantPool.java b/LARAC/src/org/dojo/jsl/parser/ast/utils/LARACConstantPool.java deleted file mode 100644 index c2b0f4e4e..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/utils/LARACConstantPool.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright 2015 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.dojo.jsl.parser.ast.utils; - -public class LARACConstantPool { - - public static final String HIDDEN_TAG = "_hidden_"; - public static final String DISABLED_TAG = "_disabled_"; - public static final String USER_DEFINED = "USER_DEFINED"; - -} diff --git a/LARAC/src/org/dojo/jsl/parser/ast/utils/LaraCNodeFactory.java b/LARAC/src/org/dojo/jsl/parser/ast/utils/LaraCNodeFactory.java deleted file mode 100644 index 4d8ec0ea2..000000000 --- a/LARAC/src/org/dojo/jsl/parser/ast/utils/LaraCNodeFactory.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.dojo.jsl.parser.ast.utils; - -import org.dojo.jsl.parser.ast.ASTAllocationExpression; -import org.dojo.jsl.parser.ast.ASTIdentifier; -import org.dojo.jsl.parser.ast.LARAEcmaScriptConstants; -import org.dojo.jsl.parser.ast.LARAEcmaScriptTreeConstants; - -public class LaraCNodeFactory { - - public static ASTIdentifier newIdentifier(String name) { - ASTIdentifier id = new ASTIdentifier(LARAEcmaScriptConstants.IDENTIFIER_NAME); - id.setName(name); - return id; - } - - /** - * - * @param methodID - * @return - */ - public static ASTAllocationExpression newAllocExpr(String methodID) { - final ASTAllocationExpression alloc = new ASTAllocationExpression( - LARAEcmaScriptTreeConstants.JJTALLOCATIONEXPRESSION); - alloc.setMethodID(methodID); - return alloc; - } -} diff --git a/LARAC/test/specs/actionModel.xml b/LARAC/test/specs/actionModel.xml deleted file mode 100644 index 26000a731..000000000 --- a/LARAC/test/specs/actionModel.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/LARAC/test/specs/artifacts.xml b/LARAC/test/specs/artifacts.xml deleted file mode 100644 index dc11b38ea..000000000 --- a/LARAC/test/specs/artifacts.xml +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/LARAC/test/specs/joinPointModel.xml b/LARAC/test/specs/joinPointModel.xml deleted file mode 100644 index 158a6d3a3..000000000 --- a/LARAC/test/specs/joinPointModel.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/LARAI/.classpath b/LARAI/.classpath deleted file mode 100644 index 3f26a91e4..000000000 --- a/LARAI/.classpath +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/LARAI/.project b/LARAI/.project deleted file mode 100644 index 072519f89..000000000 --- a/LARAI/.project +++ /dev/null @@ -1,35 +0,0 @@ - - - LARAI - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.jdt.core.javanature - org.apache.ivyde.eclipse.ivynature - org.eclipse.buildship.core.gradleprojectnature - - - - 1665246567168 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/LARAI/README.md b/LARAI/README.md deleted file mode 100644 index 3d8deb8b4..000000000 --- a/LARAI/README.md +++ /dev/null @@ -1,13 +0,0 @@ -## Synopsis - -Interpreter for the Lara language. - -## Installation - -Using [eclipse-build](http://specs.fe.up.pt/tools/eclipse-build.jar), copy the file eclipse.build to a folder and run the following command: - -``` - java -jar eclipse-build.jar --config eclipse.build -``` - -This should create the file LARAI.jar. diff --git a/LARAI/ant/[LAPTOP]lara_cetus.xml b/LARAI/ant/[LAPTOP]lara_cetus.xml deleted file mode 100644 index 8e4de0640..000000000 --- a/LARAI/ant/[LAPTOP]lara_cetus.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/LARAI/ant/lara_lalp.xml b/LARAI/ant/lara_lalp.xml deleted file mode 100644 index 0c7515583..000000000 --- a/LARAI/ant/lara_lalp.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/LARAI/ant/larai.xml b/LARAI/ant/larai.xml deleted file mode 100644 index a531db075..000000000 --- a/LARAI/ant/larai.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/LARAI/ant/larai_cetus.xml b/LARAI/ant/larai_cetus.xml deleted file mode 100644 index ef7444255..000000000 --- a/LARAI/ant/larai_cetus.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/LARAI/build.gradle b/LARAI/build.gradle index a123c7f77..41c59899c 100644 --- a/LARAI/build.gradle +++ b/LARAI/build.gradle @@ -1,77 +1,93 @@ plugins { - id 'distribution' + id 'distribution' + id 'java' + id 'jacoco' } -// Java project -apply plugin: 'java' - java { + withSourcesJar() + sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } - // Repositories providers repositories { mavenCentral() } dependencies { - implementation "junit:junit:4.13.1" - - implementation ':CommonsLangPlus' - implementation ':GitPlus' - implementation ':jOptions' - implementation ':JsEngine' - implementation ':SpecsUtils' - implementation ':tdrcLibrary' + implementation ':jOptions' + implementation ':SpecsUtils' - implementation ':LanguageSpecification' - implementation ':LaraApi' - implementation ':LARAC' - implementation ':LaraCommonLanguage' - implementation ':LaraLoc' - implementation ':LaraUtils' - implementation ':WeaverInterface' + implementation ':LaraUtils' + implementation ':LanguageSpecification' + implementation ':WeaverInterface' + implementation 'commons-cli:commons-cli:1.9.0' - implementation group: 'commons-cli', name: 'commons-cli', version: '1.3.1' - implementation group: 'org.apache.commons', name: 'commons-exec', version: '1.3' - implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.5' - implementation group: 'com.google.code.gson', name: 'gson', version: '2.4' - implementation group: 'com.google.guava', name: 'guava', version: '19.0' - implementation group: 'com.fifesoft', name: 'rsyntaxtextarea', version: '2.5.8' - implementation group: 'com.fifesoft', name: 'autocomplete', version: '2.5.8' - implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1' -} - -java { - withSourcesJar() + // Testing dependencies + testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0' + testImplementation 'org.mockito:mockito-core:5.5.0' + testImplementation 'org.mockito:mockito-junit-jupiter:5.5.0' + testImplementation 'org.assertj:assertj-core:3.24.2' + testImplementation 'org.mockito:mockito-inline:5.2.0' // For static mocking + testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.10.0' } // Project sources sourceSets { - main { - java { - srcDir 'src' - } - - resources { - //srcDir 'src' - srcDir 'src-lara' - srcDir 'resources' - } - } - - test { - java { - srcDir 'test' - } - - resources { - //srcDir 'src' - srcDir 'src-lara' - srcDir 'resources' - } - } + main { + java { + srcDir 'src' + } + resources { + srcDir 'resources' + } + } + test { + java { + srcDir 'test' + } + resources { + srcDir 'test-resources' + } + } +} + +// Test coverage configuration +jacocoTestReport { + reports { + xml.required = true + html.required = true + } + + finalizedBy jacocoTestCoverageVerification +} + +jacocoTestCoverageVerification { + violationRules { + rule { + limit { + minimum = 0.80 // 80% minimum coverage + } + } + } +} + +// Make sure jacoco report is generated after tests +test { + useJUnitPlatform() + + maxParallelForks = Runtime.runtime.availableProcessors() + + finalizedBy jacocoTestReport +} + +tasks.register('json', JavaExec) { + group = "Execution" + description = "Generates the LaraJoinPointSpecification.json file for Lara-JS" + classpath = sourceSets.main.runtimeClasspath + mainClass = 'org.lara.interpreter.LaraJoinPointJsonGeneratorLauncher' + args = [] } diff --git a/LARAI/deploy/LaraI-deploy.launch b/LARAI/deploy/LaraI-deploy.launch deleted file mode 100644 index 9f46413bb..000000000 --- a/LARAI/deploy/LaraI-deploy.launch +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/LARAI/deploy/LaraI.deploy b/LARAI/deploy/LaraI.deploy deleted file mode 100644 index da27ed540..000000000 --- a/LARAI/deploy/LaraI.deploy +++ /dev/null @@ -1,110 +0,0 @@ - - - - NameOfOutputJar - - larai.jar - string - - - - ClassWithMain - - larai.LaraI - string - - - - Tasks - - - - - - - OutputJarFilename - - larai.jar - string - - - - Port - - 22 - string - - - - UserPass - - SpecS#12345 - string - - - - Host - - specs.fe.up.pt - string - - - - DestinationFolder - - /var/www/html/tools - string - - - - UserLogin - - root - string - - - - CommandsFile - - - string - - - - SFTP Task - - - - - SFTP Task - - - - - setupList - - - - ProjectName - - LARAI - string - - - - OutputJarType - - RepackJar - multipleChoice - - - - WorkspaceFolder - - - string - - - - EclipseDeployment - \ No newline at end of file diff --git a/LARAI/diagrams/CD.cld b/LARAI/diagrams/CD.cld deleted file mode 100644 index 9e9989007..000000000 --- a/LARAI/diagrams/CD.cld +++ /dev/null @@ -1,1775 +0,0 @@ - - - - 255 - 255 - 206 - - - 0 - 0 - 0 - - true - - - - - 2 - - - - - - - - - - 255 - 255 - 206 - - - 0 - 0 - 0 - - true - - - - true - - - - - 2 - - - - - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 669 - 776 - - - - true - - - - - 2 - - - - - - - - - - - - - true - - - - - 2 - - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 132 - 795 - - - - true - - - - - 2 - - - - - - - - 255 - 255 - 206 - - - 0 - 0 - 0 - - true - - - - - - 2 - - - - - - -1 - -1 - 286 - 710 - - - - true - - - - - 2 - - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 77 - 459 - - - - true - - - - - 2 - - - - - - - - - - - - - - - - - - - - true - - - - - - 2 - - - - - - interpret - Object - - - asps - Aspects - - - false - false - - - - - true - - - - - - 2 - - - - - - generateAspectsJavascript - StringBuilder - - - asps - Aspects - - - false - false - - - - - true - - - - - - 2 - - - - - - importClassPaths - void - - - jarFolderFiles - List<File> - - - false - false - - - - - true - - - - - - 2 - - - - - - importScript - void - - - source - File - - - false - false - - - - - true - - - - - - 2 - - - - - - getJavascriptString - StringBuilder - - - el - IElement - - - depth - int - - - false - false - - - - - true - - - - - - 2 - - - - - - generateSelectArguments - StringBuilder - - - stat - Statement - - - false - false - - - - - true - - - - - - 2 - - - - - - setArgumentsAndCallMain - void - - - mainName - String - - - code - StringBuilder - - - false - false - - - - - true - - - - - - 2 - - - - - - executeMainAspect - Object - - - mainCall - StringBuilder - - - false - false - - - - - true - - - - - - 2 - - - - - - evaluate - Object - - - code - String - - - false - false - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - Interpreter - false - - - - - - - - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - Nashorn - false - - - - - - - - - - - - - - - true - - - - - - 2 - - - - - - select - Bindings - - - selectName - String - - - jpChain - String[] ... - - - false - false - - - - - true - - - - - - 2 - - - - - - close - boolean - - - outputDir - String - - - false - false - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - MasterWeaver - false - - - - - - - - - - - - - true - - - - - - 2 - - - - - - begin - boolean - - - sourceDir - File - - - outputDir - File - - - dataStore - DataStore - - - false - false - - - - - true - - - - - - 2 - - - - - - close - boolean - - false - false - - - - - true - - - - - - 2 - - - - - - select - JoinPoint - - false - false - - - - - true - - - - - - 2 - - - - - - getLanguageSpecification - LanguageSpecification - - false - false - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - - WeaverEngine - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 760 - 445 - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - CetusWeaver - false - - - - 255 - 255 - 206 - - - 0 - 0 - 0 - - true - - - - - - 2 - - - - - - -1 - -1 - 614 - 454 - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - SpoonWeaver - false - - - - 255 - 255 - 206 - - - 0 - 0 - 0 - - true - - - - - - 2 - - - - - - -1 - -1 - 939 - 454 - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - MatlabWeaver - false - - - - 255 - 255 - 206 - - - 0 - 0 - 0 - - true - - - - - - 2 - - - - - - -1 - -1 - 1096 - 454 - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - DefaultWeaver - false - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 697 - 397 - - - - true - - - - - 2 - - - - - - - - - - - - - - - true - - - - - 2 - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 697 - 299 - - - - - - - true - - - - - 2 - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 697 - 200 - - - - - - - - - - true - - - - - - 2 - - - - - - loadXml - void - - - e - Element - - - rootName - String - - - doc - Document - - - false - false - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - Statement - false - - - - - - - - - - - - - true - - - - - - 2 - - - - - - loadXml - void - - - e - Element - - - rootName - String - - - doc - Document - - - false - false - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - Aspect - false - - - - - - - - - - - - - true - - - - - - 2 - - - - - - readDocument - Document - - - file - String - - - false - true - - - - - true - - - - - - 2 - - - - - - loadXml - void - - - e - Element - - - rootName - String - - - doc - Document - - - false - false - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - Aspects - false - - - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 704 - 663 - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - JoinPoint - false - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 717 - 555 - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - CProgram - false - - - - - - - - - 2 - - - - - - -1 - -1 - 675 - 515 - - - - - - - - - - - - true - - - - - - 2 - - - - - - exec - boolean - - - dataStore - DataStore - - - weaverEngine - WeaverEngine - - - false - true - - - - - true - - - - - - 2 - - - - - - startAspectIR - void - - - file - String - - - false - false - - - - - true - - - - - - 2 - - - - - - interpret - void - - - weaverEngine - WeaverEngine - - - false - false - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - LaraI - false - - - - - - - - - - - \ No newline at end of file diff --git a/LARAI/diagrams/CD2.cld b/LARAI/diagrams/CD2.cld deleted file mode 100644 index 4afe59175..000000000 --- a/LARAI/diagrams/CD2.cld +++ /dev/null @@ -1,1366 +0,0 @@ - - - - 255 - 255 - 206 - - - 0 - 0 - 0 - - true - - - - - 2 - - - - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 416 - 24 - - - - - true - - - - - 2 - - - - - - - 229 - 229 - 229 - - - 0 - 0 - 0 - - true - - - - - - 2 - - - - - - -1 - -1 - 435 - 211 - - - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - JavaWeaver - false - - - - - - true - - - - - 2 - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 583 - 202 - - - - - - - true - - - - - 2 - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 541 - 317 - - - - true - - - - - 2 - - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 126 - 455 - - - - - - true - - - - - 2 - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 525 - 456 - - - - true - - - - - 2 - - - - - - - - - - - - - - - - true - - - - - 2 - - - - - - - - true - - - - - - 2 - - - - - - -1 - -1 - 509 - 621 - - - - - true - - - - - 2 - - - - - - - - - - - - - - - true - - - - - - 2 - - - - - - getNum_lines - int - - false - false - - - - - true - - - - - - 2 - - - - - - getReturn_type - String - - false - false - - - - - true - - - - - - 2 - - - - - - getLine - int - - false - false - - - - - true - - - - - - 2 - - - - - - selectPrototype - List<CPrototype> - - false - false - - - - - true - - - - - - 2 - - - - - - selectParam - List<CDeclaration> - - false - false - - - - - true - - - - - - 2 - - - - - - selectBody - List<CBody> - - false - false - - - - - true - - - - - - 2 - - - - - - insert - void - - - position - String - - - code - String - - - false - false - - - - - true - - - - - - 2 - - - - - - clone - void - - - newName - String - - - false - false - - - - - true - - - - - - 2 - - - - - - function - Procedure - false - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - CFunction - false - - - - - - - - - - - - - true - - - - - - 2 - - - - - - selectPragma - List<CPragma> - - false - false - - - - - true - - - - - - 2 - - - - - - selectFunction - List<CFunction> - - false - false - - - - - true - - - - - - 2 - - - - - - selectFirst_header - List<CHeader> - - false - false - - - - - true - - - - - - 2 - - - - - - file - TranslationUnit - false - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - CFile - false - - - - - - - - - - - true - - - - - - 2 - - - - - - same - boolean - - - iJoinPoint - JoinPoint - - - true - false - - - - - true - - - - - - 2 - - - - - - getActions - Bindings - - false - false - - - - - true - - - - - - 2 - - - - - - getSelects - Bindings - - false - false - - - - - true - - - - - - 2 - - - - - - getAttributes - Bindings - - false - false - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - JoinPoint - false - - - - - - - - - - - - - true - - - - - - 2 - - - - - - selectFile - List<CFile> - - false - false - - - - - true - - - - - - 2 - - - - - - same - boolean - - - prog - JoinPoint - - - false - false - - - - - true - - - - - - 2 - - - - - - program - Program - false - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - CProgram - false - - - - - - - - - - - - - true - - - - - - 2 - - - - - - select - CProgram - - false - false - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - CetusWeaver - false - - - - - - true - - - - - 2 - - - - - - - - 0 - 0 - 0 - - true - - - - - - 2 - - - - - - -1 - -1 - 786 - 211 - - - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - MatlabWeaver - false - - - - - - true - - - - - 2 - - - - - - - - 0 - 0 - 0 - - true - - - - - - 2 - - - - - - -1 - -1 - 979 - 211 - - - - - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - _abstract - abstract - false - - - - DefaultWeaver - false - - - - - - - - - - true - - - - - - 2 - - - - - - begin - boolean - - - sourceDir - File - - - outputDir - File - - - dataStore - DataStore - - - false - false - - - - - true - - - - - - 2 - - - - - - close - boolean - - false - false - - - - - true - - - - - - 2 - - - - - - select - JoinPoint - - false - false - - - - - true - - - - - - 2 - - - - - - getLanguageSpecification - LanguageSpecification - - false - false - - - - - - _stereo_type - Stereo Type - false - - - _simpleEntityName - Simple Name - false - - - _entityName - Name - false - - - _background - Background Color - false - - - _attrs - Attributes... - false - - - _operations - Operations... - false - - - - WeaverEngine - - - - - - - - - - - - \ No newline at end of file diff --git a/LARAI/diagrams/Class.atxa b/LARAI/diagrams/Class.atxa deleted file mode 100644 index 74e7d2c0e..000000000 --- a/LARAI/diagrams/Class.atxa +++ /dev/null @@ -1,716 +0,0 @@ -@prefix rdf: . -@prefix atxa-jdt: . -@prefix atxa-rse-eclipse: . -@prefix atxa-core: . -@prefix atxa: . -@prefix atxa-jdt-wkspc: . - - a atxa-core:reloFile . - -atxa:DetailNode atxa-core:detailLevel "0" . - -atxa-core:docRoot atxa-core:browseModel "com.architexa.diagrams.relo.jdt/com.architexa.diagrams.relo.jdt.browse.ClassStrucBrowseModel" ; - atxa-core:contains _:node1abjpr6bix1 . - -_:node1abjpr6bix1 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "441" ; - atxa-core:posY "162" . - - atxa-core:contains . - -_:node1abjpr6bix1 atxa-core:contains _:node1abjpr6bix2 . - -_:node1abjpr6bix2 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "447" ; - atxa-core:posY "188" . - - atxa-core:contains . - -_:node1abjpr6bix2 atxa-core:contains _:node1abjpr6bix5 . - -_:node1abjpr6bix5 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "448" ; - atxa-core:posY "207" . - -atxa-core:docRoot atxa-core:contains _:node1abjpr6bix6 . - -_:node1abjpr6bix6 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "339" ; - atxa-core:posY "287" . - - atxa-core:contains . - -_:node1abjpr6bix6 atxa-core:contains _:node1abjpr6bix7 . - -_:node1abjpr6bix7 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "345" ; - atxa-core:posY "313" . - -atxa-core:docRoot atxa-core:contains _:node1abjpr6bix8 . - -_:node1abjpr6bix8 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "664" ; - atxa-core:posY "546" . - - atxa-core:contains . - -_:node1abjpr6bix8 atxa-core:contains _:node1abjpr6bix9 . - -_:node1abjpr6bix9 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "670" ; - atxa-core:posY "572" . - -_:node1abjpr6bix10 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix9 ; - rdf:object _:node1abjpr6bix11 ; - atxa-core:bendpoint _:node1abjpmri8x2838 . - -_:node1abjpmri8x2838 atxa-core:bpLocation "744,513" ; - atxa-core:bpIndex "0" . - -atxa-core:docRoot atxa-core:contains _:node1abjpr6bix13 . - -_:node1abjpr6bix13 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "1172" ; - atxa-core:posY "272" . - - atxa-core:contains . - -_:node1abjpr6bix13 atxa-core:contains _:node1abjpr6bix14 . - -_:node1abjpr6bix14 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "1178" ; - atxa-core:posY "298" . - -_:node1abjpr6bix15 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix14 ; - rdf:object _:node1abjpr6bix16 ; - atxa-core:bendpoint _:node1abjpmri8x2839 . - -_:node1abjpmri8x2839 atxa-core:bpLocation "1292,273" ; - atxa-core:bpIndex "0" . - -atxa-core:docRoot atxa-core:contains _:node1abjpr6bix18 . - -_:node1abjpr6bix18 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "1043" ; - atxa-core:posY "190" . - - atxa-core:contains , , , , . - -_:node1abjpr6bix18 atxa-core:contains _:node1abjpr6bix27 . - -_:node1abjpr6bix27 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "1422" ; - atxa-core:posY "402" . - -_:node1abjpr6bix28 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix27 ; - rdf:object _:node1abjpr6bix14 ; - atxa-core:bendpoint _:node1abjpmri8x2840 . - -_:node1abjpmri8x2840 atxa-core:bpLocation "1460,355" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix28 atxa-core:bendpoint _:node1abjpmri8x2841 . - -_:node1abjpmri8x2841 atxa-core:bpLocation "1292,355" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix18 atxa-core:contains _:node1abjpr6bix19 . - -_:node1abjpr6bix19 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "1174" ; - atxa-core:posY "402" . - -_:node1abjpr6bix20 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix19 ; - rdf:object _:node1abjpr6bix14 ; - atxa-core:bendpoint _:node1abjpmri8x2842 . - -_:node1abjpmri8x2842 atxa-core:bpLocation "1238,355" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix20 atxa-core:bendpoint _:node1abjpmri8x2843 . - -_:node1abjpmri8x2843 atxa-core:bpLocation "1292,355" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix18 atxa-core:contains _:node1abjpr6bix23 . - -_:node1abjpr6bix23 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "1049" ; - atxa-core:posY "401" . - -_:node1abjpr6bix24 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix23 ; - rdf:object _:node1abjpr6bix14 ; - atxa-core:bendpoint _:node1abjpmri8x2844 . - -_:node1abjpmri8x2844 atxa-core:bpLocation "1105,355" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix24 atxa-core:bendpoint _:node1abjpmri8x2845 . - -_:node1abjpmri8x2845 atxa-core:bpLocation "1292,355" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix18 atxa-core:contains _:node1abjpr6bix16 . - -_:node1abjpr6bix16 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "1233" ; - atxa-core:posY "216" . - -_:node1abjpr6bix18 atxa-core:contains _:node1abjpr6bix31 . - -_:node1abjpr6bix31 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "1314" ; - atxa-core:posY "402" . - -_:node1abjpr6bix32 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix31 ; - rdf:object _:node1abjpr6bix14 ; - atxa-core:bendpoint _:node1abjpmri8x2846 . - -_:node1abjpmri8x2846 atxa-core:bpLocation "1362,355" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix32 atxa-core:bendpoint _:node1abjpmri8x2847 . - -_:node1abjpmri8x2847 atxa-core:bpLocation "1292,355" ; - atxa-core:bpIndex "1" . - -atxa-core:docRoot atxa-core:contains _:node1abjpr6bix35 . - -_:node1abjpr6bix35 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "658" ; - atxa-core:posY "430" . - - atxa-core:contains . - -_:node1abjpr6bix35 atxa-core:contains _:node1abjpr6bix11 . - -_:node1abjpr6bix11 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "664" ; - atxa-core:posY "456" . - -atxa-core:docRoot atxa-core:contains _:node1abjpr6bix36 . - -_:node1abjpr6bix36 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "1036" ; - atxa-core:posY "527" . - - atxa-core:contains , , , . - -_:node1abjpr6bix36 atxa-core:contains _:node1abjpr6bix46 . - -_:node1abjpr6bix46 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "1415" ; - atxa-core:posY "556" . - -_:node1abjpr6bix47 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix46 ; - rdf:object _:node1abjpr6bix27 ; - atxa-core:bendpoint _:node1abjpmri8x2848 . - -_:node1abjpmri8x2848 atxa-core:bpLocation "1460,459" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix36 atxa-core:contains _:node1abjpr6bix40 . - -_:node1abjpr6bix40 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "1042" ; - atxa-core:posY "553" . - -_:node1abjpr6bix41 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix40 ; - rdf:object _:node1abjpr6bix23 ; - atxa-core:bendpoint _:node1abjpmri8x2849 . - -_:node1abjpmri8x2849 atxa-core:bpLocation "1105,458" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix36 atxa-core:contains _:node1abjpr6bix43 . - -_:node1abjpr6bix43 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "1174" ; - atxa-core:posY "553" . - -_:node1abjpr6bix44 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix43 ; - rdf:object _:node1abjpr6bix19 ; - atxa-core:bendpoint _:node1abjpmri8x2850 . - -_:node1abjpmri8x2850 atxa-core:bpLocation "1238,459" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix36 atxa-core:contains _:node1abjpr6bix37 . - -_:node1abjpr6bix37 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "1307" ; - atxa-core:posY "555" . - -_:node1abjpr6bix38 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix37 ; - rdf:object _:node1abjpr6bix31 ; - atxa-core:bendpoint _:node1abjpmri8x2851 . - -_:node1abjpmri8x2851 atxa-core:bpLocation "1362,459" ; - atxa-core:bpIndex "0" . - -atxa-core:docRoot atxa-core:contains _:node1abjpr6bix49 . - -_:node1abjpr6bix49 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "-207" ; - atxa-core:posY "413" . - - atxa-core:contains , , , , , , , , , , , , , , , , , , , . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix50 . - -_:node1abjpr6bix50 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "123" ; - atxa-core:posY "640" . - -_:node1abjpr6bix51 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix50 ; - rdf:object _:node1abjpr6bix52 ; - atxa-core:bendpoint _:node1abjpmri8x2852 . - -_:node1abjpmri8x2852 atxa-core:bpLocation "161,573" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix51 atxa-core:bendpoint _:node1abjpmri8x2853 . - -_:node1abjpmri8x2853 atxa-core:bpLocation "-67,573" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix55 . - -_:node1abjpr6bix55 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "441" ; - atxa-core:posY "781" . - -_:node1abjpr6bix56 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix55 ; - rdf:object _:node1abjpr6bix57 ; - atxa-core:bendpoint _:node1abjpmri8x2854 . - -_:node1abjpmri8x2854 atxa-core:bpLocation "482,543" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix56 atxa-core:bendpoint _:node1abjpmri8x2855 . - -_:node1abjpmri8x2855 atxa-core:bpLocation "161,543" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix60 . - -_:node1abjpr6bix60 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "-68" ; - atxa-core:posY "640" . - -_:node1abjpr6bix61 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix60 ; - rdf:object _:node1abjpr6bix62 ; - atxa-core:bendpoint _:node1abjpmri8x2856 . - -_:node1abjpmri8x2856 atxa-core:bpLocation "-25,620" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix61 atxa-core:bendpoint _:node1abjpmri8x2857 . - -_:node1abjpmri8x2857 atxa-core:bpLocation "363,620" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix65 . - -_:node1abjpr6bix65 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "310" ; - atxa-core:posY "839" . - -_:node1abjpr6bix66 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix65 ; - rdf:object _:node1abjpr6bix62 ; - atxa-core:bendpoint _:node1abjpmri8x2858 . - -_:node1abjpmri8x2858 atxa-core:bpLocation "356,620" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix66 atxa-core:bendpoint _:node1abjpmri8x2859 . - -_:node1abjpmri8x2859 atxa-core:bpLocation "363,620" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix69 . - -_:node1abjpr6bix69 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "334" ; - atxa-core:posY "640" . - -_:node1abjpr6bix70 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix69 ; - rdf:object _:node1abjpr6bix57 ; - atxa-core:bendpoint _:node1abjpmri8x2860 . - -_:node1abjpmri8x2860 atxa-core:bpLocation "379,543" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix70 atxa-core:bendpoint _:node1abjpmri8x2861 . - -_:node1abjpmri8x2861 atxa-core:bpLocation "161,543" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix73 . - -_:node1abjpr6bix73 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "-201" ; - atxa-core:posY "640" . - -_:node1abjpr6bix74 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix73 ; - rdf:object _:node1abjpr6bix62 ; - atxa-core:bendpoint _:node1abjpmri8x2862 . - -_:node1abjpmri8x2862 atxa-core:bpLocation "-152,620" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix74 atxa-core:bendpoint _:node1abjpmri8x2863 . - -_:node1abjpmri8x2863 atxa-core:bpLocation "363,620" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix77 . - -_:node1abjpr6bix77 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "309" ; - atxa-core:posY "828" . - -_:node1abjpr6bix78 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix77 ; - rdf:object _:node1abjpr6bix57 ; - atxa-core:bendpoint _:node1abjpmri8x2864 . - -_:node1abjpmri8x2864 atxa-core:bpLocation "357,543" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix78 atxa-core:bendpoint _:node1abjpmri8x2865 . - -_:node1abjpmri8x2865 atxa-core:bpLocation "161,543" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix57 . - -_:node1abjpr6bix57 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "108" ; - atxa-core:posY "486" . - -_:node1abjpr6bix81 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix57 ; - rdf:object _:node1abjpr6bix82 ; - atxa-core:bendpoint _:node1abjpmri8x2866 . - -_:node1abjpmri8x2866 atxa-core:bpLocation "161,496" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix81 atxa-core:bendpoint _:node1abjpmri8x2867 . - -_:node1abjpmri8x2867 atxa-core:bpLocation "269,496" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix52 . - -_:node1abjpr6bix52 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "-123" ; - atxa-core:posY "516" . - -_:node1abjpr6bix85 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix52 ; - rdf:object _:node1abjpr6bix57 ; - atxa-core:bendpoint _:node1abjpmri8x2868 . - -_:node1abjpmri8x2868 atxa-core:bpLocation "-67,543" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix85 atxa-core:bendpoint _:node1abjpmri8x2869 . - -_:node1abjpmri8x2869 atxa-core:bpLocation "161,543" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix88 . - -_:node1abjpr6bix88 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "107" ; - atxa-core:posY "839" . - -_:node1abjpr6bix89 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix88 ; - rdf:object _:node1abjpr6bix62 ; - atxa-core:bendpoint _:node1abjpmri8x2870 . - -_:node1abjpmri8x2870 atxa-core:bpLocation "161,620" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix89 atxa-core:bendpoint _:node1abjpmri8x2871 . - -_:node1abjpmri8x2871 atxa-core:bpLocation "363,620" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix92 . - -_:node1abjpr6bix92 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "111" ; - atxa-core:posY "734" . - -_:node1abjpr6bix93 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix92 ; - rdf:object _:node1abjpr6bix62 ; - atxa-core:bendpoint _:node1abjpmri8x2872 . - -_:node1abjpmri8x2872 atxa-core:bpLocation "161,620" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix93 atxa-core:bendpoint _:node1abjpmri8x2873 . - -_:node1abjpmri8x2873 atxa-core:bpLocation "363,620" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix96 . - -_:node1abjpr6bix96 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "438" ; - atxa-core:posY "839" . - -_:node1abjpr6bix97 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix96 ; - rdf:object _:node1abjpr6bix62 ; - atxa-core:bendpoint _:node1abjpmri8x2874 . - -_:node1abjpmri8x2874 atxa-core:bpLocation "494,620" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix97 atxa-core:bendpoint _:node1abjpmri8x2875 . - -_:node1abjpmri8x2875 atxa-core:bpLocation "363,620" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix100 . - -_:node1abjpr6bix100 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "102" ; - atxa-core:posY "828" . - -_:node1abjpr6bix101 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix100 ; - rdf:object _:node1abjpr6bix57 ; - atxa-core:bendpoint _:node1abjpmri8x2876 . - -_:node1abjpmri8x2876 atxa-core:bpLocation "161,543" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix103 . - -_:node1abjpr6bix103 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "306" ; - atxa-core:posY "687" . - -_:node1abjpr6bix104 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix103 ; - rdf:object _:node1abjpr6bix62 ; - atxa-core:bendpoint _:node1abjpmri8x2877 . - -_:node1abjpmri8x2877 atxa-core:bpLocation "363,620" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix62 . - -_:node1abjpr6bix62 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "305" ; - atxa-core:posY "563" . - -_:node1abjpr6bix106 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix62 ; - rdf:object _:node1abjpr6bix52 ; - atxa-core:bendpoint _:node1abjpmri8x2878 . - -_:node1abjpmri8x2878 atxa-core:bpLocation "363,573" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix106 atxa-core:bendpoint _:node1abjpmri8x2879 . - -_:node1abjpmri8x2879 atxa-core:bpLocation "-67,573" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix109 . - -_:node1abjpr6bix109 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "-105" ; - atxa-core:posY "839" . - -_:node1abjpr6bix110 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix109 ; - rdf:object _:node1abjpr6bix62 ; - atxa-core:bendpoint _:node1abjpmri8x2880 . - -_:node1abjpmri8x2880 atxa-core:bpLocation "-46,620" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix110 atxa-core:bendpoint _:node1abjpmri8x2881 . - -_:node1abjpmri8x2881 atxa-core:bpLocation "363,620" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix113 . - -_:node1abjpr6bix113 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "-126" ; - atxa-core:posY "781" . - -_:node1abjpr6bix114 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix113 ; - rdf:object _:node1abjpr6bix57 ; - atxa-core:bendpoint _:node1abjpmri8x2882 . - -_:node1abjpmri8x2882 atxa-core:bpLocation "-56,543" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix114 atxa-core:bendpoint _:node1abjpmri8x2883 . - -_:node1abjpmri8x2883 atxa-core:bpLocation "161,543" ; - atxa-core:bpIndex "1" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix117 . - -_:node1abjpr6bix117 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "221" ; - atxa-core:posY "516" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix118 . - -_:node1abjpr6bix118 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "77" ; - atxa-core:posY "687" . - -_:node1abjpr6bix119 a atxa-core:link ; - atxa-core:model atxa-jdt:inherits ; - rdf:subject _:node1abjpr6bix118 ; - rdf:object _:node1abjpr6bix57 ; - atxa-core:bendpoint _:node1abjpmri8x2884 . - -_:node1abjpmri8x2884 atxa-core:bpLocation "161,543" ; - atxa-core:bpIndex "0" . - -_:node1abjpr6bix49 atxa-core:contains _:node1abjpr6bix82 . - -_:node1abjpr6bix82 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "215" ; - atxa-core:posY "439" . - -atxa-core:docRoot atxa-core:contains _:node1abjpr6bix121 . - -_:node1abjpr6bix121 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "-51" ; - atxa-core:posY "192" . - - atxa-core:contains , . - -_:node1abjpr6bix121 atxa-core:contains _:node1abjpr6bix124 . - -_:node1abjpr6bix124 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "-8" ; - atxa-core:posY "218" . - -_:node1abjpr6bix121 atxa-core:contains _:node1abjpr6bix122 . - -_:node1abjpr6bix122 a atxa-core:node ; - atxa-core:model ; - atxa-core:posX "-45" ; - atxa-core:posY "274" . - -_:node1abjpr6bix123 a atxa-core:link ; - atxa-core:model atxa-jdt:refType ; - rdf:subject _:node1abjpr6bix122 ; - rdf:object _:node1abjpr6bix7 . - -@prefix rdf: . -@prefix atxa-jdt: . -@prefix atxa-rse-eclipse: . -@prefix atxa-core: . -@prefix atxa: . -@prefix atxa-jdt-wkspc: . - - a atxa-core:reloFile ; - atxa-core:contains _:node1abjpr6bix5 , _:node1abjpr6bix2 , _:node1abjpr6bix1 , _:node1abjpr6bix7 , _:node1abjpr6bix6 , _:node1abjpr6bix9 , _:node1abjpr6bix8 , _:node1abjpr6bix14 , _:node1abjpr6bix13 , _:node1abjpr6bix27 , _:node1abjpr6bix19 , _:node1abjpr6bix23 , _:node1abjpr6bix16 , _:node1abjpr6bix31 , _:node1abjpr6bix18 , _:node1abjpr6bix11 , _:node1abjpr6bix35 , _:node1abjpr6bix46 , _:node1abjpr6bix40 , _:node1abjpr6bix43 , _:node1abjpr6bix37 , _:node1abjpr6bix36 , _:node1abjpr6bix50 , _:node1abjpr6bix55 , _:node1abjpr6bix60 , _:node1abjpr6bix65 , _:node1abjpr6bix69 , _:node1abjpr6bix73 , _:node1abjpr6bix77 , _:node1abjpr6bix57 , _:node1abjpr6bix52 , _:node1abjpr6bix88 , _:node1abjpr6bix92 , _:node1abjpr6bix96 , _:node1abjpr6bix100 , _:node1abjpr6bix103 , _:node1abjpr6bix62 , _:node1abjpr6bix109 , _:node1abjpr6bix113 , _:node1abjpr6bix117 , _:node1abjpr6bix118 , _:node1abjpr6bix82 , _:node1abjpr6bix49 , _:node1abjpr6bix124 , _:node1abjpr6bix122 , _:node1abjpr6bix121 , atxa-core:docRoot , _:node1abjpr6bix5 , _:node1abjpr6bix2 , _:node1abjpr6bix1 , _:node1abjpr6bix7 , _:node1abjpr6bix6 , _:node1abjpr6bix9 , _:node1abjpr6bix8 , _:node1abjpr6bix14 , _:node1abjpr6bix13 , _:node1abjpr6bix27 , _:node1abjpr6bix19 , _:node1abjpr6bix23 , _:node1abjpr6bix16 , _:node1abjpr6bix31 , _:node1abjpr6bix18 , _:node1abjpr6bix11 , _:node1abjpr6bix35 , _:node1abjpr6bix46 , _:node1abjpr6bix40 , _:node1abjpr6bix43 , _:node1abjpr6bix37 , _:node1abjpr6bix36 , _:node1abjpr6bix50 , _:node1abjpr6bix55 , _:node1abjpr6bix60 , _:node1abjpr6bix65 , _:node1abjpr6bix69 , _:node1abjpr6bix73 , _:node1abjpr6bix77 , _:node1abjpr6bix57 , _:node1abjpr6bix52 , _:node1abjpr6bix88 , _:node1abjpr6bix92 , _:node1abjpr6bix96 , _:node1abjpr6bix100 , _:node1abjpr6bix103 , _:node1abjpr6bix62 , _:node1abjpr6bix109 , _:node1abjpr6bix113 , _:node1abjpr6bix117 , _:node1abjpr6bix118 , _:node1abjpr6bix82 , _:node1abjpr6bix49 , _:node1abjpr6bix124 , _:node1abjpr6bix122 , _:node1abjpr6bix121 , atxa-core:docRoot , _:node1abjpr6bix10 , _:node1abjpr6bix15 , _:node1abjpr6bix28 , _:node1abjpr6bix20 , _:node1abjpr6bix24 , _:node1abjpr6bix32 , _:node1abjpr6bix47 , _:node1abjpr6bix41 , _:node1abjpr6bix44 , _:node1abjpr6bix38 , _:node1abjpr6bix51 , _:node1abjpr6bix56 , _:node1abjpr6bix61 , _:node1abjpr6bix66 , _:node1abjpr6bix70 , _:node1abjpr6bix74 , _:node1abjpr6bix78 , _:node1abjpr6bix81 , _:node1abjpr6bix85 , _:node1abjpr6bix89 , _:node1abjpr6bix93 , _:node1abjpr6bix97 , _:node1abjpr6bix101 , _:node1abjpr6bix104 , _:node1abjpr6bix106 , _:node1abjpr6bix110 , _:node1abjpr6bix114 , _:node1abjpr6bix119 , _:node1abjpr6bix123 , _:node1abjpr6bix10 , _:node1abjpr6bix15 , _:node1abjpr6bix28 , _:node1abjpr6bix20 , _:node1abjpr6bix24 , _:node1abjpr6bix32 , _:node1abjpr6bix47 , _:node1abjpr6bix41 , _:node1abjpr6bix44 , _:node1abjpr6bix38 , _:node1abjpr6bix51 , _:node1abjpr6bix56 , _:node1abjpr6bix61 , _:node1abjpr6bix66 , _:node1abjpr6bix70 , _:node1abjpr6bix74 , _:node1abjpr6bix78 , _:node1abjpr6bix81 , _:node1abjpr6bix85 , _:node1abjpr6bix89 , _:node1abjpr6bix93 , _:node1abjpr6bix97 , _:node1abjpr6bix101 , _:node1abjpr6bix104 , _:node1abjpr6bix106 , _:node1abjpr6bix110 , _:node1abjpr6bix114 , _:node1abjpr6bix119 , _:node1abjpr6bix123 . - diff --git a/LARAI/eclipse.build b/LARAI/eclipse.build deleted file mode 100644 index a66d24bc7..000000000 --- a/LARAI/eclipse.build +++ /dev/null @@ -1,5 +0,0 @@ -https://github.com/specs-feup/lara-framework -https://github.com/specs-feup/specs-java-libs ---build ---project LARAI ---main larai.LaraI diff --git a/LARAI/ivy.xml b/LARAI/ivy.xml deleted file mode 100644 index b009ed4f4..000000000 --- a/LARAI/ivy.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/LARAI/resources/larai/resources/img/about.gif b/LARAI/resources/larai/resources/img/about.gif deleted file mode 100644 index 04da95eb8..000000000 Binary files a/LARAI/resources/larai/resources/img/about.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/all.gif b/LARAI/resources/larai/resources/img/all.gif deleted file mode 100644 index bda97a04c..000000000 Binary files a/LARAI/resources/larai/resources/img/all.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/aspect.png b/LARAI/resources/larai/resources/img/aspect.png deleted file mode 100644 index b92abd99f..000000000 Binary files a/LARAI/resources/larai/resources/img/aspect.png and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/cancel.gif b/LARAI/resources/larai/resources/img/cancel.gif deleted file mode 100644 index 76596dd51..000000000 Binary files a/LARAI/resources/larai/resources/img/cancel.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/cancel_old.gif b/LARAI/resources/larai/resources/img/cancel_old.gif deleted file mode 100644 index 4b13c0c1f..000000000 Binary files a/LARAI/resources/larai/resources/img/cancel_old.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/clear.gif b/LARAI/resources/larai/resources/img/clear.gif deleted file mode 100644 index 6bc10f9d0..000000000 Binary files a/LARAI/resources/larai/resources/img/clear.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/close.gif b/LARAI/resources/larai/resources/img/close.gif deleted file mode 100644 index a54f28c6c..000000000 Binary files a/LARAI/resources/larai/resources/img/close.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/close_all.gif b/LARAI/resources/larai/resources/img/close_all.gif deleted file mode 100644 index 5a45975c2..000000000 Binary files a/LARAI/resources/larai/resources/img/close_all.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/codedef.png b/LARAI/resources/larai/resources/img/codedef.png deleted file mode 100644 index 131d72e1a..000000000 Binary files a/LARAI/resources/larai/resources/img/codedef.png and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/command_prompt.gif b/LARAI/resources/larai/resources/img/command_prompt.gif deleted file mode 100644 index 395b2af6c..000000000 Binary files a/LARAI/resources/larai/resources/img/command_prompt.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/console.gif b/LARAI/resources/larai/resources/img/console.gif deleted file mode 100644 index a598f6082..000000000 Binary files a/LARAI/resources/larai/resources/img/console.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/console_old.gif b/LARAI/resources/larai/resources/img/console_old.gif deleted file mode 100644 index bc278f9ae..000000000 Binary files a/LARAI/resources/larai/resources/img/console_old.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/copy.gif b/LARAI/resources/larai/resources/img/copy.gif deleted file mode 100644 index fa986813a..000000000 Binary files a/LARAI/resources/larai/resources/img/copy.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/cut.gif b/LARAI/resources/larai/resources/img/cut.gif deleted file mode 100644 index 14b73a857..000000000 Binary files a/LARAI/resources/larai/resources/img/cut.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/debug.gif b/LARAI/resources/larai/resources/img/debug.gif deleted file mode 100644 index ac5431fa3..000000000 Binary files a/LARAI/resources/larai/resources/img/debug.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/delete.gif b/LARAI/resources/larai/resources/img/delete.gif deleted file mode 100644 index 4b13c0c1f..000000000 Binary files a/LARAI/resources/larai/resources/img/delete.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/exit.gif b/LARAI/resources/larai/resources/img/exit.gif deleted file mode 100644 index 108e07005..000000000 Binary files a/LARAI/resources/larai/resources/img/exit.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/find.gif b/LARAI/resources/larai/resources/img/find.gif deleted file mode 100644 index abafbe28c..000000000 Binary files a/LARAI/resources/larai/resources/img/find.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/find_again.gif b/LARAI/resources/larai/resources/img/find_again.gif deleted file mode 100644 index 913292ad8..000000000 Binary files a/LARAI/resources/larai/resources/img/find_again.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/function.png b/LARAI/resources/larai/resources/img/function.png deleted file mode 100644 index f2445470d..000000000 Binary files a/LARAI/resources/larai/resources/img/function.png and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/help.gif b/LARAI/resources/larai/resources/img/help.gif deleted file mode 100644 index dc5c2d310..000000000 Binary files a/LARAI/resources/larai/resources/img/help.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/html.gif b/LARAI/resources/larai/resources/img/html.gif deleted file mode 100644 index 8587af9dc..000000000 Binary files a/LARAI/resources/larai/resources/img/html.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/license.gif b/LARAI/resources/larai/resources/img/license.gif deleted file mode 100644 index 9ce9c173d..000000000 Binary files a/LARAI/resources/larai/resources/img/license.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/mark.gif b/LARAI/resources/larai/resources/img/mark.gif deleted file mode 100644 index 1af4d3b30..000000000 Binary files a/LARAI/resources/larai/resources/img/mark.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/mark_old.gif b/LARAI/resources/larai/resources/img/mark_old.gif deleted file mode 100644 index 32b77eee2..000000000 Binary files a/LARAI/resources/larai/resources/img/mark_old.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/new.gif b/LARAI/resources/larai/resources/img/new.gif deleted file mode 100644 index 9d050885b..000000000 Binary files a/LARAI/resources/larai/resources/img/new.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/new_old.gif b/LARAI/resources/larai/resources/img/new_old.gif deleted file mode 100644 index 3513dfddb..000000000 Binary files a/LARAI/resources/larai/resources/img/new_old.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/open.gif b/LARAI/resources/larai/resources/img/open.gif deleted file mode 100644 index c4daba6fc..000000000 Binary files a/LARAI/resources/larai/resources/img/open.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/open_lara.gif b/LARAI/resources/larai/resources/img/open_lara.gif deleted file mode 100644 index a7565799b..000000000 Binary files a/LARAI/resources/larai/resources/img/open_lara.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/open_lara2.gif b/LARAI/resources/larai/resources/img/open_lara2.gif deleted file mode 100644 index 0847e5d41..000000000 Binary files a/LARAI/resources/larai/resources/img/open_lara2.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/open_lara_old.gif b/LARAI/resources/larai/resources/img/open_lara_old.gif deleted file mode 100644 index 0711fe8e4..000000000 Binary files a/LARAI/resources/larai/resources/img/open_lara_old.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/open_old.gif b/LARAI/resources/larai/resources/img/open_old.gif deleted file mode 100644 index fabd5676f..000000000 Binary files a/LARAI/resources/larai/resources/img/open_old.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/paste.gif b/LARAI/resources/larai/resources/img/paste.gif deleted file mode 100644 index f118c7eab..000000000 Binary files a/LARAI/resources/larai/resources/img/paste.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/prefs.gif b/LARAI/resources/larai/resources/img/prefs.gif deleted file mode 100644 index 32b77eee2..000000000 Binary files a/LARAI/resources/larai/resources/img/prefs.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/projects.gif b/LARAI/resources/larai/resources/img/projects.gif deleted file mode 100644 index f313e7e1d..000000000 Binary files a/LARAI/resources/larai/resources/img/projects.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/redo.gif b/LARAI/resources/larai/resources/img/redo.gif deleted file mode 100644 index 8fdd814c2..000000000 Binary files a/LARAI/resources/larai/resources/img/redo.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/replace.gif b/LARAI/resources/larai/resources/img/replace.gif deleted file mode 100644 index 69bc43262..000000000 Binary files a/LARAI/resources/larai/resources/img/replace.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/run.gif b/LARAI/resources/larai/resources/img/run.gif deleted file mode 100644 index 57f410224..000000000 Binary files a/LARAI/resources/larai/resources/img/run.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/run_old.gif b/LARAI/resources/larai/resources/img/run_old.gif deleted file mode 100644 index 99c4619c5..000000000 Binary files a/LARAI/resources/larai/resources/img/run_old.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/save.gif b/LARAI/resources/larai/resources/img/save.gif deleted file mode 100644 index 499dd0ca6..000000000 Binary files a/LARAI/resources/larai/resources/img/save.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/save_all.gif b/LARAI/resources/larai/resources/img/save_all.gif deleted file mode 100644 index ef0eab5ba..000000000 Binary files a/LARAI/resources/larai/resources/img/save_all.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/save_all_old.gif b/LARAI/resources/larai/resources/img/save_all_old.gif deleted file mode 100644 index 2d31c8b2c..000000000 Binary files a/LARAI/resources/larai/resources/img/save_all_old.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/save_as.gif b/LARAI/resources/larai/resources/img/save_as.gif deleted file mode 100644 index 466bfb112..000000000 Binary files a/LARAI/resources/larai/resources/img/save_as.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/save_as_old.gif b/LARAI/resources/larai/resources/img/save_as_old.gif deleted file mode 100644 index 8d3929c8a..000000000 Binary files a/LARAI/resources/larai/resources/img/save_as_old.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/save_old.gif b/LARAI/resources/larai/resources/img/save_old.gif deleted file mode 100644 index 954f1accd..000000000 Binary files a/LARAI/resources/larai/resources/img/save_old.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/sidebar.gif b/LARAI/resources/larai/resources/img/sidebar.gif deleted file mode 100644 index ad004d87b..000000000 Binary files a/LARAI/resources/larai/resources/img/sidebar.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/test.gif b/LARAI/resources/larai/resources/img/test.gif deleted file mode 100644 index 99c4619c5..000000000 Binary files a/LARAI/resources/larai/resources/img/test.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/img/undo.gif b/LARAI/resources/larai/resources/img/undo.gif deleted file mode 100644 index 5731d2d34..000000000 Binary files a/LARAI/resources/larai/resources/img/undo.gif and /dev/null differ diff --git a/LARAI/resources/larai/resources/tools.xml b/LARAI/resources/larai/resources/tools.xml deleted file mode 100644 index ec6ad31d9..000000000 --- a/LARAI/resources/larai/resources/tools.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - tools.xilinx.xst - tools.xilinx.xpr - tools.xilinx.ngdbuild - tools.xilinx.map - tools.xilinx.par - - - - - - - diff --git a/LARAI/resources/larai/test/api/AccumulatorTest.js b/LARAI/resources/larai/test/api/AccumulatorTest.js new file mode 100644 index 000000000..110e7e9d7 --- /dev/null +++ b/LARAI/resources/larai/test/api/AccumulatorTest.js @@ -0,0 +1,28 @@ +import Accumulator from "@specs-feup/lara/api/lara/util/Accumulator.js"; + +const acc = new Accumulator(); + +// Add as tuple +acc.add("step1", "step2"); + +// Add as array +acc.add(["step1", "step2"]); + +// Add with common subchain +acc.add(["step1", "step2.1"]); + +// Add just subchain +acc.add("step1"); +acc.add("step1"); +acc.add(["step1"]); + +// Get by tuple +console.log("Tuple get:" + acc.get("step1", "step2")); + +// Get by array +console.log("Array get:" + acc.get(["step1", "step2"])); + +// Use keys to print contents +for(let key of acc.keys()) { + console.log("key: " + key.join(", ") + " -> value: " + acc.get(key)); +} diff --git a/LARAI/resources/larai/test/api/AccumulatorTest.lara b/LARAI/resources/larai/test/api/AccumulatorTest.lara deleted file mode 100644 index af21f2002..000000000 --- a/LARAI/resources/larai/test/api/AccumulatorTest.lara +++ /dev/null @@ -1,33 +0,0 @@ -import lara.util.Accumulator; - -aspectdef AccumulatorTest - - var acc = new Accumulator(); - - // Add as tuple - acc.add("step1", "step2"); - - // Add as array - acc.add(["step1", "step2"]); - - // Add with common subchain - acc.add(["step1", "step2.1"]); - - // Add just subchain - acc.add("step1"); - acc.add("step1"); - acc.add(["step1"]); - - // Get by tuple - println("Tuple get:" + acc.get("step1", "step2")); - - // Get by array - println("Array get:" + acc.get(["step1", "step2"])); - - // Use keys to print contents - for(var key of acc.keys()) { - println("key: " + key.join(", ") + " -> value: " + acc.get(key)); - } - - -end diff --git a/LARAI/resources/larai/test/api/CallInFunction.lara b/LARAI/resources/larai/test/api/CallInFunction.lara deleted file mode 100644 index a65589e4f..000000000 --- a/LARAI/resources/larai/test/api/CallInFunction.lara +++ /dev/null @@ -1,11 +0,0 @@ -aspectdef CallInFunction - ACaller(); -end - -aspectdef A - println("Calling A"); -end - -function ACaller() { - call A; -} \ No newline at end of file diff --git a/LARAI/resources/larai/test/api/CheckpointTest.js b/LARAI/resources/larai/test/api/CheckpointTest.js new file mode 100644 index 000000000..65dfe0e36 --- /dev/null +++ b/LARAI/resources/larai/test/api/CheckpointTest.js @@ -0,0 +1,49 @@ +import Checkpoint from "@specs-feup/lara/api/lara/util/Checkpoint.js"; +import Io from "@specs-feup/lara/api/lara/Io.js"; +import System from "@specs-feup/lara/api/lara/System.js"; +import { TimerUnit } from "@specs-feup/lara/api/lara/util/TimeUnits.js"; +import { printObject } from "@specs-feup/lara/api/core/output.js"; + + +const checkpoint = new Checkpoint("test_checkpoint"); + +let object = {}; +object.aNumber = 10; +object.aString = "Hello"; +object.anObject = {}; +object.anObject.anotherNumber = 100; +object.anArray = [1, 2, 3, 5, 7, 11]; + +let checkedObject = checkpoint.monitor(object); + +// No interval set, perform immediate checkpoint +checkpoint.save(); + +// Check that checkpoint file exists +console.log("checkpoint exists: " + Io.isFile(checkpoint.getCheckpointFile())); + +// Change number +checkedObject.aNumber = 20; + +// Set a minum interval of 1 second +checkpoint.setInterval(1, TimerUnit.SECONDS); + +// Save immediatly, there should be no changes due to the interval +checkpoint.save(); + +console.log("Is 10? " + Io.readJson(checkpoint.getCheckpointFile()).aNumber); + +// Sleep for 1 second +System.sleep(1000); + +// Save again +checkpoint.save(); + +// Check that number is saved +console.log("Is 20? " + Io.readJson(checkpoint.getCheckpointFile()).aNumber); + +// Print saved object +printObject(Io.readJson(checkpoint.getCheckpointFile())); + +// Stop checkpoint +checkpoint.stop(); diff --git a/LARAI/resources/larai/test/api/CheckpointTest.lara b/LARAI/resources/larai/test/api/CheckpointTest.lara deleted file mode 100644 index fa9b24911..000000000 --- a/LARAI/resources/larai/test/api/CheckpointTest.lara +++ /dev/null @@ -1,51 +0,0 @@ -import lara.util.Checkpoint; -import lara.Io; -import lara.System; -import lara.util.TimeUnits; - - -aspectdef CheckpointTest - - var checkpoint = new Checkpoint("test_checkpoint"); - - var object = {}; - object.aNumber = 10; - object.aString = "Hello"; - object.anObject = {}; - object.anObject.anotherNumber = 100; - object.anArray = [1, 2, 3, 5, 7, 11]; - - var checkedObject = checkpoint.monitor(object); - - // No interval set, perform immediate checkpoint - checkpoint.save(); - - // Check that checkpoint file exists - println("checkpoint exists: " + Io.isFile(checkpoint.getCheckpointFile())); - - // Change number - checkedObject.aNumber = 20; - - // Set a minum interval of 1 second - checkpoint.setInterval(1, TimerUnit.SECONDS); - - // Save immediatly, there should be no changes due to the interval - checkpoint.save(); - - println("Is 10? " + Io.readJson(checkpoint.getCheckpointFile()).aNumber); - - // Sleep for 1 second - System.sleep(1000); - - // Save again - checkpoint.save(); - - // Check that number is saved - println("Is 20? " + Io.readJson(checkpoint.getCheckpointFile()).aNumber); - - // Print saved object - printObject(Io.readJson(checkpoint.getCheckpointFile())); - - // Stop checkpoint - checkpoint.stop(); -end diff --git a/LARAI/resources/larai/test/api/CsvTest.js b/LARAI/resources/larai/test/api/CsvTest.js new file mode 100644 index 000000000..fdb743b84 --- /dev/null +++ b/LARAI/resources/larai/test/api/CsvTest.js @@ -0,0 +1,7 @@ +import Csv from "@specs-feup/lara/api/lara/Csv.js"; +import { printObject } from "@specs-feup/lara/api/core/output.js"; + +const csvContents = + "name, col1, col2, col3\n" + "line1, 1, 2, 3\n" + "line2, 2, 4, 8"; + +printObject(Csv.parse(csvContents)); diff --git a/LARAI/resources/larai/test/api/CsvTest.lara b/LARAI/resources/larai/test/api/CsvTest.lara deleted file mode 100644 index 29d5fff74..000000000 --- a/LARAI/resources/larai/test/api/CsvTest.lara +++ /dev/null @@ -1,11 +0,0 @@ -import lara.Csv; - -aspectdef CsvTest - - var csvContents = "name, col1, col2, col3\n" + - "line1, 1, 2, 3\n"+ - "line2, 2, 4, 8"; - - printObject(Csv.parse(csvContents)); -end - diff --git a/LARAI/resources/larai/test/api/IoTest.js b/LARAI/resources/larai/test/api/IoTest.js new file mode 100644 index 000000000..2b5d7b567 --- /dev/null +++ b/LARAI/resources/larai/test/api/IoTest.js @@ -0,0 +1,27 @@ +import Io from "@specs-feup/lara/api/lara/Io.js"; + +function getName(file) { + return file.getName(); +} + +const testFolder = Io.mkdir("__ioTest__"); +const testFile1 = Io.writeFile(Io.getPath(testFolder, "test1.txt"), "test1"); +const testFile2 = Io.writeFile(Io.getPath(testFolder, "test2.txt"), "test2"); +const testFile3 = Io.writeFile(Io.getPath(testFolder, "test3.doc"), "test3"); + +const files = Io.getPaths(testFolder, "*.txt"); +console.log("Files: " + files.map(getName).sort().join()); + +const filesNoArg = Io.getPaths(testFolder); +console.log("Files no arg: " + filesNoArg.map(getName).sort().join()); + +Io.deleteFolder(testFolder); + + +// Path separator +const pathSeparator = Io.getPathSeparator(); +console.log("Path separator: " + (pathSeparator === ":" || pathSeparator === ";")); + +// Name separator +const separator = Io.getSeparator(); +console.log("Name separator: " + (separator === "\\" || separator === "/")); diff --git a/LARAI/resources/larai/test/api/IoTest.lara b/LARAI/resources/larai/test/api/IoTest.lara deleted file mode 100644 index 4d943d51f..000000000 --- a/LARAI/resources/larai/test/api/IoTest.lara +++ /dev/null @@ -1,31 +0,0 @@ -import lara.Io; - -aspectdef IoTest - - var testFolder = Io.mkdir("__ioTest__"); - var testFile1 = Io.writeFile(Io.getPath(testFolder, "test1.txt"), "test1"); - var testFile2 = Io.writeFile(Io.getPath(testFolder, "test2.txt"), "test2"); - var testFile3 = Io.writeFile(Io.getPath(testFolder, "test3.doc"), "test3"); - - var files = Io.getPaths(testFolder, "*.txt"); - println("Files: " + files.map(getName).sort().join()); - - var filesNoArg = Io.getPaths(testFolder); - println("Files no arg: " + filesNoArg.map(getName).sort().join()); - - Io.deleteFolder(testFolder); - - - // Path separator - var pathSeparator = Io.getPathSeparator(); - println("Path separator: " + (pathSeparator === ":" || pathSeparator === ";")); - - // Name separator - var separator = Io.getSeparator(); - println("Name separator: " + (separator === "\\" || separator === "/")); - -end - -function getName(file) { - return file.getName(); -} \ No newline at end of file diff --git a/LARAI/resources/larai/test/api/LaraCoreTest.js b/LARAI/resources/larai/test/api/LaraCoreTest.js index b950f8636..90112ba58 100644 --- a/LARAI/resources/larai/test/api/LaraCoreTest.js +++ b/LARAI/resources/larai/test/api/LaraCoreTest.js @@ -1,2 +1,24 @@ -const a = coreFoo(); -println(a); +import { arrayFromArgs } from "@specs-feup/lara/api/lara/core/LaraCore.js"; + +function arrayFromArgsTest() { + return arrayFromArgs(arguments); +} + +function arrayFromArgsAfterOneTest() { + return arrayFromArgs(arguments, 1); +} + +// Single element +console.log("len:", arrayFromArgsTest("Hello").length); + +// Several elements +console.log("len:", arrayFromArgsTest("Hello", "World").length); + +// Single array +console.log("len:", arrayFromArgsTest(["Hello", "World"]).length); + +// Single element after 1 +console.log("len:", arrayFromArgsAfterOneTest("Hello").length); + +// Several elements after 1 +console.log("len:", arrayFromArgsAfterOneTest("Hello", "World").length); diff --git a/LARAI/resources/larai/test/api/LaraCoreTest.lara b/LARAI/resources/larai/test/api/LaraCoreTest.lara deleted file mode 100644 index 86ea4854d..000000000 --- a/LARAI/resources/larai/test/api/LaraCoreTest.lara +++ /dev/null @@ -1,27 +0,0 @@ -aspectdef LaraCoreTest - - // Single element - println(arrayFromArgsTest("Hello").length); - - // Several elements - println(arrayFromArgsTest("Hello", "World").length); - - // Single array - println(arrayFromArgsTest(["Hello", "World"]).length); - - // Single element after 1 - println(arrayFromArgsAfterOneTest("Hello").length); - - // Several elements after 1 - println(arrayFromArgsAfterOneTest("Hello", "World").length); - -end - - -function arrayFromArgsTest() { - return arrayFromArgs(arguments); -} - -function arrayFromArgsAfterOneTest() { - return arrayFromArgs(arguments, 1); -} \ No newline at end of file diff --git a/LARAI/resources/larai/test/api/LocalFolderTest.js b/LARAI/resources/larai/test/api/LocalFolderTest.js new file mode 100644 index 000000000..dcd763b95 --- /dev/null +++ b/LARAI/resources/larai/test/api/LocalFolderTest.js @@ -0,0 +1,6 @@ +import LocalFolder from "@specs-feup/lara/api/lara/util/LocalFolder.js"; + +const localFolder = new LocalFolder("./"); + +console.log("FileList:" + localFolder.getFileList()); +console.log("FileList ANT:" + localFolder.getFileList("ant")); diff --git a/LARAI/resources/larai/test/api/LocalFolderTest.lara b/LARAI/resources/larai/test/api/LocalFolderTest.lara deleted file mode 100644 index 09403491c..000000000 --- a/LARAI/resources/larai/test/api/LocalFolderTest.lara +++ /dev/null @@ -1,13 +0,0 @@ -import lara.util.LocalFolder; - -aspectdef LocalFolderTest - - var localFolder = new LocalFolder("./"); - - println("FileList:" + localFolder.getFileList()); - println("FileList ANT:" + localFolder.getFileList("ant")); - - //println("Escaped HTML: " + Strings.escapeHtml("

Hello

")); - //var files = Io.getPaths("src/larai", "*.java"); - //println("Files: " + files.join()); -end diff --git a/LARAI/resources/larai/test/api/PlatformsTest.js b/LARAI/resources/larai/test/api/PlatformsTest.js new file mode 100644 index 000000000..3754bb34c --- /dev/null +++ b/LARAI/resources/larai/test/api/PlatformsTest.js @@ -0,0 +1,6 @@ +import Platforms from "@specs-feup/lara/api/lara/Platforms.js"; + +console.log("Is Windows? " + Platforms.isWindows()); +Platforms.setLinux(); +console.log("Is Windows? " + Platforms.isWindows()); +console.log("Is Linux? " + Platforms.isLinux()); diff --git a/LARAI/resources/larai/test/api/PlatformsTest.lara b/LARAI/resources/larai/test/api/PlatformsTest.lara deleted file mode 100644 index 0fa2f46a3..000000000 --- a/LARAI/resources/larai/test/api/PlatformsTest.lara +++ /dev/null @@ -1,9 +0,0 @@ -import lara.Platforms; - -aspectdef PlatformsTest - - println("Is Windows? " + Platforms.isWindows()); - Platforms.setLinux(); - println("Is Windows? " + Platforms.isWindows()); - println("Is Linux? " + Platforms.isLinux()); -end diff --git a/LARAI/resources/larai/test/api/ReplacerTest.js b/LARAI/resources/larai/test/api/ReplacerTest.js new file mode 100644 index 000000000..599ccb8ef --- /dev/null +++ b/LARAI/resources/larai/test/api/ReplacerTest.js @@ -0,0 +1,28 @@ +import Io from "@specs-feup/lara/api/lara/Io.js"; +import Replacer from "@specs-feup/lara/api/lara/util/Replacer.js"; + +const replacer1 = new Replacer("a template "); +console.log( + "Replacer 1: " + + replacer1.replaceAll("", "string").getString() +); + +const tempTemplate = "temp_template.txt"; +Io.writeFile(tempTemplate, "another template "); + +const replacer2 = new Replacer(Io.getPath(tempTemplate)); +replacer2.replaceAll("", "string"); +console.log("Replacer 2: " + replacer2.getString()); + +const replacer3 = Replacer.fromFilename(tempTemplate); +replacer3.replaceAll("", "string again"); +console.log("Replacer 3: " + replacer3.getString()); + +const string4 = new Replacer(", ") + .replaceAll("", "first string") + .replaceAll("", "second string") + .getString(); + +console.log("Replacer 4: " + string4); + +Io.deleteFile(tempTemplate); diff --git a/LARAI/resources/larai/test/api/ReplacerTest.lara b/LARAI/resources/larai/test/api/ReplacerTest.lara deleted file mode 100644 index a6cd3cb59..000000000 --- a/LARAI/resources/larai/test/api/ReplacerTest.lara +++ /dev/null @@ -1,30 +0,0 @@ -import lara.Io; -import lara.util.Replacer; - -aspectdef ReplacerTest - - var replacer1 = new Replacer("a template "); - println("Replacer 1: " + replacer1.replaceAll("", "string").getString()); - - var tempTemplate = "temp_template.txt"; - Io.writeFile(tempTemplate, "another template "); - - var replacer2 = new Replacer(Io.getPath(tempTemplate)); - replacer2.replaceAll("", "string"); - println("Replacer 2: " + replacer2.getString()); - - var replacer3 = Replacer.fromFilename(tempTemplate); - replacer3.replaceAll("", "string again"); - println("Replacer 3: " + replacer3.getString()); - - var string4 = (new Replacer(", ")) - .replaceAll("", "first string") - .replaceAll("", "second string") - .getString(); - - println("Replacer 4: " + string4); - - Io.deleteFile(tempTemplate); - -end - diff --git a/LARAI/resources/larai/test/api/StringsTest.js b/LARAI/resources/larai/test/api/StringsTest.js new file mode 100644 index 000000000..41e5e0fcd --- /dev/null +++ b/LARAI/resources/larai/test/api/StringsTest.js @@ -0,0 +1,7 @@ +import Strings from "@specs-feup/lara/api/lara/Strings.js"; + +console.log("Escaped HTML: " + Strings.escapeHtml("

Hello

")); + +// Replacer +console.log("Replacer 1: " + Strings.replacer("WWRWW", "WRW", "W")); +console.log("Replacer 2: " + Strings.replacer("W R W", /\s/g, "")); diff --git a/LARAI/resources/larai/test/api/StringsTest.lara b/LARAI/resources/larai/test/api/StringsTest.lara deleted file mode 100644 index 590e18807..000000000 --- a/LARAI/resources/larai/test/api/StringsTest.lara +++ /dev/null @@ -1,12 +0,0 @@ -import lara.Strings; - -aspectdef StringsTest - - println("Escaped HTML: " + Strings.escapeHtml("

Hello

")); - //var files = Io.getPaths("src/larai", "*.java"); - //println("Files: " + files.join()); - - // Replacer - println("Replacer 1: " + Strings.replacer("WWRWW", "WRW", "W")); - println("Replacer 2: " + Strings.replacer("W R W", /\s/g, "")); -end diff --git a/LARAI/resources/larai/test/api/SystemTest.js b/LARAI/resources/larai/test/api/SystemTest.js new file mode 100644 index 000000000..207bceea8 --- /dev/null +++ b/LARAI/resources/larai/test/api/SystemTest.js @@ -0,0 +1,5 @@ +import System from "@specs-feup/lara/api/lara/System.js"; + +console.log("Logical cores working: " + (System.getNumLogicalCores() > 0)); +console.log("Testing System.nanos()"); +System.nanos(); diff --git a/LARAI/resources/larai/test/api/SystemTest.lara b/LARAI/resources/larai/test/api/SystemTest.lara deleted file mode 100644 index 621444425..000000000 --- a/LARAI/resources/larai/test/api/SystemTest.lara +++ /dev/null @@ -1,10 +0,0 @@ -import lara.System; - -aspectdef SystemTest - - println("Logical cores working: " + (System.getNumLogicalCores() > 0)); - println("Testing System.nanos()"); - System.nanos(); - //var files = Io.getPaths("src/larai", "*.java"); - //println("Files: " + files.join()); -end diff --git a/LARAI/resources/larai/test/api/ThisTest.lara b/LARAI/resources/larai/test/api/ThisTest.lara deleted file mode 100644 index 7cafaba1d..000000000 --- a/LARAI/resources/larai/test/api/ThisTest.lara +++ /dev/null @@ -1,32 +0,0 @@ -var A = function() { - this.attr = "hello"; -}; - - -A.prototype.test1 = function() { - return this["attr"]; -} - -A.prototype.test2 = function() { - var s = "attr"; - return this[s]; -} - -A.prototype.test3 = function() { - var s = "attr"; - this[s] = "World"; - - return this[s]; -} - -aspectdef Hello - - var a = new A(); - println("Prop:" + a["attr"]); - - var s = "attr"; - println("Prop with var:" + a[s]); - - println("Test 1:" + a.test1()); - println("Test 2:" + a.test2()); -end \ No newline at end of file diff --git a/LARAI/resources/larai/test/api/dse/DseValuesTest.js b/LARAI/resources/larai/test/api/dse/DseValuesTest.js new file mode 100644 index 000000000..4264fa7c0 --- /dev/null +++ b/LARAI/resources/larai/test/api/dse/DseValuesTest.js @@ -0,0 +1,29 @@ +import DseValuesList from "@specs-feup/lara/api/lara/dse/DseValuesList.js"; +import DseValuesSet from "@specs-feup/lara/api/lara/dse/DseValuesSet.js"; +import VariableVariant from "@specs-feup/lara/api/lara/dse/VariableVariant.js"; + +function dseValueTester(name, dseValues) { + console.log(name + " size: " + dseValues.getNumElements()); + console.log( + name + " num values per element: " + dseValues.getNumValuesPerElement() + ); + + const values = []; + while (dseValues.hasNext()) { + values.push(dseValues.next()); + } + + console.log(name + " values: " + values.join()); + + dseValues.reset(); + console.log(name + " hasNext: " + dseValues.hasNext()); +} + +const valuesList = new DseValuesList(1, 4, 5); +dseValueTester("List", valuesList); + +const valuesList2 = new DseValuesList(2, 8, 10); +const valuesSet = new DseValuesSet(valuesList, valuesList2); +dseValueTester("Set", valuesSet); + +const varVariant = new VariableVariant(["a", "b"], valuesSet); diff --git a/LARAI/resources/larai/test/api/dse/DseValuesTest.lara b/LARAI/resources/larai/test/api/dse/DseValuesTest.lara deleted file mode 100644 index 538012a88..000000000 --- a/LARAI/resources/larai/test/api/dse/DseValuesTest.lara +++ /dev/null @@ -1,31 +0,0 @@ -import lara.dse.DseValuesList; -import lara.dse.DseValuesSet; -import lara.dse.VariableVariant; - -aspectdef DseValuesTest - - var valuesList = new DseValuesList(1, 4, 5); - dseValueTester("List", valuesList); - - var valuesList2 = new DseValuesList(2, 8, 10); - var valuesSet = new DseValuesSet(valuesList, valuesList2); - dseValueTester("Set", valuesSet); - - var varVariant = new VariableVariant(["a", "b"], valuesSet); - -end - -function dseValueTester(name, dseValues) { - println(name + " size: " + dseValues.getNumElements()); - println(name + " num values per element: " + dseValues.getNumValuesPerElement()); - - var values = []; - while(dseValues.hasNext()) { - values.push(dseValues.next()); - } - - println(name + " values: " + values.join()); - - dseValues.reset(); - println(name + " hasNext: " + dseValues.hasNext()); -} \ No newline at end of file diff --git a/LARAI/resources/larai/test/api/graphs/BasicGraphTest.js b/LARAI/resources/larai/test/api/graphs/BasicGraphTest.js index fc206ddc5..02407b67a 100644 --- a/LARAI/resources/larai/test/api/graphs/BasicGraphTest.js +++ b/LARAI/resources/larai/test/api/graphs/BasicGraphTest.js @@ -1,36 +1,36 @@ -laraImport("lara.graphs.Graphs"); -laraImport("lara.graphs.NodeData"); -laraImport("lara.graphs.EdgeData"); +import Graphs from "@specs-feup/lara/api/lara/graphs/Graphs.js"; +import NodeData from "@specs-feup/lara/api/lara/graphs/NodeData.js"; +import EdgeData from "@specs-feup/lara/api/lara/graphs/EdgeData.js"; -var graph = Graphs.newGraph(); +const graph = Graphs.newGraph(); -var node1 = Graphs.addNode(graph, { a: "test", b: true }); -println("Node 1 id() is string: " + (typeof node1.id() === "string")); -println("Node 1 data() is NodeData: " + (node1.data() instanceof NodeData)); -println( - "Node 1 data correct: " + - (node1.data().a === "test" && node1.data().b === true) +const node1 = Graphs.addNode(graph, { a: "test", b: true }); +console.log("Node 1 id() is string: " + (typeof node1.id() === "string")); +console.log("Node 1 data() is NodeData: " + (node1.data() instanceof NodeData)); +console.log( + "Node 1 data correct: " + + (node1.data().a === "test" && node1.data().b === true) ); -var node2Data = new NodeData(); +let node2Data = new NodeData(); node2Data.a = "test2"; node2Data.b = 10; -var node2 = Graphs.addNode(graph, node2Data); -println("Node 2 id() is string: " + (typeof node2.id() === "string")); -println("Node 2 data() is NodeData: " + (node2.data() instanceof NodeData)); -println( - "Node 2 data correct: " + - (node2.data().a === "test2" && node2.data().b === 10) +const node2 = Graphs.addNode(graph, node2Data); +console.log("Node 2 id() is string: " + (typeof node2.id() === "string")); +console.log("Node 2 data() is NodeData: " + (node2.data() instanceof NodeData)); +console.log( + "Node 2 data correct: " + + (node2.data().a === "test2" && node2.data().b === 10) ); -var edge1 = Graphs.addEdge(graph, node1, node2, { type: "raw" }); -println("Edge 1 id() is string: " + (typeof edge1.id() === "string")); -println("Edge 1 data() is EdgeData: " + (edge1.data() instanceof EdgeData)); -println("Edge 1 data correct: " + (edge1.data().type === "raw")); +const edge1 = Graphs.addEdge(graph, node1, node2, { type: "raw" }); +console.log("Edge 1 id() is string: " + (typeof edge1.id() === "string")); +console.log("Edge 1 data() is EdgeData: " + (edge1.data() instanceof EdgeData)); +console.log("Edge 1 data correct: " + (edge1.data().type === "raw")); -var edge2Data = new EdgeData(); +let edge2Data = new EdgeData(); edge2Data.type = "managed"; -var edge2 = Graphs.addEdge(graph, node1, node2, edge2Data); -println("Edge 2 id() is string: " + (typeof edge2.id() === "string")); -println("Edge 2 data() is EdgeData: " + (edge2.data() instanceof EdgeData)); -println("Edge 2 data correct: " + (edge2.data().type === "managed")); +const edge2 = Graphs.addEdge(graph, node1, node2, edge2Data); +console.log("Edge 2 id() is string: " + (typeof edge2.id() === "string")); +console.log("Edge 2 data() is EdgeData: " + (edge2.data() instanceof EdgeData)); +console.log("Edge 2 data correct: " + (edge2.data().type === "managed")); diff --git a/LARAI/resources/larai/test/api/iterators/LineIteratorTest.js b/LARAI/resources/larai/test/api/iterators/LineIteratorTest.js new file mode 100644 index 000000000..a81971588 --- /dev/null +++ b/LARAI/resources/larai/test/api/iterators/LineIteratorTest.js @@ -0,0 +1,52 @@ +import LineIterator from "@specs-feup/lara/api/lara/iterators/LineIterator.js"; +import Io from "@specs-feup/lara/api/lara/Io.js"; +import { checkTrue } from "@specs-feup/lara/api/lara/core/LaraCore.js"; + +const stringContents = "Hello\nline2\n\nline 4"; + +// LineIterator from String +const stringLineIterator = new LineIterator(stringContents); +let stringTest = ""; +let isFirstLine = true; +while (stringLineIterator.hasNext()) { + const line = stringLineIterator.next(); + if (isFirstLine) { + isFirstLine = false; + } else { + stringTest += "\n"; + } + + stringTest += line; +} + +checkTrue( + stringTest === stringContents, + "Expected string to be the same as stringContents: " + stringTest +); + +// LineIterator from File +const filename = "line_iterator_test.txt"; +const file = Io.writeFile(filename, stringContents); +const fileLineIterator = new LineIterator(file); + +stringTest = ""; +isFirstLine = true; + +// Use javascript iterator +while (fileLineIterator.hasNext()) { + const line = fileLineIterator.next(); + if (isFirstLine) { + isFirstLine = false; + } else { + stringTest += "\n"; + } + + stringTest += line; +} + +checkTrue( + stringTest === stringContents, + "Expected file to be the same as stringContents: " + stringTest +); + +checkTrue(Io.deleteFile(file), "Unable to delete file: " + filename); diff --git a/LARAI/resources/larai/test/api/iterators/LineIteratorTest.lara b/LARAI/resources/larai/test/api/iterators/LineIteratorTest.lara deleted file mode 100644 index 7a46c0a53..000000000 --- a/LARAI/resources/larai/test/api/iterators/LineIteratorTest.lara +++ /dev/null @@ -1,57 +0,0 @@ -import lara.iterators.LineIterator; -import lara.Io; - -aspectdef LineIteratorTest - - var stringContents = "Hello\nline2\n\nline 4"; - - // LineIterator from String - var stringLineIterator = new LineIterator(stringContents); - var stringTest = ""; - var isFirstLine = true; - while(stringLineIterator.hasNext()) { - var line = stringLineIterator.next(); - if(isFirstLine) { - isFirstLine = false; - } else { - stringTest += "\n"; - } - - stringTest += line; - } - - checkTrue(stringTest === stringContents, "Expected string to be the same as stringContents: " + stringTest); - - // LineIterator from File - var filename = "line_iterator_test.txt"; - var file = Io.writeFile(filename, stringContents); - var fileLineIterator = new LineIterator(file); - - stringTest = ""; - isFirstLine = true; - - //var jsIterator = fileLineIterator.jsIterator(); - //println("JS ITERATOR:"); - //printObject(jsIterator); - - //println("Iterator next:" + jsIterator.next().value); - //println("Symbol.iterator before: " + fileLineIterator[Symbol.iterator]); -// fileLineIterator[Symbol.iterator] = function() {return new _JsIterator(fileLineIterator)}; -// println("Symbol.iterator after: " + fileLineIterator[Symbol.iterator]); - // Use javascript iterator - while(fileLineIterator.hasNext()) { - var line = fileLineIterator.next(); - if(isFirstLine) { - isFirstLine = false; - } else { - stringTest += "\n"; - } - - stringTest += line; - } - - checkTrue(stringTest === stringContents, "Expected file to be the same as stringContents: " + stringTest); - - - Io.deleteFile(file); -end diff --git a/LARAI/resources/larai/test/api/results/AccumulatorTest.lara.txt b/LARAI/resources/larai/test/api/results/AccumulatorTest.js.txt similarity index 100% rename from LARAI/resources/larai/test/api/results/AccumulatorTest.lara.txt rename to LARAI/resources/larai/test/api/results/AccumulatorTest.js.txt diff --git a/LARAI/resources/larai/test/api/results/CheckpointTest.lara.txt b/LARAI/resources/larai/test/api/results/CheckpointTest.js.txt similarity index 100% rename from LARAI/resources/larai/test/api/results/CheckpointTest.lara.txt rename to LARAI/resources/larai/test/api/results/CheckpointTest.js.txt diff --git a/LARAI/resources/larai/test/api/results/CsvTest.lara.txt b/LARAI/resources/larai/test/api/results/CsvTest.js.txt similarity index 100% rename from LARAI/resources/larai/test/api/results/CsvTest.lara.txt rename to LARAI/resources/larai/test/api/results/CsvTest.js.txt diff --git a/LARAI/resources/larai/test/api/results/IoTest.lara.txt b/LARAI/resources/larai/test/api/results/IoTest.js.txt similarity index 100% rename from LARAI/resources/larai/test/api/results/IoTest.lara.txt rename to LARAI/resources/larai/test/api/results/IoTest.js.txt diff --git a/LARAI/resources/larai/test/api/results/LaraCoreTest.js.txt b/LARAI/resources/larai/test/api/results/LaraCoreTest.js.txt new file mode 100644 index 000000000..0264214f3 --- /dev/null +++ b/LARAI/resources/larai/test/api/results/LaraCoreTest.js.txt @@ -0,0 +1,5 @@ +len: 1 +len: 2 +len: 2 +len: 0 +len: 1 diff --git a/LARAI/resources/larai/test/api/results/LaraCoreTest.lara.txt b/LARAI/resources/larai/test/api/results/LaraCoreTest.lara.txt deleted file mode 100644 index 66e33c9e0..000000000 --- a/LARAI/resources/larai/test/api/results/LaraCoreTest.lara.txt +++ /dev/null @@ -1,5 +0,0 @@ -1 -2 -2 -0 -1 \ No newline at end of file diff --git a/LARAI/resources/larai/test/api/results/ReplacerTest.lara.txt b/LARAI/resources/larai/test/api/results/ReplacerTest.js.txt similarity index 100% rename from LARAI/resources/larai/test/api/results/ReplacerTest.lara.txt rename to LARAI/resources/larai/test/api/results/ReplacerTest.js.txt diff --git a/LARAI/resources/larai/test/api/results/StringsTest.lara.txt b/LARAI/resources/larai/test/api/results/StringsTest.js.txt similarity index 100% rename from LARAI/resources/larai/test/api/results/StringsTest.lara.txt rename to LARAI/resources/larai/test/api/results/StringsTest.js.txt diff --git a/LARAI/resources/larai/test/api/results/SystemTest.lara.txt b/LARAI/resources/larai/test/api/results/SystemTest.js.txt similarity index 100% rename from LARAI/resources/larai/test/api/results/SystemTest.lara.txt rename to LARAI/resources/larai/test/api/results/SystemTest.js.txt diff --git a/LARAI/resources/larai/test/api/results/dse/DseValuesTest.lara.txt b/LARAI/resources/larai/test/api/results/dse/DseValuesTest.js.txt similarity index 100% rename from LARAI/resources/larai/test/api/results/dse/DseValuesTest.lara.txt rename to LARAI/resources/larai/test/api/results/dse/DseValuesTest.js.txt diff --git a/LARAI/resources/larai/test/api/results/units/EnergyUnitTest.lara.txt b/LARAI/resources/larai/test/api/results/units/EnergyUnitTest.js.txt similarity index 100% rename from LARAI/resources/larai/test/api/results/units/EnergyUnitTest.lara.txt rename to LARAI/resources/larai/test/api/results/units/EnergyUnitTest.js.txt diff --git a/LARAI/resources/larai/test/api/results/units/TimeUnitTest.lara.txt b/LARAI/resources/larai/test/api/results/units/TimeUnitTest.js.txt similarity index 100% rename from LARAI/resources/larai/test/api/results/units/TimeUnitTest.lara.txt rename to LARAI/resources/larai/test/api/results/units/TimeUnitTest.js.txt diff --git a/LARAI/resources/larai/test/api/results/util/ActionAwareCacheTest.js.txt b/LARAI/resources/larai/test/api/results/util/ActionAwareCacheTest.js.txt deleted file mode 100644 index e0dff3d4e..000000000 --- a/LARAI/resources/larai/test/api/results/util/ActionAwareCacheTest.js.txt +++ /dev/null @@ -1,7 +0,0 @@ -DATA BEFORE ACTION: -{ - foo: - bar -} -DATA AFTER ACTION: -undefined \ No newline at end of file diff --git a/LARAI/resources/larai/test/api/results/util/DataStoreTest.js.txt b/LARAI/resources/larai/test/api/results/util/DataStoreTest.js.txt new file mode 100644 index 000000000..199f2b4c7 --- /dev/null +++ b/LARAI/resources/larai/test/api/results/util/DataStoreTest.js.txt @@ -0,0 +1,4 @@ +GET:undefined +TYPE:class java.lang.Boolean +GET AFTER PUT:true +DataStore Context folder: . \ No newline at end of file diff --git a/LARAI/resources/larai/test/api/results/util/DataStoreTest.lara.txt b/LARAI/resources/larai/test/api/results/util/DataStoreTest.lara.txt deleted file mode 100644 index 76937b09b..000000000 --- a/LARAI/resources/larai/test/api/results/util/DataStoreTest.lara.txt +++ /dev/null @@ -1,4 +0,0 @@ -GET:true -TYPE:class java.lang.Boolean -GET AFTER PUT:false -DataStore Context folder: . \ No newline at end of file diff --git a/LARAI/resources/larai/test/api/results/util/JavaTypesTest.js.txt b/LARAI/resources/larai/test/api/results/util/JavaTypesTest.js.txt index bac34d99e..5a8c96025 100644 --- a/LARAI/resources/larai/test/api/results/util/JavaTypesTest.js.txt +++ b/LARAI/resources/larai/test/api/results/util/JavaTypesTest.js.txt @@ -1 +1 @@ -class java.lang.System \ No newline at end of file +java.lang.System \ No newline at end of file diff --git a/LARAI/resources/larai/test/api/results/util/LineInserterTest.lara.txt b/LARAI/resources/larai/test/api/results/util/LineInserterTest.js.txt similarity index 100% rename from LARAI/resources/larai/test/api/results/util/LineInserterTest.lara.txt rename to LARAI/resources/larai/test/api/results/util/LineInserterTest.js.txt diff --git a/LARAI/resources/larai/test/api/results/util/RandomTest.js.txt b/LARAI/resources/larai/test/api/results/util/RandomTest.js.txt index 9903dcb88..46d790062 100644 --- a/LARAI/resources/larai/test/api/results/util/RandomTest.js.txt +++ b/LARAI/resources/larai/test/api/results/util/RandomTest.js.txt @@ -2,7 +2,7 @@ 0.41008081149220166 0.20771484130971707 0.3327170559595112 -0.3322111278938803 -0.4049269428561847 -0.9896217633087794 -0.8108614978562696 +0.5799573179392316 +0.9201314687183513 +0.7390104504961117 +0.5576875695507968 diff --git a/LARAI/resources/larai/test/api/results/util/StringSetTest.js.txt b/LARAI/resources/larai/test/api/results/util/StringSetTest.js.txt index cc538aa1f..41a8ee82d 100644 --- a/LARAI/resources/larai/test/api/results/util/StringSetTest.js.txt +++ b/LARAI/resources/larai/test/api/results/util/StringSetTest.js.txt @@ -1 +1 @@ -{a, b} \ No newline at end of file +StringSet { set: Set(2) { 'a', 'b' } } diff --git a/LARAI/resources/larai/test/api/results/util/TupleIdTest.js.txt b/LARAI/resources/larai/test/api/results/util/TupleIdTest.js.txt new file mode 100644 index 000000000..368c7e977 --- /dev/null +++ b/LARAI/resources/larai/test/api/results/util/TupleIdTest.js.txt @@ -0,0 +1,11 @@ +id: 0 +id: 1 +id: 0 +id: 2 +id: 2 +id: 3 +Tuples: +0 -> a,b +1 -> a,b,c +2 -> a,hasOwnProperty,d +3 -> a,hasOwnProperty \ No newline at end of file diff --git a/LARAI/resources/larai/test/api/results/util/TupleIdTest.lara.txt b/LARAI/resources/larai/test/api/results/util/TupleIdTest.lara.txt deleted file mode 100644 index 91dc28837..000000000 --- a/LARAI/resources/larai/test/api/results/util/TupleIdTest.lara.txt +++ /dev/null @@ -1,11 +0,0 @@ -0 -1 -0 -2 -2 -3 -Tuples: -0 -> a,b -1 -> a,b,c -2 -> a,hasOwnProperty,d -3 -> a,hasOwnProperty \ No newline at end of file diff --git a/LARAI/resources/larai/test/api/units/EnergyUnitTest.js b/LARAI/resources/larai/test/api/units/EnergyUnitTest.js new file mode 100644 index 000000000..693db078e --- /dev/null +++ b/LARAI/resources/larai/test/api/units/EnergyUnitTest.js @@ -0,0 +1,6 @@ +import EnergyUnit from "@specs-feup/lara/api/lara/units/EnergyUnit.js"; +import SiModifier from "@specs-feup/lara/api/lara/units/SiModifier.js"; + +console.log("1J in uJ: " + new EnergyUnit(SiModifier.MICRO).convert(1, "J")); +console.log("1GJ in MJ: " + new EnergyUnit(SiModifier.MEGA).convert(1, "GJ")); +console.log("1kJ in J: " + new EnergyUnit().convert(1, "kJ")); diff --git a/LARAI/resources/larai/test/api/units/EnergyUnitTest.lara b/LARAI/resources/larai/test/api/units/EnergyUnitTest.lara deleted file mode 100644 index ceb389a01..000000000 --- a/LARAI/resources/larai/test/api/units/EnergyUnitTest.lara +++ /dev/null @@ -1,10 +0,0 @@ -import lara.units.EnergyUnit; -import lara.units.SiModifier; - -aspectdef EnergyUnitTest - - println("1J in uJ: " + (new EnergyUnit(SiModifier.MICRO)).convert(1, "J")); - println("1GJ in MJ: " + (new EnergyUnit(SiModifier.MEGA)).convert(1, "GJ")); - println("1kJ in J: " + (new EnergyUnit()).convert(1, "kJ")); - -end diff --git a/LARAI/resources/larai/test/api/units/TimeUnitTest.js b/LARAI/resources/larai/test/api/units/TimeUnitTest.js new file mode 100644 index 000000000..c892347ea --- /dev/null +++ b/LARAI/resources/larai/test/api/units/TimeUnitTest.js @@ -0,0 +1,4 @@ +import TimeUnit from "@specs-feup/lara/api/lara/units/TimeUnit.js"; + +console.log("10ms in us: " + TimeUnit.micro().convert(10, "ms")); +console.log("1 day in hours: " + TimeUnit.hour().convert(1, "days")); diff --git a/LARAI/resources/larai/test/api/units/TimeUnitTest.lara b/LARAI/resources/larai/test/api/units/TimeUnitTest.lara deleted file mode 100644 index ae15063a0..000000000 --- a/LARAI/resources/larai/test/api/units/TimeUnitTest.lara +++ /dev/null @@ -1,8 +0,0 @@ -import lara.units.TimeUnit; - -aspectdef TimeUnitTest - - println("10ms in us: " + TimeUnit.micro().convert(10, "ms")); - println("1 day in hours: " + TimeUnit.hour().convert(1, "days")); - -end diff --git a/LARAI/resources/larai/test/api/util/ActionAwareCacheTest.js b/LARAI/resources/larai/test/api/util/ActionAwareCacheTest.js deleted file mode 100644 index 5b2b03ba9..000000000 --- a/LARAI/resources/larai/test/api/util/ActionAwareCacheTest.js +++ /dev/null @@ -1,14 +0,0 @@ -laraImport("weaver.util.ActionAwareCache"); -laraImport("weaver.Weaver"); - -const data = {foo: "bar"} -const testCache = new ActionAwareCache(data); - -println("DATA BEFORE ACTION: "); -printlnObject(testCache.data); - -Weaver.getWeaverEngine().getRootJp().report(); - -println("DATA AFTER ACTION: "); -printlnObject(testCache.data); - diff --git a/LARAI/resources/larai/test/api/util/DataStoreTest.js b/LARAI/resources/larai/test/api/util/DataStoreTest.js new file mode 100644 index 000000000..b328b2282 --- /dev/null +++ b/LARAI/resources/larai/test/api/util/DataStoreTest.js @@ -0,0 +1,14 @@ +import DataStore from "@specs-feup/lara/api/lara/util/DataStore.js"; +import WeaverOptions from "@specs-feup/lara/api/weaver/WeaverOptions.js"; + +const dataStore = new DataStore(WeaverOptions.getData()); +const keyName = "debug"; +const originalValue = dataStore.get(keyName); + +console.log("GET:" + originalValue); +console.log("TYPE:" + dataStore.getType(keyName)); +dataStore.put(keyName, !originalValue); +console.log("GET AFTER PUT:" + dataStore.get(keyName)); +dataStore.put(keyName, originalValue); + +console.log("DataStore Context folder: " + dataStore.getContextFolder()); diff --git a/LARAI/resources/larai/test/api/util/DataStoreTest.lara b/LARAI/resources/larai/test/api/util/DataStoreTest.lara deleted file mode 100644 index 5dcafed75..000000000 --- a/LARAI/resources/larai/test/api/util/DataStoreTest.lara +++ /dev/null @@ -1,15 +0,0 @@ -import lara.util.DataStore; -import weaver.WeaverOptions; - -aspectdef DataStoreTest - - - var dataStore = new DataStore(WeaverOptions.getData()); - println("GET:" + dataStore.get("javascript")); - println("TYPE:" + dataStore.getType("javascript")); - dataStore.put("javascript", false); - println("GET AFTER PUT:" + dataStore.get("javascript")); - dataStore.put("javascript", true); - - println("DataStore Context folder: " + dataStore.getContextFolder()); -end diff --git a/LARAI/resources/larai/test/api/util/JavaTypesTest.js b/LARAI/resources/larai/test/api/util/JavaTypesTest.js index 055bbedd9..64026293b 100644 --- a/LARAI/resources/larai/test/api/util/JavaTypesTest.js +++ b/LARAI/resources/larai/test/api/util/JavaTypesTest.js @@ -1,4 +1,4 @@ -laraImport("lara.util.JavaTypes"); +import JavaTypes from "@specs-feup/lara/api/lara/util/JavaTypes.js"; const system = JavaTypes.getType("java.lang.System"); -println(system.class); +console.log(system.class.getName()); diff --git a/LARAI/resources/larai/test/api/util/LineInserterTest.js b/LARAI/resources/larai/test/api/util/LineInserterTest.js new file mode 100644 index 000000000..55f4e9e97 --- /dev/null +++ b/LARAI/resources/larai/test/api/util/LineInserterTest.js @@ -0,0 +1,14 @@ +import LineInserter from "@specs-feup/lara/api/lara/util/LineInserter.js"; +import Io from "@specs-feup/lara/api/lara/Io.js"; + +const stringContents = "Hello\nline2\n\nline 4"; +const linesToInsert = { 1: "// Inserted line at 1", 3: "// Inserted line at 3" }; + +const lineInserter = new LineInserter(); +console.log( + "Insert from string:\n" + lineInserter.add(stringContents, linesToInsert) +); + +const filename = "line_iterator_test.txt"; +const file = Io.writeFile(filename, stringContents); +console.log("Insert from file:\n" + lineInserter.add(file, linesToInsert)); diff --git a/LARAI/resources/larai/test/api/util/LineInserterTest.lara b/LARAI/resources/larai/test/api/util/LineInserterTest.lara deleted file mode 100644 index d551c4002..000000000 --- a/LARAI/resources/larai/test/api/util/LineInserterTest.lara +++ /dev/null @@ -1,16 +0,0 @@ -import lara.util.LineInserter; -import lara.Io; - -aspectdef LineInserterTest - - var stringContents = "Hello\nline2\n\nline 4"; - var linesToInsert = {1: "// Inserted line at 1", 3: "// Inserted line at 3"}; - - var lineInserter = new LineInserter(); - println("Insert from string:\n" + lineInserter.add(stringContents, linesToInsert)); - - var filename = "line_iterator_test.txt"; - var file = Io.writeFile(filename, stringContents); - println("Insert from file:\n" + lineInserter.add(file, linesToInsert)); - -end diff --git a/LARAI/resources/larai/test/api/util/PrintOnceTest.js b/LARAI/resources/larai/test/api/util/PrintOnceTest.js index 8d4af515d..f8afae5ad 100644 --- a/LARAI/resources/larai/test/api/util/PrintOnceTest.js +++ b/LARAI/resources/larai/test/api/util/PrintOnceTest.js @@ -1,22 +1,4 @@ -laraImport("lara.util.Replacer"); - -/* -let countBefore = 0; -for (const key in globalThis) { - countBefore++; -} -println("Global this # keys before:" + countBefore); -*/ - -laraImport("lara.util.PrintOnce"); - -/* -let countAfter = 0; -for (const key in globalThis) { - countAfter++; -} -println("Global this # keys after:" + countAfter); -*/ +import PrintOnce from "@specs-feup/lara/api/lara/util/PrintOnce.js"; PrintOnce.message("a"); PrintOnce.message("b"); diff --git a/LARAI/resources/larai/test/api/util/RandomTest.js b/LARAI/resources/larai/test/api/util/RandomTest.js index 7c7346ad6..c31e18346 100644 --- a/LARAI/resources/larai/test/api/util/RandomTest.js +++ b/LARAI/resources/larai/test/api/util/RandomTest.js @@ -1,4 +1,4 @@ -laraImport("lara.util.Random"); +import Random from "@specs-feup/lara/api/lara/util/Random.js"; const rand = new Random(); // Just to test it works @@ -6,14 +6,14 @@ rand.next(); const randSeed1 = new Random(1); -println(randSeed1.next()); -println(randSeed1.next()); -println(randSeed1.next()); -println(randSeed1.next()); +console.log(randSeed1.next()); +console.log(randSeed1.next()); +console.log(randSeed1.next()); +console.log(randSeed1.next()); -const randSeed2 = new Random(1678485728385); -println(randSeed2.next()); -println(randSeed2.next()); -println(randSeed2.next()); -println(randSeed2.next()); \ No newline at end of file +const randSeed2 = new Random(1678485728); +console.log(randSeed2.next()); +console.log(randSeed2.next()); +console.log(randSeed2.next()); +console.log(randSeed2.next()); \ No newline at end of file diff --git a/LARAI/resources/larai/test/api/util/StringSetTest.js b/LARAI/resources/larai/test/api/util/StringSetTest.js index f2a867635..b428a2390 100644 --- a/LARAI/resources/larai/test/api/util/StringSetTest.js +++ b/LARAI/resources/larai/test/api/util/StringSetTest.js @@ -1,8 +1,8 @@ -laraImport("lara.util.StringSet"); +import StringSet from "@specs-feup/lara/api/lara/util/StringSet.js"; const set = new StringSet(); set.add("a"); set.add("b"); set.add("a"); -println(set); +console.log(set); diff --git a/LARAI/resources/larai/test/api/util/TupleIdTest.js b/LARAI/resources/larai/test/api/util/TupleIdTest.js new file mode 100644 index 000000000..ac01bd30c --- /dev/null +++ b/LARAI/resources/larai/test/api/util/TupleIdTest.js @@ -0,0 +1,16 @@ +import TupleId from "@specs-feup/lara/api/lara/util/TupleId.js"; + +const tupleId = new TupleId(); + +console.log("id:", tupleId.getId("a", "b")); +console.log("id:", tupleId.getId("a", "b", "c")); +console.log("id:", tupleId.getId("a", "b")); +console.log("id:", tupleId.getId("a", "hasOwnProperty", "d")); +console.log("id:", tupleId.getId("a", "hasOwnProperty", "d")); +console.log("id:", tupleId.getId("a", "hasOwnProperty")); + +console.log("Tuples:"); +const tuples = tupleId.getTuples(); +for (let key in tuples) { + console.log(key + " -> " + tuples[key]); +} diff --git a/LARAI/resources/larai/test/api/util/TupleIdTest.lara b/LARAI/resources/larai/test/api/util/TupleIdTest.lara deleted file mode 100644 index 3c19ac773..000000000 --- a/LARAI/resources/larai/test/api/util/TupleIdTest.lara +++ /dev/null @@ -1,21 +0,0 @@ -import lara.util.TupleId; - -aspectdef TupleIdTest - - var tupleId = new TupleId(); - - println(tupleId.getId("a", "b")); - println(tupleId.getId("a", "b", "c")); - println(tupleId.getId("a", "b")); - println(tupleId.getId("a", "hasOwnProperty", "d")); - println(tupleId.getId("a", "hasOwnProperty", "d")); - println(tupleId.getId("a", "hasOwnProperty")); - - - println("Tuples:"); - var tuples = tupleId.getTuples(); - for(var key in tuples) { - println(key + " -> " + tuples[key]); - } - -end diff --git a/LARAI/resources/larai/test/commonlang/BasicCommonLang.lara b/LARAI/resources/larai/test/commonlang/BasicCommonLang.lara deleted file mode 100644 index 953321f28..000000000 --- a/LARAI/resources/larai/test/commonlang/BasicCommonLang.lara +++ /dev/null @@ -1,8 +0,0 @@ -import weaver.jp.FunctionJp; - -aspectdef BasicCommonLang - - var $function = new FunctionJp(); - printlnObject($function); - -end diff --git a/LARAI/resources/larai/test/jsengine/ArrowTest.js b/LARAI/resources/larai/test/jsengine/ArrowTest.js new file mode 100644 index 000000000..8284cda82 --- /dev/null +++ b/LARAI/resources/larai/test/jsengine/ArrowTest.js @@ -0,0 +1,41 @@ +const elements = [ + 'Hydrogen', + 'Helium', + 'Lithium', + 'Beryllium' +]; + +// This statement returns the array: [8, 6, 7, 9] +console.log(elements.map(function(element) {return element.length;})); + + +// The regular function above can be written as the arrow function below +console.log(elements.map((element) => { + return element.length; +})); // [8, 6, 7, 9] + +// When there is only one parameter, we can remove the surrounding parentheses +console.log(elements.map(element => { + return element.length; +})); // [8, 6, 7, 9] + +// When the only statement in an arrow function is `return`, we can remove `return` and remove +// the surrounding curly brackets +console.log(elements.map(element => element.length)); // [8, 6, 7, 9] + +console.log(elements.map(() => 10)); // [10, 10, 10, 10] + + + +/* + // In this case, because we only need the length property, we can use destructuring parameter: + // Notice that the `length` corresponds to the property we want to get whereas the + // obviously non-special `lengthFooBArX` is just the name of a variable which can be changed + // to any valid variable name you want + //elements.map(({ length: lengthFooBArX }) => lengthFooBArX); // [8, 6, 7, 9] + + // This destructuring parameter assignment can also be written as seen below. However, note that in + // this example we are not assigning `length` value to the made up property. Instead, the literal name + // itself of the variable `length` is used as the property we want to retrieve from the object. + //elements.map(({ length }) => length); // [8, 6, 7, 9] +*/ \ No newline at end of file diff --git a/LARAI/resources/larai/test/jsengine/ArrowTest.lara b/LARAI/resources/larai/test/jsengine/ArrowTest.lara deleted file mode 100644 index c1d7e3846..000000000 --- a/LARAI/resources/larai/test/jsengine/ArrowTest.lara +++ /dev/null @@ -1,45 +0,0 @@ -aspectdef ArrowTest - - var elements = [ - 'Hydrogen', - 'Helium', - 'Lithium', - 'Beryllium' - ]; - - // This statement returns the array: [8, 6, 7, 9] - println(elements.map(function(element) {return element.length;})); - - - // The regular function above can be written as the arrow function below - println(elements.map((element) => { - return element.length; - })); // [8, 6, 7, 9] - - // When there is only one parameter, we can remove the surrounding parentheses - println(elements.map(element => { - return element.length; - })); // [8, 6, 7, 9] - - // When the only statement in an arrow function is `return`, we can remove `return` and remove - // the surrounding curly brackets - println(elements.map(element => element.length)); // [8, 6, 7, 9] - - println(elements.map(() => 10)); // [10, 10, 10, 10] - -end - - - -/* - // In this case, because we only need the length property, we can use destructuring parameter: - // Notice that the `length` corresponds to the property we want to get whereas the - // obviously non-special `lengthFooBArX` is just the name of a variable which can be changed - // to any valid variable name you want - //elements.map(({ length: lengthFooBArX }) => lengthFooBArX); // [8, 6, 7, 9] - - // This destructuring parameter assignment can also be written as seen below. However, note that in - // this example we are not assigning `length` value to the made up property. Instead, the literal name - // itself of the variable `length` is used as the property we want to retrieve from the object. - //elements.map(({ length }) => length); // [8, 6, 7, 9] -*/ \ No newline at end of file diff --git a/LARAI/resources/larai/test/jsengine/ExceptionTest.js b/LARAI/resources/larai/test/jsengine/ExceptionTest.js new file mode 100644 index 000000000..48cf17812 --- /dev/null +++ b/LARAI/resources/larai/test/jsengine/ExceptionTest.js @@ -0,0 +1,9 @@ +function foo() { + bar(); +} + +function bar() { + throw new Error("throwing exception in bar()"); +} + +foo(); \ No newline at end of file diff --git a/LARAI/resources/larai/test/jsengine/ExceptionTest.lara b/LARAI/resources/larai/test/jsengine/ExceptionTest.lara deleted file mode 100644 index c15cfe4e4..000000000 --- a/LARAI/resources/larai/test/jsengine/ExceptionTest.lara +++ /dev/null @@ -1,14 +0,0 @@ -aspectdef ExceptionTest - - foo(); - -end - - -function foo() { - bar(); -} - -function bar() { - throw "throwing exception in bar()"; -} diff --git a/LARAI/resources/larai/test/jsengine/results/ArrowTest.js.txt b/LARAI/resources/larai/test/jsengine/results/ArrowTest.js.txt new file mode 100644 index 000000000..46dc8c86d --- /dev/null +++ b/LARAI/resources/larai/test/jsengine/results/ArrowTest.js.txt @@ -0,0 +1,5 @@ +[ 8, 6, 7, 9 ] +[ 8, 6, 7, 9 ] +[ 8, 6, 7, 9 ] +[ 8, 6, 7, 9 ] +[ 10, 10, 10, 10 ] diff --git a/LARAI/resources/larai/test/weaver/ImportMultipleFiles.js b/LARAI/resources/larai/test/weaver/ImportMultipleFiles.js deleted file mode 100644 index 7507cb500..000000000 --- a/LARAI/resources/larai/test/weaver/ImportMultipleFiles.js +++ /dev/null @@ -1 +0,0 @@ -println("Importing .js"); \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/ImportMultipleFiles.lara b/LARAI/resources/larai/test/weaver/ImportMultipleFiles.lara deleted file mode 100644 index 488337264..000000000 --- a/LARAI/resources/larai/test/weaver/ImportMultipleFiles.lara +++ /dev/null @@ -1 +0,0 @@ -var a = println("Importing .lara"); \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/ImportMultipleFiles.mjs b/LARAI/resources/larai/test/weaver/ImportMultipleFiles.mjs deleted file mode 100644 index 418e45805..000000000 --- a/LARAI/resources/larai/test/weaver/ImportMultipleFiles.mjs +++ /dev/null @@ -1 +0,0 @@ -println("Importing .mjs"); \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/ImportMultipleFilesTest.lara b/LARAI/resources/larai/test/weaver/ImportMultipleFilesTest.lara deleted file mode 100644 index e03ad37bb..000000000 --- a/LARAI/resources/larai/test/weaver/ImportMultipleFilesTest.lara +++ /dev/null @@ -1,7 +0,0 @@ -import ImportMultipleFiles; - -aspectdef Test - - println("Test"); - -end diff --git a/LARAI/resources/larai/test/weaver/JsImport.mjs b/LARAI/resources/larai/test/weaver/JsImport.mjs deleted file mode 100644 index f79da35e7..000000000 --- a/LARAI/resources/larai/test/weaver/JsImport.mjs +++ /dev/null @@ -1,9 +0,0 @@ -import "default_weaver_output/JsImportFile.js"; - -println("Imported MjsImport") - -var JsImport = 0; - -laraImport("lara.Strings"); - -println("Imported lara.Strings: " + (typeof Strings)); \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/JsImportFile.js b/LARAI/resources/larai/test/weaver/JsImportFile.js deleted file mode 100644 index 93e3567e3..000000000 --- a/LARAI/resources/larai/test/weaver/JsImportFile.js +++ /dev/null @@ -1,5 +0,0 @@ -println("Imported JsImportFile"); - -laraImport("lara.Io"); - -println("Imported lara.Io: " + (typeof Io)); \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/JsImportTest.lara b/LARAI/resources/larai/test/weaver/JsImportTest.lara deleted file mode 100644 index 863fc1348..000000000 --- a/LARAI/resources/larai/test/weaver/JsImportTest.lara +++ /dev/null @@ -1,10 +0,0 @@ -//import JsImport; // This might never work while generated aspects have "with" -import JsImport; - -aspectdef Test - - //laraImport("JsImport"); - - println("Imported JsImportTest.lara"); - -end \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/LaraImportFromJsJs.js b/LARAI/resources/larai/test/weaver/LaraImportFromJsJs.js deleted file mode 100644 index 1ab8d91ca..000000000 --- a/LARAI/resources/larai/test/weaver/LaraImportFromJsJs.js +++ /dev/null @@ -1,6 +0,0 @@ -class LaraImportFromJsJs { - - print() { - println("LaraImportFromJsJs.print()"); - } -} diff --git a/LARAI/resources/larai/test/weaver/LaraImportFromJsLara.lara b/LARAI/resources/larai/test/weaver/LaraImportFromJsLara.lara deleted file mode 100644 index 2aa999d7c..000000000 --- a/LARAI/resources/larai/test/weaver/LaraImportFromJsLara.lara +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @class - */ -var LaraImportFromJsLara = function() { - -}; - - -LaraImportFromJsLara.prototype.print = function() { - println("LaraImportFromJsLara.print()"); -} \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/LaraImportFromJsMjs.mjs b/LARAI/resources/larai/test/weaver/LaraImportFromJsMjs.mjs deleted file mode 100644 index 2c319b231..000000000 --- a/LARAI/resources/larai/test/weaver/LaraImportFromJsMjs.mjs +++ /dev/null @@ -1,8 +0,0 @@ -class LaraImportFromJsMjs { - - print() { - println("LaraImportFromLaraMjs.print()"); - } -} - -//globalThis.LaraImportFromJsMjs = LaraImportFromJsMjs; \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/LaraImportFromJsTest.js b/LARAI/resources/larai/test/weaver/LaraImportFromJsTest.js deleted file mode 100644 index 393cce11f..000000000 --- a/LARAI/resources/larai/test/weaver/LaraImportFromJsTest.js +++ /dev/null @@ -1,12 +0,0 @@ -laraImport("LaraImportFromJsLara") -laraImport("LaraImportFromJsJs") -laraImport("LaraImportFromJsMjs") - -var fromLara = new LaraImportFromJsLara() -fromLara.print() - -var fromJs = new LaraImportFromJsJs() -fromJs.print() - -var fromMjs = new LaraImportFromJsMjs() -fromMjs.print() \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/LaraImportFromLaraJs.js b/LARAI/resources/larai/test/weaver/LaraImportFromLaraJs.js deleted file mode 100644 index d506170b0..000000000 --- a/LARAI/resources/larai/test/weaver/LaraImportFromLaraJs.js +++ /dev/null @@ -1,7 +0,0 @@ -class LaraImportFromLaraJs { - - print() { - println("LaraImportFromLaraJs.print()"); - } - -} \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/LaraImportFromLaraLara.lara b/LARAI/resources/larai/test/weaver/LaraImportFromLaraLara.lara deleted file mode 100644 index 3c150977d..000000000 --- a/LARAI/resources/larai/test/weaver/LaraImportFromLaraLara.lara +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @class - */ -var LaraImportFromLaraLara = function() { - -}; - - -LaraImportFromLaraLara.prototype.print = function() { - println("LaraImportFromLaraLara.print()"); -} \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/LaraImportFromLaraMjs.mjs b/LARAI/resources/larai/test/weaver/LaraImportFromLaraMjs.mjs deleted file mode 100644 index 62f910c43..000000000 --- a/LARAI/resources/larai/test/weaver/LaraImportFromLaraMjs.mjs +++ /dev/null @@ -1,7 +0,0 @@ -class LaraImportFromLaraMjs { - print() { - println("LaraImportFromLaraMjs.print()"); - } -} - -//globalThis.LaraImportFromLaraMjs = LaraImportFromLaraMjs; \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/LaraImportFromLaraTest.lara b/LARAI/resources/larai/test/weaver/LaraImportFromLaraTest.lara deleted file mode 100644 index 03e7edd0b..000000000 --- a/LARAI/resources/larai/test/weaver/LaraImportFromLaraTest.lara +++ /dev/null @@ -1,15 +0,0 @@ -import LaraImportFromLaraLara; -import LaraImportFromLaraJs; -import LaraImportFromLaraMjs; - -aspectdef Test - - var fromLara = new LaraImportFromLaraLara(); - fromLara.print(); - - var fomJs = new LaraImportFromLaraJs(); - fomJs.print(); - - var fomMjs = new LaraImportFromLaraMjs(); - fomMjs.print(); -end diff --git a/LARAI/resources/larai/test/weaver/LaraImportFromMjsJs.js b/LARAI/resources/larai/test/weaver/LaraImportFromMjsJs.js deleted file mode 100644 index db94670bf..000000000 --- a/LARAI/resources/larai/test/weaver/LaraImportFromMjsJs.js +++ /dev/null @@ -1,8 +0,0 @@ -class LaraImportFromMjsJs { - - print() { - println("LaraImportFromMjsJs.print()"); - } -} - -//globalThis.LaraImportFromMjsJs = LaraImportFromMjsJs; \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/LaraImportFromMjsLara.lara b/LARAI/resources/larai/test/weaver/LaraImportFromMjsLara.lara deleted file mode 100644 index 692379c0a..000000000 --- a/LARAI/resources/larai/test/weaver/LaraImportFromMjsLara.lara +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @class - */ -var LaraImportFromMjsLara = function() { - -}; - - -LaraImportFromMjsLara.prototype.print = function() { - println("LaraImportFromMjsLara.print()"); -} \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/LaraImportFromMjsMjs.mjs b/LARAI/resources/larai/test/weaver/LaraImportFromMjsMjs.mjs deleted file mode 100644 index ee2cfee47..000000000 --- a/LARAI/resources/larai/test/weaver/LaraImportFromMjsMjs.mjs +++ /dev/null @@ -1,9 +0,0 @@ -class LaraImportFromMjsMjs { - - print() { - println("LaraImportFromMjsMjs.print()"); - } -} - - -//globalThis.LaraImportFromMjsMjs = LaraImportFromMjsMjs; \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/LaraImportFromMjsTest.mjs b/LARAI/resources/larai/test/weaver/LaraImportFromMjsTest.mjs deleted file mode 100644 index d42ffc8d8..000000000 --- a/LARAI/resources/larai/test/weaver/LaraImportFromMjsTest.mjs +++ /dev/null @@ -1,12 +0,0 @@ -laraImport("LaraImportFromMjsLara") -laraImport("LaraImportFromMjsJs") -laraImport("LaraImportFromMjsMjs") - -var fromLara = new LaraImportFromMjsLara() -fromLara.print() - -var fromJs = new LaraImportFromMjsJs() -fromJs.print() - -var fromMjs = new LaraImportFromMjsMjs() -fromMjs.print() \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/LaraImportStar.js b/LARAI/resources/larai/test/weaver/LaraImportStar.js deleted file mode 100644 index 03417a151..000000000 --- a/LARAI/resources/larai/test/weaver/LaraImportStar.js +++ /dev/null @@ -1,7 +0,0 @@ -//laraImport("lara.util.*"); -//laraImport("lara.util.PrintOnce"); -//laraImport("lara.util.PrintOnce"); -laraImport("lara.util.*"); - -PrintOnce.message("Hello"); -PrintOnce.message("Hello"); diff --git a/LARAI/resources/larai/test/weaver/LaraLocTest.lara b/LARAI/resources/larai/test/weaver/LaraLocTest.lara deleted file mode 100644 index 4a2f71f8a..000000000 --- a/LARAI/resources/larai/test/weaver/LaraLocTest.lara +++ /dev/null @@ -1,25 +0,0 @@ -// Imports are not counting towards statements yet, this comment also not being counted -import weaver.Weaver; - -/** - * Aspect documentation - */ -aspectdef LaraLocTest - input in1 end - output out1 end - - // LaraLoc - println("LaraLoc Totals:" + Weaver.getLaraLocTotals()); - - // Comment is not being associated with call, and so is not counted - call A; - -end - -aspectdef A - -end - -function foo() { - call A; -} \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/WeaverOptionsTest.js b/LARAI/resources/larai/test/weaver/WeaverOptionsTest.js new file mode 100644 index 000000000..002ca8305 --- /dev/null +++ b/LARAI/resources/larai/test/weaver/WeaverOptionsTest.js @@ -0,0 +1,9 @@ +import WeaverOptions from "@specs-feup/lara/api/weaver/WeaverOptions.js"; + +const data = WeaverOptions.getData(); + +console.log("Original output folder: " + data.getOutputFolder()); +data.setOutputFolder("subfolder"); +console.log("New output folder: " + data.getOutputFolder()); + +console.log("Supported languages: " + WeaverOptions.getSupportedLanguages()); diff --git a/LARAI/resources/larai/test/weaver/WeaverOptionsTest.lara b/LARAI/resources/larai/test/weaver/WeaverOptionsTest.lara deleted file mode 100644 index 64500d13a..000000000 --- a/LARAI/resources/larai/test/weaver/WeaverOptionsTest.lara +++ /dev/null @@ -1,23 +0,0 @@ -import weaver.WeaverOptions; -import lara.Io; - -aspectdef WeaverData - - var data = WeaverOptions.getData(); - - println("Original verbose level: " + data.getVerboseLevel()); - data.setVerboseLevel(3); - println("New verbose level: " + data.getVerboseLevel()); - - println("Original output folder: " + data.getOutputFolder()); - data.setOutputFolder("subfolder"); - println("New output folder: " + data.getOutputFolder()); - - println("Supported languages: " + WeaverOptions.getSupportedLanguages()); - - // Cannot test this in a platform independent way - //println("CLI: " + WeaverOptions.toCli()); - - //println("Weaver keys: " + WeaverOptions.getKeys()); - -end diff --git a/LARAI/resources/larai/test/weaver/WeaverTest.js b/LARAI/resources/larai/test/weaver/WeaverTest.js new file mode 100644 index 000000000..3f3fbfdcd --- /dev/null +++ b/LARAI/resources/larai/test/weaver/WeaverTest.js @@ -0,0 +1,9 @@ +import Weaver from "@specs-feup/lara/api/weaver/Weaver.js"; +import JavaTypes from "@specs-feup/lara/api/lara/util/JavaTypes"; + +const ArrayList = JavaTypes.ArrayList; +const javaList = new ArrayList(); +javaList.add(42); +javaList.add(13); +const arrayFromList = Weaver.toJs(javaList); +console.log(arrayFromList.map(number => number + 1)); diff --git a/LARAI/resources/larai/test/weaver/WeaverTest.lara b/LARAI/resources/larai/test/weaver/WeaverTest.lara deleted file mode 100644 index bee7a8fa6..000000000 --- a/LARAI/resources/larai/test/weaver/WeaverTest.lara +++ /dev/null @@ -1,20 +0,0 @@ -import weaver.Weaver; - -aspectdef WeaverTest - - // hasAttribute - /* - println("Has attribute $jp.joinPointType: " + Weaver.hasAttribute("joinpoint", "joinPointType")); - println("Has attribute $file.absolutePath: " + Weaver.hasAttribute("file", "absolutePath")); - println("Has attribute $file.wrongType: " + Weaver.hasAttribute("file", "wrongType")); - println("Has attribute $wrongJp.joinPointType: " + Weaver.hasAttribute("wrongJp", "joinPointType")); - */ - // toJs - var ArrayList = Java.type('java.util.ArrayList'); - var javaList = new ArrayList(); - javaList.add(42); - javaList.add(13); - var arrayFromList = Weaver.toJs(javaList); - println(arrayFromList.map(number => number + 1)); - -end \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/results/ImportMultipleFilesTest.lara.txt b/LARAI/resources/larai/test/weaver/results/ImportMultipleFilesTest.lara.txt deleted file mode 100644 index 3417725b8..000000000 --- a/LARAI/resources/larai/test/weaver/results/ImportMultipleFilesTest.lara.txt +++ /dev/null @@ -1,6 +0,0 @@ -Importing .lara -Importing .js -Warning: using laraImport() for file 'ImportMultipleFiles.js', however it does not define a variable or class 'ImportMultipleFiles' -Importing .mjs -Warning: using laraImport() for file 'ImportMultipleFiles.mjs', however it does not define a variable or class 'ImportMultipleFiles' -Test \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/results/JsImportTest.lara.txt b/LARAI/resources/larai/test/weaver/results/JsImportTest.lara.txt deleted file mode 100644 index 504ebb519..000000000 --- a/LARAI/resources/larai/test/weaver/results/JsImportTest.lara.txt +++ /dev/null @@ -1,5 +0,0 @@ -Imported JsImportFile -Imported lara.Io: function -Imported MjsImport -Imported lara.Strings: function -Imported JsImportTest.lara \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/results/LaraImportFromJsTest.js.txt b/LARAI/resources/larai/test/weaver/results/LaraImportFromJsTest.js.txt deleted file mode 100644 index fb3f3a3e3..000000000 --- a/LARAI/resources/larai/test/weaver/results/LaraImportFromJsTest.js.txt +++ /dev/null @@ -1,3 +0,0 @@ -LaraImportFromJsLara.print() -LaraImportFromJsJs.print() -LaraImportFromLaraMjs.print() \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/results/LaraImportFromLaraTest.lara.txt b/LARAI/resources/larai/test/weaver/results/LaraImportFromLaraTest.lara.txt deleted file mode 100644 index 287041551..000000000 --- a/LARAI/resources/larai/test/weaver/results/LaraImportFromLaraTest.lara.txt +++ /dev/null @@ -1,3 +0,0 @@ -LaraImportFromLaraLara.print() -LaraImportFromLaraJs.print() -LaraImportFromLaraMjs.print() \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/results/LaraImportFromMjsTest.mjs.txt b/LARAI/resources/larai/test/weaver/results/LaraImportFromMjsTest.mjs.txt deleted file mode 100644 index 7df778b91..000000000 --- a/LARAI/resources/larai/test/weaver/results/LaraImportFromMjsTest.mjs.txt +++ /dev/null @@ -1,3 +0,0 @@ -LaraImportFromMjsLara.print() -LaraImportFromMjsJs.print() -LaraImportFromMjsMjs.print() diff --git a/LARAI/resources/larai/test/weaver/results/LaraImportStar.js.txt b/LARAI/resources/larai/test/weaver/results/LaraImportStar.js.txt deleted file mode 100644 index 5ab2f8a43..000000000 --- a/LARAI/resources/larai/test/weaver/results/LaraImportStar.js.txt +++ /dev/null @@ -1 +0,0 @@ -Hello \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/results/LaraLocTest.lara.txt b/LARAI/resources/larai/test/weaver/results/LaraLocTest.lara.txt deleted file mode 100644 index 9967db91d..000000000 --- a/LARAI/resources/larai/test/weaver/results/LaraLocTest.lara.txt +++ /dev/null @@ -1 +0,0 @@ -LaraLoc Totals:[laraStmts: 9, aspects: 2, functions: 1, comments: 4] \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/results/WeaverOptionsTest.js.txt b/LARAI/resources/larai/test/weaver/results/WeaverOptionsTest.js.txt new file mode 100644 index 000000000..9b2aaace5 --- /dev/null +++ b/LARAI/resources/larai/test/weaver/results/WeaverOptionsTest.js.txt @@ -0,0 +1,3 @@ +Original output folder: . +New output folder: subfolder +Supported languages: [] \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/results/WeaverOptionsTest.lara.txt b/LARAI/resources/larai/test/weaver/results/WeaverOptionsTest.lara.txt deleted file mode 100644 index c6a3c7349..000000000 --- a/LARAI/resources/larai/test/weaver/results/WeaverOptionsTest.lara.txt +++ /dev/null @@ -1,5 +0,0 @@ -Original verbose level: 2 -New verbose level: 3 -Original output folder: . -New output folder: subfolder -Supported languages: [] \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/results/WeaverTest.js.txt b/LARAI/resources/larai/test/weaver/results/WeaverTest.js.txt new file mode 100644 index 000000000..472ad4b2c --- /dev/null +++ b/LARAI/resources/larai/test/weaver/results/WeaverTest.js.txt @@ -0,0 +1 @@ +[ 43, 14 ] \ No newline at end of file diff --git a/LARAI/resources/larai/test/weaver/results/WeaverTest.lara.txt b/LARAI/resources/larai/test/weaver/results/WeaverTest.lara.txt deleted file mode 100644 index 116abb6e3..000000000 --- a/LARAI/resources/larai/test/weaver/results/WeaverTest.lara.txt +++ /dev/null @@ -1 +0,0 @@ -43,14 \ No newline at end of file diff --git a/LARAI/resources/org/lara/interpreter/cli/CommandLineCall.lara b/LARAI/resources/org/lara/interpreter/cli/CommandLineCall.lara deleted file mode 100644 index 0481865c2..000000000 --- a/LARAI/resources/org/lara/interpreter/cli/CommandLineCall.lara +++ /dev/null @@ -1,36 +0,0 @@ -import ; - -aspectdef CommandLineCall - - var result = call (); - - println("Output of aspect '':"); - printObject(result); - - /* - // Collect results - var parsedResults = {}; - for(var key in result) { - var value = result[key]; - - if(value === undefined || value === null) { - continue; - } - - if(value["Output"] !== undefined) { - parsedResults[key] = value; - } - } - - // Print results if any - if(Object.keys(parsedResults).length === 0) { - println("Aspect '' has no outputs"); - } else { - println("Output of aspect '':"); - printObject(parsedResults); - } - */ - - -end - diff --git a/LARAI/resources/org/lara/interpreter/outputResult.js.template b/LARAI/resources/org/lara/interpreter/outputResult.js.template deleted file mode 100644 index 27eb19da6..000000000 --- a/LARAI/resources/org/lara/interpreter/outputResult.js.template +++ /dev/null @@ -1,3 +0,0 @@ -laraImport('weaver.Script'); -laraImport('lara.Io'); -Io.writeJson('', Script.getOutput()); \ No newline at end of file diff --git a/LARAI/run/LARAI-Tests.launch b/LARAI/run/LARAI-Tests.launch deleted file mode 100644 index 4d1790303..000000000 --- a/LARAI/run/LARAI-Tests.launch +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/LARAI/run/LaraI.launch b/LARAI/run/LaraI.launch deleted file mode 100644 index 2e1fafcc3..000000000 --- a/LARAI/run/LaraI.launch +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/LARAI/run/[Generate]DefaultWeaver.launch b/LARAI/run/[Generate]DefaultWeaver.launch deleted file mode 100644 index 6cce50558..000000000 --- a/LARAI/run/[Generate]DefaultWeaver.launch +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/LARAI/settings.gradle b/LARAI/settings.gradle index 13748c2a1..0d9b61f37 100644 --- a/LARAI/settings.gradle +++ b/LARAI/settings.gradle @@ -1,16 +1,10 @@ rootProject.name = 'LARAI' -includeBuild("../../specs-java-libs/CommonsLangPlus") -includeBuild("../../specs-java-libs/GitPlus") -includeBuild("../../specs-java-libs/jOptions") -includeBuild("../../specs-java-libs/JsEngine") -includeBuild("../../specs-java-libs/SpecsUtils") -includeBuild("../../specs-java-libs/tdrcLibrary") +def specsJavaLibsRoot = System.getenv('SPECS_JAVA_LIBS_HOME') ?: '../../specs-java-libs' -includeBuild("../../lara-framework/LanguageSpecification") -includeBuild("../../lara-framework/LaraApi") -includeBuild("../../lara-framework/LARAC") -includeBuild("../../lara-framework/LaraCommonLanguage") -includeBuild("../../lara-framework/LaraLoc") -includeBuild("../../lara-framework/LaraUtils") -includeBuild("../../lara-framework/WeaverInterface") \ No newline at end of file +includeBuild("${specsJavaLibsRoot}/jOptions") +includeBuild("${specsJavaLibsRoot}/SpecsUtils") + +includeBuild("../LaraUtils") +includeBuild("../LanguageSpecification") +includeBuild("../WeaverInterface") diff --git a/LARAI/src/larai/LaraI.java b/LARAI/src/larai/LaraI.java index 8fa1532f8..646c77237 100644 --- a/LARAI/src/larai/LaraI.java +++ b/LARAI/src/larai/LaraI.java @@ -12,328 +12,42 @@ */ package larai; -import larac.LaraC; -import larac.utils.output.Output; import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; -import org.lara.interpreter.Interpreter; -import org.lara.interpreter.cli.CLIConfigOption; -import org.lara.interpreter.cli.LaraCli; import org.lara.interpreter.cli.OptionsConverter; import org.lara.interpreter.cli.OptionsParser; import org.lara.interpreter.cli.OptionsParser.ExecutionMode; -import org.lara.interpreter.exception.LaraIException; -import org.lara.interpreter.generator.stmt.AspectClassProcessor; -import org.lara.interpreter.joptions.config.interpreter.LaraIDataStore; import org.lara.interpreter.joptions.config.interpreter.LaraiKeys; -import org.lara.interpreter.joptions.gui.LaraLauncher; -import org.lara.interpreter.joptions.keys.FileList; -import org.lara.interpreter.profile.BasicWeaverProfiler; -import org.lara.interpreter.profile.ReportField; -import org.lara.interpreter.profile.WeaverProfiler; import org.lara.interpreter.utils.LaraIUtils; -import org.lara.interpreter.utils.MessageConstants; -import org.lara.interpreter.utils.Tools; -import org.lara.interpreter.weaver.MasterWeaver; -import org.lara.interpreter.weaver.defaultweaver.DefaultWeaver; import org.lara.interpreter.weaver.interf.WeaverEngine; -import org.lara.interpreter.weaver.interf.events.Stage; -import org.lara.interpreter.weaver.utils.LaraResourceProvider; -import org.lara.language.specification.dsl.LanguageSpecification; import org.suikasoft.jOptions.Interfaces.DataStore; -import org.suikasoft.jOptions.JOptionKeys; -import org.suikasoft.jOptions.app.AppPersistence; import org.suikasoft.jOptions.storedefinition.StoreDefinition; import org.suikasoft.jOptions.storedefinition.StoreDefinitionBuilder; -import org.w3c.dom.DOMException; -import org.w3c.dom.Document; -import pt.up.fe.specs.jsengine.JsEngine; -import pt.up.fe.specs.jsengine.JsEngineType; -import pt.up.fe.specs.jsengine.JsFileType; -import pt.up.fe.specs.lara.LaraCompiler; -import pt.up.fe.specs.lara.LaraSystemTools; -import pt.up.fe.specs.lara.aspectir.Aspects; -import pt.up.fe.specs.lara.importer.LaraImporter; -import pt.up.fe.specs.tools.lara.exception.BaseException; -import pt.up.fe.specs.tools.lara.trace.CallStackTrace; -import pt.up.fe.specs.util.SpecsIo; import pt.up.fe.specs.util.SpecsLogs; -import pt.up.fe.specs.util.SpecsSystem; -import pt.up.fe.specs.util.exceptions.NotImplementedException; -import pt.up.fe.specs.util.providers.ResourceProvider; -import pt.up.fe.specs.util.utilities.Replacer; -import pt.up.fe.specs.util.utilities.SpecsThreadLocal; -import tdrc.utils.Pair; - -import java.io.File; -import java.io.OutputStream; -import java.nio.file.Path; -import java.nio.file.Paths; import java.util.*; import java.util.function.Supplier; -import java.util.stream.Collectors; -/** - * An interpreter for the LARA language, which converts the Aspect-IR into a javascript representation and runs that - * script. This is used in REFLECT as an outer-loop for the project-flow and also for design-space exploration. - * Furthermore, one can have a weaver which can be used with this interpreter. For that, one should implement the - * interface org.reflect.larai.IWeaver, available in this project, and follow its instructions, and change the weaver - * with the -w/--weaver option with the name of that implementation (E.g.: -weaver org.specs.Matisse) OR invoke - * LARAI.exec(2)/LARAI.exec(5) - * - * @author Tiago - */ public class LaraI { - public static final double LARA_VERSION = 3.1; // Since we are using GraalVM - public static final String LARAI_VERSION_TEXT = "Lara interpreter version: " + LaraI.LARA_VERSION; - public static final String DEFAULT_WEAVER = DefaultWeaver.class.getName(); - public static final String PROPERTY_JAR_PATH = LaraC.PROPERTY_JAR_PATH; - - private static final ThreadLocal RUNNING_GUI = ThreadLocal.withInitial(() -> false); - private static final ThreadLocal SERVER_MODE = ThreadLocal.withInitial(() -> false); - - // TODO: Put LARASystem.class eventually - private static final Collection> FORBIDDEN_CLASSES = Arrays.asList(ProcessBuilder.class, - LaraSystemTools.class, Runtime.class); - - public static boolean isRunningGui() { - return RUNNING_GUI.get(); - } - - public static boolean isServerMode() { - return SERVER_MODE.get(); - } - - public static void setServerMode() { - SERVER_MODE.set(true); - } - - /** - * Thread-scope DataStore - */ - private static final SpecsThreadLocal THREAD_LOCAL_WEAVER_DATA = new SpecsThreadLocal<>(DataStore.class); - - public static DataStore getThreadLocalData() { - return THREAD_LOCAL_WEAVER_DATA.get(); - } - - /** - * Thread-scope LaraC - */ - private static final SpecsThreadLocal THREAD_LOCAL_LARAI = new SpecsThreadLocal<>(LaraI.class); - - public static LaraI getThreadLocalLarai() { - return THREAD_LOCAL_LARAI.get(); - } - - private LaraIDataStore options; - private MasterWeaver weaver; - public Output out = new Output(); - private boolean quit = false; - - // private LaraIOptionParser opts = new LaraIOptionParser(); - private Document aspectIRDocument; - private Interpreter interpreter; - private Aspects asps = null; - private StringBuilder js = new StringBuilder(); - private WeaverProfiler weavingProfile; - - private final WeaverEngine weaverEngine; - private int mainLaraTokens = -1; + public static final String PROPERTY_JAR_PATH = "lara.jarpath"; private static Supplier timeProvider = System::currentTimeMillis; - /** - * Create a new LaraI with the input datastore - * - * @param dataStore - * @param weaverEngine - */ - private LaraI(DataStore dataStore, WeaverEngine weaverEngine) { - this.weaverEngine = weaverEngine; - setOptions(new LaraIDataStore(this, dataStore, weaverEngine)); - - // final boolean continueRun = LaraIOptionsSetter.setOptions(this, jarLoc, dataStore); - quit = false; - weavingProfile = weaverEngine.getWeaverProfiler(); - - if (weavingProfile == null) { - weavingProfile = BasicWeaverProfiler.emptyProfiler(); - } - } - - public static LaraI newInstance(DataStore dataStore, WeaverEngine weaverEngine) { - return new LaraI(dataStore, weaverEngine); - } - - public static LaraI newInstance(WeaverEngine weaverEngine) { - DataStore data = DataStore.newInstance("EmptyLarai"); - data.add(LaraiKeys.LARA_FILE, new File("")); - return LaraI.newInstance(data, weaverEngine); - } - - public WeaverEngine getWeaverEngine() { - return weaverEngine; - } - - public JsEngine getScriptEngine() { - return weaverEngine.getScriptEngine(); - } - - /** - * Executes larai with a Weaving engine implementing {@link WeaverEngine}, and the language specification language - * specification. The datastore must contain the options available in {@link LaraiKeys} - * - * @param dataStore - * @param weaverEngine - * @param langSpec - * @return - */ - // public static boolean exec(DataStore dataStore, Class weaverEngine) { - // try { - // return exec(dataStore, weaverEngine.newInstance()); - // } catch (Exception e) { - // throw new RuntimeException( - // "Could not instantiate weaver engine with class '" + weaverEngine.getClass() + "'", e); - // } - // } - - /** - * Executes larai with a Weaving engine implementing {@link WeaverEngine}. - *

- * The datastore contains the options available in {@link LaraiKeys} and the options given by - * {@link WeaverEngine#getOptions()}. - * - * @param dataStore - * @param weaverEngine - * @return - */ - public static boolean exec(DataStore dataStore, WeaverEngine weaverEngine) { - - // Create new instance of the weaver engine, to avoid reuse of information between consecutive runs - var newWeaverEngine = SpecsSystem.newInstance(weaverEngine.getClass()); - - // Launch weaver on another thread, to guarantee that there are no conflicts in ThreadLocal variables - // var result = SpecsSystem.executeOnThreadAndWait(() -> execPrivate(dataStore, weaverEngine)); - var result = SpecsSystem.executeOnThreadAndWait(() -> execPrivate(dataStore, newWeaverEngine)); - return result == null ? false : result; - } - - - public static boolean execPrivate(DataStore dataStore, WeaverEngine weaverEngine) { - - prepareDataStore(dataStore, weaverEngine); - - MessageConstants.order = 1; - larac.utils.output.MessageConstants.order = 1; - - LaraI larai = null; - try { - - if (dataStore == null) { - throw new NullPointerException("The DataStore cannot be null"); - } - - long start = getCurrentTime(); - THREAD_LOCAL_WEAVER_DATA.setWithWarning(dataStore); - - // Check if unit-testing mode - if (dataStore.get(LaraiKeys.UNIT_TEST_MODE)) { - return weaverEngine.executeUnitTestMode(dataStore); - } - - larai = new LaraI(dataStore, weaverEngine); - - if (larai.options.isDebug()) { - larai.out.println(MessageConstants.getHeaderMessage(MessageConstants.order++, ". LARA Options")); - larai.out.println(dataStore); - } - - if (!larai.quit) { - THREAD_LOCAL_LARAI.setWithWarning(larai); - larai.interpret(weaverEngine); - } - - long end = getCurrentTime() - start; - - larai.getWeavingProfile().report(ReportField.TOTAL_TIME, (int) end); - larai.out.println(MessageConstants.getElapsedTimeMessage(end, "LARA total time")); - larai.interpreter.exportMetrics(); - larai.out.close(); - return true; - - // } catch (final Throwable e) { - } catch (Exception e) { - throw new RuntimeException("Exception during interpretation", e); - // throw new RuntimeException(e); - - // throw treatExceptionInInterpreter(larai, e); - - // var finalException = treatExceptionInInterpreter(larai, e); - // System.out.println(finalException); - } finally { - if (WeaverEngine.isWeaverSet()) { - WeaverEngine.removeWeaver(); - } - - THREAD_LOCAL_WEAVER_DATA.removeWithWarning(); - if (larai != null) { - THREAD_LOCAL_LARAI.removeWithWarning(); - } - - } - - // return false; - } - - private static void prepareDataStore(DataStore dataStore, WeaverEngine weaverEngine) { - - // Set store definition - + public static StoreDefinition buildStoreDefinition(WeaverEngine weaverEngine) { String weaverName = weaverEngine.getName(); - StoreDefinition weaverKeys = new StoreDefinitionBuilder(weaverName) + return new StoreDefinitionBuilder(weaverName) // Add LaraI keys .addDefinition(LaraiKeys.STORE_DEFINITION) // Add weaver custom keys .addDefinition(weaverEngine.getStoreDefinition()) .build(); - - dataStore.setStoreDefinition(weaverKeys); - - // Set persistence, if not set - if (dataStore.getPersistence().isEmpty()) { - AppPersistence persistence = OptionsParser.getXmlPersistence(weaverKeys); - dataStore.setPersistence(persistence); - } - } - // public static boolean exec(String[] args, Class weaverEngine) { - // return exec(args, weaverEngine.newInstance()); - // } - - /** - * Executes larai with a Weaving engine implementing {@link WeaverEngine}. The varargs are converted into a - * DataStore - * - * @param args - * @param weaverEngine - * @return - */ - public static boolean exec(String[] args, WeaverEngine weaverEngine) { - // Launch weaver on another thread, to guarantee that there are no conflicts in ThreadLocal variables - LaraiResult result = SpecsSystem.executeOnThreadAndWait(() -> execPrivate(args, weaverEngine)); - RUNNING_GUI.set(result.get(LaraiResult.IS_RUNNING_GUI)); - return result.get(LaraiResult.IS_SUCCESS); - } - - /** * Converts an array of strings to the corresponding DataStore. * - * @param objArgs - * @param weaverEngine - * @return A DataStore that corresponds to the given arguments, or empty if the arguments represent a GUI execution mode. + * @return A DataStore that corresponds to the given arguments, or empty if the + * arguments represent a GUI execution mode. */ public static Optional convertArgsToDataStore(Object[] objArgs, WeaverEngine weaverEngine) { @@ -342,7 +56,7 @@ public static Optional convertArgsToDataStore(Object[] objArgs, Weave args[i] = objArgs[i].toString(); } - Options finalOptions = LaraCli.getCliOptions(weaverEngine); + Options finalOptions = getCliOptions(weaverEngine); CommandLine cmd = OptionsParser.parse(args, finalOptions); @@ -361,725 +75,46 @@ public static Optional convertArgsToDataStore(Object[] objArgs, Weave return dataStore; } - private static Optional buildDataStore(WeaverEngine weaverEngine, ExecutionMode mode, CommandLine cmd, String mainScript) { - return switch (mode) { - // convert configuration file to data store and run - case CONFIG -> Optional.of(OptionsConverter.configFile2DataStore(weaverEngine, cmd)); - - // get the configuration file and execute GUI - case CONFIG_GUI -> Optional.empty(); - - // convert options to data store and run - case OPTIONS -> - Optional.of(OptionsConverter.commandLine2DataStore(mainScript, cmd, weaverEngine.getOptions())); - - // convert configuration file to data store, override with extra options and run - case CONFIG_OPTIONS -> - Optional.of(OptionsConverter.configExtraOptions2DataStore(mainScript, cmd, weaverEngine)); - - // launch GUI - case GUI -> Optional.empty(); - }; - } - - public static LaraiResult execPrivate(String[] args, WeaverEngine weaverEngine) { - SpecsLogs.debug(() -> "Weaver command-line arguments: " + Arrays.stream(args).collect(Collectors.joining(" "))); - - // Set weaver (e.g. for help message to access name and build number) - weaverEngine.setWeaver(); - - // Reset global state - MessageConstants.order = 1; - if (CLIConfigOption.ALLOW_GUI && OptionsParser.guiMode(args)) { - - LaraLauncher.launchGUI(weaverEngine, Optional.empty()); - // return true; - return LaraiResult.newInstance(true, true); - } - - try { - // Collection

- * If a normal exception is given, then it outputs the same exception. - * - * @param e - * @return - */ - private static RuntimeException prettyRuntimeException(Throwable e) { - - BaseException laraException; - - if (!(e instanceof BaseException)) { - laraException = new LaraIException("During LARA Interpreter execution ", e); - } else { - laraException = (BaseException) e; - } - // - // BaseException laraException = (BaseException) e; - return laraException.generateRuntimeException(); - } - - /** - * Initialize the AspectIR structure - * - * @throws Exception - * @throws DOMException - */ - private void startAspectIR() throws DOMException, Exception { - out.println(MessageConstants.getHeaderMessage(MessageConstants.order++, ". Loading Aspect-IR")); - // this.out.println(larac.utils.output.MessageConstants.FILE_READ + this.options.getLaraFile().getName()); - // try { - asps = new Aspects(aspectIRDocument, ""); - // out.println("-----------Converted Aspect-IR-----------"); - // asps.print(out.getOutStream(), 0); - // } catch (Exception e) { - // throw new LARAIException(this.options.getAspectOriginalName(), "Could - // not parse Aspect-IR", e); - // } - } - - - /** - * Compile the lara file with LARAC, according to a {@link LanguageSpecification} - * - * @param fileName - * @param langSpec - * @param options - * @param out - * @return - * @throws Exception - */ - public Pair compileWithLARAC(File fileName, LanguageSpecification langSpec, - LaraIDataStore options, - Output out) throws Exception { - - // Process Lara Bundles in include folders - // includesFolder = processLaraBundles(includesFolder); - - String path = options.getOutputDir().getPath(); - - FileList includeDirs = options.getProcessedIncludeDirs(getWeaverEngine()); - - // LaraIDataStore.processIncludeDirs(includeDirs); - /* - // Process LARA Bundles - // LaraBundle laraBundle = new LaraBundle(getWeaverEngine().getLanguages(), getWeaverEngine().getWeaverNames()); - LaraBundle laraBundle = new LaraBundle(getWeaverEngine().getWeaverNames(), options.getBundleTags()); - FileList processedIncludeDirs = laraBundle.process(includeDirs); - - // Process LARA Resources - LaraResource laraResource = new LaraResource(getWeaverEngine()); - processedIncludeDirs = laraResource.process(processedIncludeDirs); - */ - String encodedIncludes = includeDirs.encode(); - // String encodedIncludes = options.getIncludeDirs().encode(); - List preprocess = new ArrayList<>(); - preprocess.add(fileName.getPath()); - preprocess.add("-o"); - preprocess.add(path); - if (!encodedIncludes.trim().isEmpty()) { - preprocess.add("-i"); - preprocess.add(encodedIncludes); - } - - // lara files as resources - // List laraAPIs = new ArrayList<>(ResourceProvider.getResources(LaraApiResource.class)); - // System.out.println("LARA APIS :" + IoUtils.getResource(laraAPIs2.get(0))); - // laraAPIs.addAll(options.getLaraAPIs()); - List laraAPIs = getWeaverEngine().getLaraApis(); - if (!laraAPIs.isEmpty()) { - preprocess.add("-r"); - String resources = laraAPIs.stream().map(LaraI::getOriginalResource) - .collect(Collectors.joining(SpecsIo.getUniversalPathSeparator())); - preprocess.add(resources); - } - - if (options.isDebug()) { - preprocess.add("-d"); - } - - final LaraC lara = new LaraC(preprocess.toArray(new String[0]), langSpec, out); - // lara.compileAndSave(); - // Document compile = lara.getAspectIRXmlRepresentation(); - // return compile; - Document compile = lara.compile(); - this.setNumMainLaraTokens(lara.getNumTokens()); - out.println("Processed " + getNumMainLaraTokens() + " tokens from the LARA file."); - - return Pair.newInstance(compile, lara); - // return compile; - - } - - private static String getOriginalResource(ResourceProvider resource) { - if (resource instanceof LaraResourceProvider) { - return ((LaraResourceProvider) resource).getOriginalResource(); - } - - return resource.getResource(); - } - - private LaraC compile(LanguageSpecification languageSpecification) { - - // final String aspectIR_name = this.options.getAspectIR_name(); - final String extention = SpecsIo.getExtension(options.getLaraFile()); - - Document aspectIR; - LaraC larac = null; - if (extention.equals("lara")) { - try { - var result = compileWithLARAC(options.getLaraFile(), languageSpecification, options, - out); - - aspectIR = result.getLeft(); - larac = result.getRight(); - - quit = aspectIR == null; - if (quit) { - throw new Exception("problems during compilation"); - } - - } catch (Exception e) { - throw new LaraIException(options.getLaraFile(), "Compilation problem", e); - } - // if (this.quit) { - // return; - // } - // options.setAspectIR_name(aspectIR_name.replace(".lara", ".xml")); - - } else { - try { - aspectIR = Aspects.readDocument(options.getLaraFile().getAbsolutePath()); - } catch (Exception e) { - throw new LaraIException(options.getLaraFile(), "Reading aspect-ir problem", e); - } - } - - aspectIRDocument = aspectIR; - return larac; - } - - private void interpret(WeaverEngine weaverEngine) throws Exception { - String engineWorkingDir = SpecsIo.getWorkingDir().getAbsolutePath(); - var configFolder = getThreadLocalData().get(JOptionKeys.CURRENT_FOLDER_PATH); - if (!configFolder.isEmpty()) { - engineWorkingDir = configFolder.get(); - } - - Path path = Paths.get(engineWorkingDir); - - // JsEngine engine = createJsEngine(options.getJsEngine(), path, weaverEngine.getApisFolder()); - JsEngine engine = createJsEngine(options.getJsEngine(), path, - weaverEngine.getApiManager().getNodeModulesFolder()); - - // Set javascript engine in WeaverEngine - weaverEngine.setScriptEngine(engine); - - // NashornScriptEngine engine = (NashornScriptEngine) new NashornScriptEngineFactory() - // .getScriptEngine(new String[] { "--global-per-engine" }); - - // weaverEngine.setScriptEngine(engine); - // try { - out.println(MessageConstants.getHeaderMessage(MessageConstants.order++, "Initializing Interpreter")); - // final ImporterTopLevel scope = new ImporterTopLevel(cx); - - - // final FileList folderApplication = options.getWorkingDir(); - - // if (!folderApplication.exists()) { - // throw new LaraIException(options.getLaraFile().getName(), "application folder does not exist", - // new FileNotFoundException(folderApplication.getAbsolutePath())); - // } - out.println(MessageConstants.getHeaderMessage(MessageConstants.order++, "Loading Weaver")); - long begin = getCurrentTime(); - weaver = new MasterWeaver(this, weaverEngine, engine); - - try { - // Create interpreter - interpreter = new Interpreter(this, engine); - } catch (Exception e) { - throw new LaraIException(options.getLaraFile().getName(), "Problem creating the interpreter", e); - } - - try { - boolean isWorking = weaver.begin(); - long end = getCurrentTime() - begin; - getWeavingProfile().report(ReportField.INIT_TIME, (int) end); - out.println(MessageConstants.getElapsedTimeMessage(end)); - - if (!isWorking) { - finish(engine); - return; - } - - } catch (Exception e) { - finish(engine); - throw new LaraIException(options.getLaraFile().getName(), "Exception while calling weaver begin() method", - e); - // SpecsLogs.info("Exception while calling weaver begin(): " + e.getMessage()); - // finish(engine); - // return; - } - - try { - // Start interpretation - - final String extension = SpecsIo.getExtension(options.getLaraFile()); - - // If JS file - if (Arrays.stream(JsFileType.values()).anyMatch(type -> type.getExtension().equals(extension))) { - - // If aspect arguments present, load them to object laraArgs - loadAspectArguments(); - interpreter.executeMainAspect(options.getLaraFile()); - postMainJsExecution(); - - // Close weaver - weaver.close(); - } - // If LARA file - else { - var laraJsCode = SpecsSystem.executeOnThreadAndWait(() -> { - var laraCompiler = new LaraCompiler(weaverEngine.getLanguageSpecificationV2()).setAddMain(true); - return laraCompiler.compile(options.getLaraFile()); - }); - // System.out.println("CODE:\n" + laraJsCode); - interpreter.executeMainAspect(laraJsCode, JsFileType.NORMAL, - options.getLaraFile().getAbsolutePath() + "->js"); - } - - String main = options.getMainAspect(); - if (main == null) { - - main = asps.main; - } - - weaver.eventTrigger().triggerWeaver(Stage.END, getWeaverArgs(), main, - options.getLaraFile().getPath()); - finish(engine); - } catch (Exception e) { - - // Close weaver - weaver.close(); - - // Rethrow exception - throw e; - // throw new RuntimeException("Exception during weaving:", e); - } - - } - - private void loadAspectArguments() { - var jsonArgs = options.getAspectArgumentsStr(); - - var init = jsonArgs.isEmpty() ? "{}" : jsonArgs; - - interpreter.evaluate("laraArgs = " + init + ";", "LARAI Preamble"); - } - - private void postMainJsExecution() { - - // If report file enabled, eval writing the outputs using weaver.Script - var outputJsonFile = options.getReportFile(); - if (outputJsonFile.isUsed()) { - var template = new Replacer(() -> "org/lara/interpreter/outputResult.js.template"); - template.replace("", SpecsIo.normalizePath(outputJsonFile.getFile())); - interpreter.evaluate(template.toString(), JsFileType.NORMAL, "LaraI.postMainJsExecution() - output json"); - } - - } - - private void finish(JsEngine engine) { - // if cleaning is needed - } - - // private NashornScriptEngine createJsEngine() { - // // System.out.println("RESTRIC MODE:" + getOptions().isRestricMode()); - // // If restric mode is enabled, use ClassFilter - // if (getOptions().isRestricMode()) { - // return (NashornScriptEngine) new NashornScriptEngineFactory().getScriptEngine(new RestrictModeFilter()); - // } - // - // return (NashornScriptEngine) new NashornScriptEngineFactory().getScriptEngine(); - // - // // NashornScriptEngine engine = (NashornScriptEngine) new ScriptEngineManager().getEngineByName("nashorn"); - // // return engine; - // - // } - - // private JsEngine createJsEngine(JsEngineType engineType) { - // return createJsEngine(engineType, null); - // } - - private JsEngine createJsEngine(JsEngineType engineType, Path engineWorkingDirectory, File nodeModulesFolder) { - - OutputStream engineOutputStream = System.out; - if (getOptions().isJavaScriptStream()) { - engineOutputStream = this.out.getOutStream(); - } - - Collection> engineForbiddenClasses = Collections.emptyList(); - if (getOptions().isRestricMode()) { - engineForbiddenClasses = FORBIDDEN_CLASSES; - } - - return engineType.newEngine(engineType, engineForbiddenClasses, engineWorkingDirectory, nodeModulesFolder, - engineOutputStream); - } - - public DataStore getWeaverArgs() { - return options.getWeaverArgs(); - } - - /** - * @param js the js to set - */ - public void setJs(StringBuilder js) { - this.js = js; - } - - /** - * @param js the js to append - */ - public void appendJs(StringBuilder js) { - this.js.append(js); - } - - /** - * @return the js - */ - public StringBuilder getJs() { - return js; - } - - /* - * public static void die(String error) { ErrorMsg.say(error); + * This is a super-set of getWeaverOptions(), which includes launch-specific + * flags, and returns an instance of the + * Apache Commons CLI package. * - * throw new RuntimeException(error); } */ - public Aspects getAsps() { - return asps; - } + private static Options getCliOptions(WeaverEngine weaverEngine) { + Collection

- * Does not verify if import has already been imported. - * - * @param importName - */ - public static void loadLaraImport(String importName) { - - var weaverEngine = WeaverEngine.getThreadLocalWeaver(); - - var laraImporter = getLaraImporter(); - var laraImports = laraImporter.getLaraImports(importName); - - if (laraImports.isEmpty()) { - throw new RuntimeException("Could not find files for import '" + importName + "'. Current include paths: " - + laraImporter.getIncludes()); - } - - // Import JS code - for (var laraImport : laraImports) { - SpecsLogs.debug( - () -> "Loading LARA Import '" + laraImport.getFilename() + "' as " + laraImport.getFileType()); - - var source = laraImport.getJsFile().map(file -> SpecsIo.normalizePath(file.getAbsolutePath())).orElse(laraImport.getFilename()); - - // For some reason that we still don't know if an import comes from a resource - // and the 'source' value does not have the following suffix, the class of the import will - // not be found (at least in Linux, in Windows is ok). - source = source + " (LARA import '" + importName + "' as " + laraImport.getFileType().toString() + ")"; - - weaverEngine.getScriptEngine().eval(laraImport.getCode(), laraImport.getFileType(), - source); - } - - } - - public static LaraImporter getLaraImporter() { - var weaverEngine = WeaverEngine.getThreadLocalWeaver(); - var larai = LaraI.getThreadLocalLarai(); - - // Prepare includes - var includes = new LinkedHashSet(); - - // Add working directory - includes.add(SpecsIo.getWorkingDir()); - - // Add context folder, if present - var configurationFolder = LaraI.getThreadLocalData().get(JOptionKeys.CURRENT_FOLDER_PATH) - .map(File::new) - .orElse(null); - - if (configurationFolder != null && configurationFolder.isDirectory()) { - includes.add(configurationFolder); - } - - // Add user includes - includes.addAll(larai.getOptions().getProcessedIncludeDirs(weaverEngine).getFiles()); - - // Finally, add weaver APIs (they have the lowest priority) - weaverEngine.getApiManager().getNpmApiFolders().stream() - .forEach(includes::add); - - // Find files to import - var laraImporter = new LaraImporter(LaraI.getThreadLocalLarai(), new ArrayList<>(includes)); - - return laraImporter; - } - - public static Collection getLaraImportInPackage(String packageName) { - var laraImporter = getLaraImporter(); - return laraImporter.getImportsFromPackage(packageName); - } - } diff --git a/LARAI/src/larai/LaraiResult.java b/LARAI/src/larai/LaraiResult.java deleted file mode 100644 index a58858c8b..000000000 --- a/LARAI/src/larai/LaraiResult.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2018 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larai; - -import org.suikasoft.jOptions.DataStore.ADataClass; -import org.suikasoft.jOptions.Datakey.DataKey; -import org.suikasoft.jOptions.Datakey.KeyFactory; - -public class LaraiResult extends ADataClass { - - public final static DataKey IS_SUCCESS = KeyFactory.bool("isSuccess"); - public final static DataKey IS_RUNNING_GUI = KeyFactory.bool("isRunningGui"); - - public static LaraiResult newInstance(boolean isSuccess, boolean isRunningGui) { - return new LaraiResult().set(IS_SUCCESS, isSuccess).set(IS_RUNNING_GUI, isRunningGui); - } -} diff --git a/LARAI/src/larai/larabundle/BundleType.java b/LARAI/src/larai/larabundle/BundleType.java deleted file mode 100644 index 0e24a03ce..000000000 --- a/LARAI/src/larai/larabundle/BundleType.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larai.larabundle; - -import pt.up.fe.specs.util.enums.EnumHelperWithValue; -import pt.up.fe.specs.util.lazy.Lazy; -import pt.up.fe.specs.util.providers.StringProvider; - -public enum BundleType implements StringProvider { - WEAVER("weaver"), - CUSTOM("custom"); - - private static final Lazy> ENUM_HELPER = EnumHelperWithValue.newLazyHelperWithValue(BundleType.class); - - public static EnumHelperWithValue getHelper() { - return ENUM_HELPER.get(); - } - - private final String string; - - private BundleType(String string) { - this.string = string; - } - - @Override - public String getString() { - return string; - } - -} diff --git a/LARAI/src/larai/larabundle/LaraBundle.java b/LARAI/src/larai/larabundle/LaraBundle.java deleted file mode 100644 index a8670f175..000000000 --- a/LARAI/src/larai/larabundle/LaraBundle.java +++ /dev/null @@ -1,239 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larai.larabundle; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; - -import org.lara.interpreter.joptions.keys.FileList; - -import com.google.common.base.Preconditions; - -import pt.up.fe.specs.util.SpecsCollections; -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.SpecsLogs; -import pt.up.fe.specs.util.properties.SpecsProperties; - -public class LaraBundle { - - private final static String LARA_BUNDLE_FILENAME = "lara.bundle"; - private final static String LARA_FOLDER_NAME = "lara"; - - public static String getLaraBundleFilename() { - return LARA_BUNDLE_FILENAME; - } - - public static String getLaraFolderName() { - return LARA_FOLDER_NAME; - } - - public static SpecsProperties loadBundleFile(File bundlePath) { - Preconditions.checkArgument(bundlePath.exists(), "Expected path '" + bundlePath + "' to exist"); - - if (bundlePath.isDirectory()) { - File bundleFile = new File(bundlePath, LARA_BUNDLE_FILENAME); - if (!bundleFile.isFile()) { - throw new RuntimeException( - "Could not find file '" + LARA_BUNDLE_FILENAME + "' in folder '" + bundlePath + "'"); - } - - return loadBundleFile(bundleFile); - } - - return SpecsProperties.newInstance(bundlePath); - } - - public static boolean isBundleFolder(File path) { - return new File(path, LaraBundle.getLaraBundleFilename()).isFile(); - } - - // private final Set languages; - private final Set weavers; - private final Map tagsMap; - - // public LaraBundle(Set languages, Set weavers) { - // public LaraBundle(Set weavers, String tagsMap) { - // this(weavers, parseTags(tagsMap)); - // } - // - // private static Map parseTags(String tagsMap) { - // return null; - // } - - public LaraBundle(String weaverName, Map tagsMap) { - this(Arrays.asList(weaverName), tagsMap); - } - - public LaraBundle(Collection names, Map tagsMap) { - // this.languages = languages; - // this.weavers = weavers; - // Make sure weaver names are in lower-case - this.weavers = SpecsCollections.toSet(names, String::toLowerCase); - // this.weavers = names.stream().map(String::toLowerCase).collect(Collectors.toSet()); - this.tagsMap = tagsMap; - } - - public FileList process(FileList includeFolders) { - List unbundledFolders = new ArrayList<>(); - - for (File includeFolder : includeFolders.getFiles()) { - addFolder(includeFolder, unbundledFolders); - // If no lara.bundle file, add and skip - // File laraBundleFile = new File(includeFolder, "lara.bundle"); - // if (!laraBundleFile.isFile()) { - // unbundledFolders.add(includeFolder); - // continue; - // } - // - // addBundleFolders(includeFolder, laraBundleFile, unbundledFolders); - - } - return FileList.newInstance(unbundledFolders); - - } - - private void addFolder(File includeFolder, List unbundledFolders) { - unbundledFolders.add(includeFolder); - - // If no lara.bundle file, return - File laraBundleFile = new File(includeFolder, "lara.bundle"); - if (!laraBundleFile.isFile()) { - return; - } - - addBundleFolders(includeFolder, laraBundleFile, unbundledFolders); - } - - private void addBundleFolders(File includeFolder, File laraBundleFile, List unbundledFolders) { - SpecsProperties laraBundle = SpecsProperties.newInstance(laraBundleFile); - - BundleType bundleType = null; - try { - bundleType = BundleType.getHelper().fromValue(laraBundle.get(LaraBundleProperty.BUNDLE_TYPE)); - } catch (Exception e) { - throw new RuntimeException("Problems while loading bundle folder '" + includeFolder + "'", e); - } - - // If custom, get the tag - - Optional> tagValue = getTagValue(laraBundle); - - if (!tagValue.isPresent()) { - SpecsLogs.msgInfo("No value set for bundle tag '" + laraBundle + "', ignoring bundles in folder '" - + includeFolder + "'"); - return; - } - - switch (bundleType) { - case CUSTOM: - addBundleFolders(includeFolder, laraBundleFile, tagValue.get(), unbundledFolders); - break; - case WEAVER: - addBundleFolders(includeFolder, laraBundleFile, weavers, unbundledFolders); - break; - default: - throw new RuntimeException("Not implemented:" + bundleType); - } - - } - - private Optional> getTagValue(SpecsProperties laraBundle) { - String tag = laraBundle.get(LaraBundleProperty.BUNDLE_TAG); - Preconditions.checkNotNull(tag, "Bundle has 'bundleType' property set to 'custom', but no 'tag' property"); - - // Get current value of the tag - String value = tagsMap.get(tag); - - if (value == null) { - return Optional.empty(); - } - // Preconditions.checkNotNull(value, "No value set for bundle tag '" + tag + "'"); - - return Optional.of(new HashSet<>(Arrays.asList(value))); - } - - private void addBundleFolders(File includeFolder, File laraBundleFile, Set supportedNames, - List unbundledFolders) { - - // Each folder represents a weaver / language - List bundleFolders = SpecsIo.getFolders(includeFolder); - - // For each folder, check if name corresponds to a supported name - boolean foundBundle = false; - for (File bundleFolder : bundleFolders) { - // If does not correspond, skip - if (!isFolderSupported(bundleFolder.getName(), supportedNames)) { - continue; - } - - // Folder is supported, add. Calling this method - // adds support for nested bundles - addFolder(bundleFolder, unbundledFolders); - // unbundledFolders.add(weaverFolder); - - if (!bundleFolder.getName().equals("lara")) { - foundBundle = true; - } - } - - if (!foundBundle) { - Preconditions.checkArgument(supportedNames.size() == 1, - "Expected size to be 1, it is " + supportedNames.size()); - String tag = supportedNames.stream().findFirst().get(); - SpecsLogs.msgInfo("Could not find a bundle for tag '" + tag + "' in folder '" - + includeFolder.getAbsolutePath() + "'"); - } - } - - private boolean isFolderSupported(String weaverFoldername, Set supportedNames) { - // Do not mind case - weaverFoldername = weaverFoldername.toLowerCase(); - - // LARA is always supported - if (weaverFoldername.equals("lara")) { - return true; - } - - if (supportedNames.contains(weaverFoldername)) { - return true; - } - - return false; - /* - // Split name - String[] names = weaverFoldername.toLowerCase().split("_"); - - for (String name : names) { - // LARA is always supported - if (name.equals("lara")) { - return true; - } - - if (supportedNames.contains(name)) { - return true; - } - } - - return false; - */ - } - -} diff --git a/LARAI/src/larai/larabundle/LaraBundleProperty.java b/LARAI/src/larai/larabundle/LaraBundleProperty.java deleted file mode 100644 index ca67a9c1a..000000000 --- a/LARAI/src/larai/larabundle/LaraBundleProperty.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larai.larabundle; - -import pt.up.fe.specs.util.providers.StringProvider; - -public enum LaraBundleProperty implements StringProvider { - BUNDLE_TYPE("bundleType"), - BUNDLE_TAG("tag"); - - private final String string; - - private LaraBundleProperty(String string) { - this.string = string; - } - - @Override - public String getString() { - return string; - } - -} diff --git a/LARAI/src/larai/lararesource/LaraResource.java b/LARAI/src/larai/lararesource/LaraResource.java deleted file mode 100644 index 35fdac60e..000000000 --- a/LARAI/src/larai/lararesource/LaraResource.java +++ /dev/null @@ -1,268 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larai.lararesource; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.function.Predicate; - -import org.lara.interpreter.joptions.keys.FileList; -import org.lara.interpreter.weaver.interf.WeaverEngine; - -import com.google.common.base.Preconditions; - -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.SpecsLogs; -import pt.up.fe.specs.util.SpecsStrings; -import pt.up.fe.specs.util.utilities.LineStream; - -public class LaraResource { - - private static final String LARA_RESOURCE_FOLDER = "laraResources"; - private static final String LARA_RESOURCE_FILE = "lara.resource"; - - private final WeaverEngine weaver; - - public LaraResource(WeaverEngine weaver) { - this.weaver = weaver; - } - - public FileList process(FileList includeFolders) { - Set processedFolders = new HashSet<>(); - boolean addedResourceFolder = false; - for (File includeFolder : includeFolders.getFiles()) { - // System.out.println("ADDING FOLDER: " + includeFolder); - // If no resource folder, add it - // Add resource folders recursively, unless it is a bundle folder - // Check if folder as a 'resources' folder - if (!isLaraResource(includeFolder)) { - processedFolders.add(includeFolder); - - // if (isFromBundle(includeFolder)) { - // System.out.println("SKIPPING: " + includeFolder); - // continue; - // } - // If lara.bundle file, skip folder - File laraBundleFile = new File(includeFolder, "lara.bundle"); - if (laraBundleFile.isFile()) { - // System.out.println("LARA RESOURCE SKIPPING FOLDER " + includeFolder); - continue; - } - - // File resourceFolder = new File(includeFolder, "resources"); - // if (isLaraResource(resourceFolder)) { - // addedResourceFolder = addResourceFolder(resourceFolder, processedFolders, addedResourceFolder); - // } - - for (File subfolder : getFoldersRecursiveExludingBundles(includeFolder)) { - // if (isFromBundle(subfolder)) { - // System.out.println("SKIPPING: " + subfolder); - // continue; - // } - - if (isLaraResource(subfolder)) { - addedResourceFolder = addResourceFolder(subfolder, processedFolders, addedResourceFolder); - - // File laraResourceFolderLARA RESOURCE FOLDER: = processLaraFolder(subfolder); - // - // if (!addedResourceFolder) { - // processedFolders.add(laraResourceFolder); - // addedResourceFolder = true; - // } - - } - } - - continue; - } - - addedResourceFolder = addResourceFolder(includeFolder, processedFolders, addedResourceFolder); - /* - // Process folder. Returns include resource folder, - // which is the same for all Lara resources, add it - // only once. - - File laraResourceFolder = processLaraFolder(includeFolder); - - if (!addedResourceFolder) { - processedFolders.add(laraResourceFolder); - addedResourceFolder = true; - } - */ - } - - return FileList.newInstance(processedFolders); - - } - - private List getFoldersRecursiveExludingBundles(File includeFolder) { - - Predicate exclude = bundleFolder -> new File(bundleFolder, "lara.bundle").isFile(); - List collecterFolders = new ArrayList<>(); - - getFoldersRecursiveExludingBundles(includeFolder, collecterFolders, exclude); - - return collecterFolders; - } - - private void getFoldersRecursiveExludingBundles(File baseFolder, List collecterFolders, - Predicate exclude) { - - // Check if subfolder should be considered - if (exclude.test(baseFolder)) { - return; - } - - collecterFolders.add(baseFolder); - - // Process children - List subFolders = SpecsIo.getFolders(baseFolder); - for (File subFolder : subFolders) { - getFoldersRecursiveExludingBundles(subFolder, collecterFolders, exclude); - } - - } - - /** - * Check folder and all its parents - * - * @param includeFolder - * @return - */ - private boolean isFromBundle(File includeFolder) { - File currentFolder = includeFolder; - - while (currentFolder != null) { - - File laraBundleFile = new File(currentFolder, "lara.bundle"); - if (laraBundleFile.isFile()) { - return true; - } - - currentFolder = currentFolder.getParentFile(); - } - - return false; - } - - private boolean addResourceFolder(File includeFolder, Set processedFolders, boolean addedResourceFolder) { - // Process folder. Returns include resource folder, - // which is the same for all Lara resources, add it - // only once. - - File laraResourceFolder = processLaraFolder(includeFolder); - - if (!addedResourceFolder) { - processedFolders.add(laraResourceFolder); - addedResourceFolder = true; - } - // System.out.println("LARA RESOURCE FOLDER: " + includeFolder); - return addedResourceFolder; - } - - private File processLaraFolder(File includeFolder) { - // Get import path - String importPath = getImportPath(includeFolder); - - // Get resource name - String resourceName = getResourceName(importPath); - - String laraFileContents = buildLaraFileContents(includeFolder, resourceName); - - File laraFile = getLaraFile(importPath); - SpecsLogs.debug(() -> "Creating LARA resource helper file in " + laraFile.getAbsolutePath()); - SpecsIo.write(laraFile, laraFileContents); - - return getLaraResourceFolder(); - } - - private String buildLaraFileContents(File includeFolder, String resourceName) { - StringBuilder code = new StringBuilder(); - - code.append("import lara.Io;\n"); - code.append("import lara.util.LocalFolder;\n\n"); - - String escapedPath = SpecsStrings.escapeJson(includeFolder.getAbsolutePath()); - - code.append("var " + resourceName + " = new LocalFolder(\"" + escapedPath + "\");\n\n"); - - // code.append(resourceName + ".getFileList = function() {\n" + - // " var files = SpecsIo.getFilesRecursive(this.baseFolder);\n" + - // " var resourceFile = Io.getPath(this.getBaseFolder(), \"" + LARA_RESOURCE_FILE + "\");\n" + - // " files.remove(resourceFile);\n" + - // " return files;\n" + - // "}"); - - code.append(resourceName + ".getFileList = function(path) {\n" + - " var files = this._getFileListPrivate(path);\n" + - " var resourceFile = Io.getPath(this.getBaseFolder(), \"" + LARA_RESOURCE_FILE + "\");\n" + - " files.remove(resourceFile);\n" + - " return files;\n" + - "}"); - return code.toString(); - - } - - private String getResourceName(String importPath) { - int lastDotIndex = importPath.lastIndexOf('.'); - - if (lastDotIndex == -1) { - return importPath; - } - - Preconditions.checkArgument(!importPath.endsWith("."), - "Import path of lara resource must not end with dot (.): " + importPath); - - return importPath.substring(lastDotIndex + 1); - } - - public static File getLaraResourceFile(File includeFolder) { - return new File(includeFolder, LARA_RESOURCE_FILE); - } - - private String getImportPath(File includeFolder) { - try (LineStream lines = LineStream.newInstance(getLaraResourceFile(includeFolder))) { - while (lines.hasNextLine()) { - String line = lines.nextLine().trim(); - - // Ignore lines starting with # - if (line.startsWith("#")) { - continue; - } - - return line; - } - } - - throw new RuntimeException("Could not find an import path inside the lara.resource '" - + getLaraResourceFile(includeFolder).getAbsolutePath() + "'"); - } - - private boolean isLaraResource(File includeFolder) { - return getLaraResourceFile(includeFolder).isFile(); - } - - private File getLaraResourceFolder() { - return new File(weaver.getTemporaryWeaverFolder(), LARA_RESOURCE_FOLDER); - } - - private File getLaraFile(String importPath) { - String laraFile = importPath.replace('.', '/') + ".lara"; - return new File(getLaraResourceFolder(), laraFile); - } - -} diff --git a/LARAI/src/larai/test/TestClasses.java b/LARAI/src/larai/test/TestClasses.java deleted file mode 100644 index bbd93576b..000000000 --- a/LARAI/src/larai/test/TestClasses.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright 2014 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package larai.test; - -import java.util.Map; - -public class TestClasses { - - public static void test(Object... objects) { - - for (final Object obj : objects) { - System.out.println(obj.getClass().getCanonicalName()); - } - - for (final Object obj : objects) { - System.out.print(obj + ", "); - } - System.out.println(); - } - - public static void test2(int num, int[] array, Map map, String string) { - - System.out.println(num + ", " + array + ", " + map + ", " + string); - for (final int str : array) { - - System.out.println("ARRAY: " + str); - } - } - -} diff --git a/LARAI/src/org/lara/interpreter/Interpreter.java b/LARAI/src/org/lara/interpreter/Interpreter.java deleted file mode 100644 index e0ae82a34..000000000 --- a/LARAI/src/org/lara/interpreter/Interpreter.java +++ /dev/null @@ -1,1325 +0,0 @@ -/* - * Copyright 2013 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ -package org.lara.interpreter; - -import java.io.File; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import javax.script.ScriptException; - -import org.apache.commons.lang3.StringEscapeUtils; -import org.lara.interpreter.exception.EvaluationException; -import org.lara.interpreter.exception.LaraIException; -import org.lara.interpreter.generator.js.ExpressionProcessor; -import org.lara.interpreter.generator.stmt.AspectClassProcessor; -import org.lara.interpreter.generator.stmt.ImportProcessor; -import org.lara.interpreter.generator.stmt.StatementProcessor; -import org.lara.interpreter.generator.stmt.WeaverStatementProcessor; -import org.lara.interpreter.joptions.config.interpreter.LaraIDataStore; -import org.lara.interpreter.joptions.config.interpreter.LaraiKeys; -import org.lara.interpreter.joptions.keys.OptionalFile; -import org.lara.interpreter.profile.ReportField; -import org.lara.interpreter.profile.WeaverProfiler; -import org.lara.interpreter.utils.Coordinates; -import org.lara.interpreter.utils.LaraIUtils; -import org.lara.interpreter.utils.LaraIUtils.Operators; -import org.lara.interpreter.utils.MessageConstants; -import org.lara.interpreter.weaver.events.EventTriggerGenerator; -import org.lara.interpreter.weaver.interf.JoinPoint; -import org.lara.interpreter.weaver.interf.WeaverEngine; -import org.lara.interpreter.weaver.interf.events.Stage; - -import com.google.common.base.Preconditions; - -import larac.objects.Enums.Types; -import larac.utils.output.Output; -import larac.utils.xml.Pair; -import larai.LaraI; -import pt.up.fe.specs.jsengine.JsEngine; -import pt.up.fe.specs.jsengine.JsFileType; -import pt.up.fe.specs.lara.aspectir.Argument; -import pt.up.fe.specs.lara.aspectir.Aspect; -import pt.up.fe.specs.lara.aspectir.Aspects; -import pt.up.fe.specs.lara.aspectir.Code; -import pt.up.fe.specs.lara.aspectir.ExprBody; -import pt.up.fe.specs.lara.aspectir.ExprCall; -import pt.up.fe.specs.lara.aspectir.ExprId; -import pt.up.fe.specs.lara.aspectir.ExprKey; -import pt.up.fe.specs.lara.aspectir.ExprLiteral; -import pt.up.fe.specs.lara.aspectir.ExprOp; -import pt.up.fe.specs.lara.aspectir.Expression; -import pt.up.fe.specs.lara.aspectir.IElement; -import pt.up.fe.specs.lara.aspectir.Parameter; -import pt.up.fe.specs.lara.aspectir.ParameterList; -import pt.up.fe.specs.lara.aspectir.ParameterSection; -import pt.up.fe.specs.lara.aspectir.Statement; -import pt.up.fe.specs.tools.lara.trace.CallStackTrace; -import pt.up.fe.specs.util.SpecsCheck; -import pt.up.fe.specs.util.SpecsIo; - -public class Interpreter { - - public static final String ARGS_PREFIX = ""; - public static final String ATTRIBUTES = "attributes"; - public static final String TOOLS_CONTEXT = "tools"; - // public static final String PROPERTY_GETTER = "laraGetter"; - - public static final String JPUTILS_NAME = "__jpUtils"; - private final LaraI laraInterp; - private final LaraIDataStore options; - private Output out = new Output(); - private final JsEngine engine; - private final WeaverStatementProcessor wStmtProcessor; - private final AspectClassProcessor aspectProcessor; - private final ImportProcessor importProcessor; - private final StatementProcessor statementProcessor; - private CallStackTrace stackStrace; - - // private List js2LARALines; - - /** - * Create a new interpreter based on a given context and scope - * - * @param laraInt - * The larai instance using this interpreter - * @param cx - * the javascript context for this interpreter - * @param scope - * the scope for this interpreter - */ - public Interpreter(LaraI laraInt, JsEngine engine) { - // this(laraInt, engine, true); - // } - // - // public Interpreter(LaraI laraInt, JsEngine engine, boolean importScripts) { - laraInterp = laraInt; - options = laraInterp.getOptions(); - out = laraInterp.out; - this.engine = engine; - wStmtProcessor = WeaverStatementProcessor.newInstance(this); - aspectProcessor = AspectClassProcessor.newInstance(this); - importProcessor = ImportProcessor.newInstance(this); - statementProcessor = StatementProcessor.newInstance(this); - if (options.useStackTrace()) { - stackStrace = new CallStackTrace(); - } - - if (options.getWeaverArgs().get(LaraiKeys.API_AUTOLOAD)) { - importProcessor.importScriptsAndClasses(); - importProcessor.importAndInitialize(); - } - } - - public JsEngine getEngine() { - return engine; - } - - /** - * Interpret a list of aspects and run the main aspect. - * - * @param asps - * The Input Aspects - * @param cx - * The javascript context - * @param scope - * The javascript scope - * @return the main aspect after its execution - * @throws ScriptException - */ - public StringBuilder interpretLara(Aspects asps) { - return aspectProcessor.generateJavaScript(asps); - } - - public Object executeMainAspect(final StringBuilder mainCall) { - long start = setupStage(); - - String code = mainCall.toString(); - final Object result = evaluate(code, "main_aspect");// cx.evaluateString(scope, code, "", 1, null); - - completeStage(start); - return result; - } - - public Object executeMainAspect(File mainFile) { - long start = setupStage(); - - final Object result = evaluate(mainFile); - - completeStage(start); - return result; - } - - public Object executeMainAspect(String code, JsFileType type, String source) { - long start = setupStage(); - - final Object result = evaluate(code, type, source); - - completeStage(start); - return result; - } - - private long setupStage() { - out.println(MessageConstants.getHeaderMessage(MessageConstants.order++, "Executing Main Aspect")); - long begin = LaraI.getCurrentTime(); - laraInterp.getWeaver().setInitialTime(begin); - return begin; - } - - private void completeStage(long begin) { - long end = LaraI.getCurrentTime() - begin; - laraInterp.getWeavingProfile().report(ReportField.WEAVING_TIME, (int) end); - // exportMetrics(); - out.println(MessageConstants.getElapsedTimeMessage(end)); - } - - /** - * Export the weaver metrics to the given file - */ - public void exportMetrics() { - OptionalFile reportFile = getOptions().getMetricsFile(); - if (!reportFile.isUsed()) { - return; - } - - File file = reportFile.getFile(); - WeaverProfiler weavingProfile = laraInterp.getWeavingProfile(); - SpecsIo.write(file, weavingProfile.buildJsonReport()); - } - - /** - * Standard method for evaluating a string - * - * @param importer - * @return - * @throws ScriptException - */ - public Object evaluate(String code, String source) { - return evaluate(code, JsFileType.NORMAL, source); - // return evaluate(code, JsFileType.MODULE, source); - } - - public Object evaluate(String code, JsFileType type, String source) { - - try { - // System.out.println("CODE:\n" + code); - // System.out.println("\nCODE END"); - // return engine.getEngine().eval(code); - return engine.eval(code, type, source); - // } catch (ScriptException e) { - } catch (Exception e) { - - // Check is there is any BaseException as cause - // Throwable current = e; - // while (current != null && !(current instanceof BaseException)) { - // current = current.getCause(); - // } - // - // if (current != null) { - // throw (BaseException) current; - // } - - // System.out.println("SCRIPT EXCEPTION: " + e.getClass()); - // System.out.println(e); - // System.out.println("CAUSE:" + e.getCause().getCause()); - // SpecsLogs.info("Could not evaluate code:\n" + code); - - // throw new EvaluationException("Could not evaluate code:\n" + code, e); - - throw new EvaluationException(e); - // throw new RuntimeException(e); - } - - } - - public Object evaluate(File jsFile) { - return engine.evalFile(jsFile); - - // try { - // return engine.evalFile(jsFile); - // } catch (Exception e) { - // throw new EvaluationException(e); - // } - } - - /** - * Evaluate a set of lines of code - * - * @param lines - */ - // private void evaluateStrings(String... lines) { - // for (final String line : lines) { - // evaluate(line); - // } - // } - - // ================================================================================// - // ParameterList // - // ================================================================================// - public StringBuilder getJavascriptString(ParameterList paramList, int depth) { - final StringBuilder ret = new StringBuilder(); - for (final Parameter param : paramList.parameters) { - ret.append(LaraIUtils.getSpace(depth) + "this."); - ret.append(getJavascriptString(param, 0)); - ret.append(";\n"); - } - return ret; - } - - // ================================================================================// - // Parameter // - // ================================================================================// - public StringBuilder getJavascriptString(Parameter param, int depth) { - final StringBuilder ret = new StringBuilder(LaraIUtils.getSpace(depth) + "this." + param.name + " = (" - + Interpreter.ARGS_PREFIX + param.name + "!=undefined)?" + Interpreter.ARGS_PREFIX + param.name + ":"); - if (!param.exprs.isEmpty()) { - ret.append(getJavascriptString(param.exprs.get(0), 0)); - } else { - ret.append("undefined"); - } - return ret; - } - - // ================================================================================// - // Argument // - // ================================================================================// - public StringBuilder getJavascriptString(Argument arg, int depth) { - final StringBuilder ret = new StringBuilder(LaraIUtils.getSpace(depth)); - if (arg.exprs.isEmpty()) { - return ret; - } - if (arg.name != null) { - ret.append(arg.name + ": "); - } - for (final Expression expr : arg.exprs) { - ret.append(getJavascriptString(expr, depth)); - ret.append(", "); - } - ret.delete(ret.length() - 2, ret.length()); - return ret; - } - - // ================================================================================// - // Expression // - // ================================================================================// - public StringBuilder getJavascriptString(Expression exp, int depth) { - - // In case of another type of expression - if (exp instanceof ExprCall) { - return getJavascriptString((ExprCall) exp, depth); - } - if (exp instanceof ExprBody) { - return getJavascriptString((ExprBody) exp, depth); - } - if (exp instanceof ExprId) { - return ExpressionProcessor.getJavascriptString((ExprId) exp, depth); - } - if (exp instanceof ExprLiteral) { - return getJavascriptString((ExprLiteral) exp, depth); - } - if (exp instanceof ExprOp) { - return getJavascriptString((ExprOp) exp, depth); - } - // if(exp instanceof ExprProperty) - // return getJavascriptString((ExprProperty)exp,depth); - if (exp instanceof ExprKey) { - return getJavascriptString((ExprKey) exp, depth); - } - // Else - if (exp.xmltag.equals("property")) { - final StringBuilder ret = new StringBuilder(LaraIUtils.getSpace(depth)); - - if (exp.exprs.size() == 1) { - ret.append(getJavascriptString(exp.exprs.get(0), -1)); - return ret; - } - - // Check if laraGetter should be used - // System.out.println("EXP: " + getJavascriptString(exp.exprs.get(0), -1)); - // System.out.println("EXP2: " + getJavascriptString(exp.exprs.get(1), 0)); - // System.out.println("USE LARA GETTER?: " + useLaraGetter(exp)); - if (useLaraGetter(exp)) { - ret.append(JoinPoint.getLaraGetterName()) - .append("(") - .append(getJavascriptString(exp.exprs.get(0), -1)) - .append(",") - .append(getJavascriptString(exp.exprs.get(1), 0)) - .append(")"); - - return ret; - } - - // Use native property operator - ret.append(getJavascriptString(exp.exprs.get(0), -1)); - ret.append("["); - ret.append(getJavascriptString(exp.exprs.get(1), 0)); - ret.append("]"); - - return ret; - - } - final StringBuilder ret = new StringBuilder(); - if (exp.exprs.isEmpty()) { - return ret; - } - for (final Expression expr : exp.exprs) { - ret.append(getJavascriptString(expr, depth)); - ret.append(", "); - } - ret.delete(ret.length() - 2, ret.length()); - return ret; - } - - private boolean useLaraGetter(Expression propertyExp) { - // var prop = getJavascriptString(propertyExp.exprs.get(1), 0).toString(); - // var access = getJavascriptString(propertyExp.exprs.get(0), -1) + "[" + - // getJavascriptString(propertyExp.exprs.get(1), 0) + "]"; - // if (prop.equals("'descendants'")) { - // System.out.println("Found descendants in " + access); - // } - - // If engine supports transforming properties into accessors, - // always use properties - if (getEngine().supportsProperties()) { - // if (prop.equals("'descendants'")) { - // System.out.println("1 false. Engine supports"); - // } - return false; - } - - // If parent is a method, do not use laraGetter - var parent = propertyExp.getParent(); - if (parent instanceof Expression && "method".equals(((Expression) parent).xmltag)) { - - // if (prop.equals("'descendants'")) { - // System.out.println("2 false. Parent is a method"); - // } - return false; - // var exprParent = (Expression) parent; - // System.out.println("PARENT TAG: " + exprParent.xmltag); - } - - // Do not use laraGetter if it is the target of an operation - ExprOp opAncestor = propertyExp.getAncestor(ExprOp.class); - - // Do not use laraGetter if this is an arrow function - - if (opAncestor == null) { - // if (prop.equals("'descendants'")) { - // System.out.println("3 true. No op ancestor"); - // } - return true; - } - - // Set problematicOps = new HashSet<>(Arrays.asList("ASSIGN", "INCS", "DECS")); - // if (!problematicOps.contains(opAncestor.name)) { - // return false; - // } - - SpecsCheck.checkArgument(!opAncestor.exprs.isEmpty(), () -> "Expected operator to have expressions"); - Expression currentLeftHand = opAncestor.exprs.get(0); - - // Look for the first property on the left hand - if (currentLeftHand == propertyExp) { - // if (prop.equals("'descendants'")) { - // System.out.println("4 false. current left hand == propertyExp"); - // } - return false; - } - // System.out.println("LARA GETTER 2: " + propertyExp); - // Otherwise, always use laraGeter - // if (prop.equals("'descendants'")) { - // System.out.println("5 true."); - // } - return true; - - } - /* - private Expression getLastProperty(Expression expr) { - Set allowedTags = new HashSet<>(Arrays.asList("property", "call", "method")); - System.out.println("EXPR: " + expr.xmltag); - var currentExp = expr; - while (allowedTags.contains(currentExp.exprs.get(0).xmltag)) { - currentExp = currentExp.exprs.get(0); - System.out.println("ALLOWED EXPR: " + currentExp.xmltag); - } - return currentExp; - } - */ - // private Expression getLeftHandChild(Expression expr) { - // switch (expr.xmltag) { - // case "property": - // return expr.exprs.get(1); - // default: - // if (expr.exprs.size() > 1) { - // throw new RuntimeException( - // "Tag " + expr.xmltag + " has " + expr.exprs.size() + " children, what should do?"); - // } - // - // return expr.exprs.get(0); - // } - // } - - /* - * private String seeIfIsAttributeAccess(Expression expr, IElement parent) { - * - * if (expr instanceof ExprId) { - * - * boolean startWithDollarSign = ((ExprId) expr).name.startsWith("$"); if - * (startWithDollarSign) { if (parent instanceof Expression) { Expression - * exprParent = (Expression) parent; if (exprParent.xmltag == null || - * !exprParent.xmltag.equals("method")) return "()"; } else return "()"; } } - * return ""; } - */ - // ================================================================================// - // Code // - // ================================================================================// - private boolean brackets = true; - private boolean newInstance = false; - - public StringBuilder getJavascriptString(Code c, int depth) { - final boolean myBrackets = brackets; - - brackets = true; - final StringBuilder stats = new StringBuilder(); - if (depth < 0) { - depth = -depth; - } else { - stats.append(LaraIUtils.getSpace(depth)); - } - if (myBrackets) { - stats.append("{\n"); - } - for (final Statement stat : c.statements) { - if (!myBrackets) { - stats.append(getJavascriptString(stat, 0)); - stats.append(","); - } else { - stats.append(getJavascriptString(stat, depth + 1)); - } - } - final StringBuilder forBrackets = new StringBuilder( - (stats.length() == 0) ? ";\n" : stats.substring(0, stats.length() - 1)); - return ((!myBrackets) ? forBrackets : (stats.append(LaraIUtils.getSpace(depth) + "}\n"))); - } - - // ================================================================================// - // ParameterList // - // ================================================================================// - public StringBuilder getJavascriptString(ExprBody exprBody, int depth) { - return getJavascriptString(exprBody.code, depth); - } - - // ================================================================================// - // ExprCall // - // ================================================================================// - public StringBuilder getJavascriptString(ExprCall exprCall, int depth) { - boolean newInstance = this.newInstance; - // if (newInstance) { - // System.out.println("EXPR CALL:"); - // exprCall.print(System.out, 0); - // } - this.newInstance = false; - final StringBuilder encapsule = new StringBuilder(); - StringBuilder call = getJavascriptString(exprCall.method, depth); - - final Pair methodName = getMethodName(exprCall, call.toString()); - - // out.println("for call "+call+" CALLING: " + methodName.getRight() + " - // from " + methodName.getLeft()); - - final String methodNameRight = methodName.getRight(); - final boolean isAction = wStmtProcessor.verifyAction(methodNameRight); - - // out.warnln("IS " + call + " ACTION? " + isAction); - // out.println("call to " + methodName.getLeft() + " " + - // methodName.getRight()); - - if (methodNameRight.equals("call")) { - - // ENCAPSULE method to TRIGGER ASPECT CALL EVENTS - if (hasEvents() && methodName.getLeft() != null && !methodName.getLeft().isEmpty()) { - encapsule.append(" ((" + methodName.getLeft() + "." + EventTriggerGenerator.IS_ASPECT + "?"); - encapsule.append(methodName.getLeft() + "." + EventTriggerGenerator.ASPECT_CALLER_PROPERTY_NAME + "= '" - + aspectProcessor.getCurrentAspect()); - encapsule.append("':undefined), "); - } - } - - if (isAction) { - String lastInChain = wStmtProcessor.getLastInChain(); - if (methodName.getLeft().isEmpty()) { - encapsule.append(""); - call = new StringBuilder(lastInChain + "['" + call + "']"); - methodName.setLeft(lastInChain); - } - // String jpName = methodName.getLeft(); - // if (jpName.isEmpty()) { - // jpName = lastInChain; - // } - // ENCAPSULE method to TRIGGER ACTION EVENTS - if (methodName.getLeft() != null && !methodName.getLeft().isEmpty() - && !laraInterp.getWeaver().getEngine().implementsEvents() && hasEvents()) { - encapsule.append( - "( (" + methodName.getLeft() + " instanceof " + JoinPoint.class.getSimpleName() + ")?("); - } - // encapsule.append(", "); - } - - if (exprCall.arguments.isEmpty()) { - call.append("()"); - return returnCall(encapsule, call, newInstance, isAction, methodName, exprCall.arguments); - } - if (exprCall.arguments.get(0).name != null) { - String context = ""; - - if (exprCall.method.exprs.get(0).exprs.isEmpty()) { - context = "null"; - } else { - context = call.substring(0, call.lastIndexOf("[")); - } - call = new StringBuilder("invoke(" + context + "," + call + ",{"); - for (final Argument arg : exprCall.arguments) { - call.append(getJavascriptString(arg, 0) + ","); - } - call.deleteCharAt(call.length() - 1); - call.append("})"); - return returnCall(encapsule, call, newInstance, isAction, methodName, exprCall.arguments); - } - call.append("("); - for (int i = 0; i < exprCall.arguments.size() - 1; i++) { - call.append(getJavascriptString(exprCall.arguments.get(i), 0)); - call.append(","); - } - call.append(getJavascriptString(exprCall.arguments.get(exprCall.arguments.size() - 1), 0)); - call.append(")"); - return returnCall(encapsule, call, newInstance, isAction, methodName, exprCall.arguments); - } - - private StringBuilder returnCall(StringBuilder encapsule, StringBuilder call, boolean newInstance, boolean isAction, - Pair methodName, List arguments) { - if (newInstance) { - StringBuilder temp = call; - call = new StringBuilder("new "); - call.append(temp); - // call = new StringBuilder("(new "); - // call.append(temp); - // call.append(")"); - } - if (encapsule.length() != 0) { - // This code is more feasible if done at weaver-side - WeaverEngine weaverEngine = laraInterp.getEngine(); - if (!weaverEngine.implementsEvents() - - && isAction && hasEvents()) { - encapsule.append(" /*IF JOIN POINT*/ "); - - // TRIGGER ACTION BEGIN EVENT - EventTriggerGenerator.triggerAction(Stage.BEGIN, - methodName.getRight(), - methodName.getLeft(), arguments, encapsule, 0, this); - // encapsule.append(", "); - encapsule.append(", ____temp___ = "); - encapsule.append(call); - encapsule.append(", "); - // TRIGGER ACTION END EVENT - EventTriggerGenerator.triggerAction(Stage.END, - methodName.getRight(), - methodName.getLeft(), arguments, encapsule, 0, this); - encapsule.append(", ____temp___ "); - encapsule.append("): /* ELSE */ "); - - } - - encapsule.append(call); - encapsule.append(")"); - return encapsuleCall(encapsule, methodName, newInstance); - } - return encapsuleCall(call, methodName, newInstance); - - } - - private StringBuilder encapsuleCall(StringBuilder callCode, Pair methodName, boolean newInstance) { - // if (newInstance) { - // System.out.println("ENCAPSULATE CALL CODE:" + callCode); - // } - - if (options.useStackTrace()) { - // Ignore if newInstance - // if (newInstance) { - // return callCode; - // } - - String called = methodName.getRight(); - if (methodName.getLeft() != null && !methodName.getLeft().isEmpty()) { - called = methodName.getLeft() + "." + called; - } - if (newInstance) { - called = "new " + called; - // called = "(new " + called + ")"; - } - called = StringEscapeUtils.escapeEcmaScript(called); - String position = "unknown"; - if (currentStatement != null) { - position = extractFileAndLineFromCoords(currentStatement.coord); - } - String pushToStack = ExpressionProcessor.pushToStack(called, position); - String popFromStack = ExpressionProcessor.popFromStack(called, position); - return new StringBuilder("( ") - .append(pushToStack) - .append(", ") - .append(CallStackTrace.RETURN_FOR_STACK_STRACE) - .append(" = ") - .append(callCode) - .append(", ") - .append(popFromStack) - .append(", ") - .append(CallStackTrace.RETURN_FOR_STACK_STRACE) - .append(" )"); - } - return callCode; - } - - public static String extractFileAndLineFromCoords(String coordsStr) { - Coordinates coords = new Coordinates(coordsStr); - if (!coords.isWellParsed()) { - return "unknown"; - } - return coords.fileAndLineString(); - } - - /** - * Returns a pair in which the left is the target object (if any) and the right side is the actual method invoked - * - * @param exprCall - * @param call - * @return - */ - private static Pair getMethodName(ExprCall exprCall, String call) { - - final Expression callExpr = exprCall.method.exprs.get(0); - if (!(callExpr instanceof ExprId || callExpr instanceof ExprLiteral)) { - if (callExpr.xmltag.equals("property")) { - - // Detect if LARA getter - if (!call.endsWith("]")) { - SpecsCheck.checkArgument(call.endsWith(")"), () -> "Expected to end with ')': " + call); - - String methodName = call.substring(call.lastIndexOf(",") + 1, call.length() - ")".length()).trim(); - methodName = methodName.replace("'", ""); - final String objName = call.substring(JoinPoint.getLaraGetterName().length() + 1, - call.lastIndexOf(",")); - - return new Pair<>(objName, methodName); - } - - String methodName = call.substring(call.lastIndexOf("[") + 1, call.lastIndexOf("]")); - methodName = methodName.replace("'", ""); - final String objName = call.substring(0, call.lastIndexOf("[")); - return new Pair<>(objName, methodName); - } - } - return new Pair<>("", call.replaceAll("'", "")); - - } - - // ================================================================================// - // ExprLiteral // - // ================================================================================// - public StringBuilder getJavascriptString(ExprLiteral literal, int depth) { - StringBuilder ret = new StringBuilder(LaraIUtils.getSpace(depth)); - String value = literal.value; - if (literal.type != null) { - // System.out.println("DEBUG: "+literal.value+" "+literal.type+" - // "+depth+literal.parent); - - if (literal.type.equals(Types.String.toString().toLowerCase()) && depth > -1) { - // occurrences of ' must be escaped! - value = escapeApostrophe(value); - return new StringBuilder(ret + "'" + value + "'"); - } - if (literal.type.equals(Types.RegEx.toString().toLowerCase())) { - return new StringBuilder(ret + value); - } - if (literal.type.equals(Types.Array.toString())) { - int i = 0; - if (!literal.exprs.isEmpty()) { - ret.append("[ "); - for (final Expression expr : literal.exprs) { - final ExprKey prop = (ExprKey) expr; - final int propPos = Integer.parseInt(prop.name); - while (propPos > i) { - ret.append(", "); - i++; - } - ret.append(getJavascriptString(expr.exprs.get(0), 0)); - ret.append(", "); - i++; - } - ret.delete(ret.length() - 2, ret.length()); - ret.append("]"); - return ret; - - } else if (value != null) { - return ret.append(value); - } - - return ret.append("[]"); - - } - if (literal.type.equals(Types.Object.toString())) { - if (value != null && value.equals("null")) { - ret.append(value); - return ret; - } - final boolean isCodeTemplate = literal.desc != null && literal.desc.equals("code"); - ret.append("{ "); - if (!literal.exprs.isEmpty()) { - for (final Expression expr : literal.exprs) { - final ExprKey prop = (ExprKey) expr; - ret.append(LaraIUtils.getSpace(depth) + "'" + prop.name + "': "); - - ret.append(getJavascriptString(expr, 0)); - - if (isCodeTemplate) { - ret.append("+''"); - } - ret.append(", \n"); - } - ret.delete(ret.length() - 2, ret.length()); - } - ret.append(LaraIUtils.getSpace(depth) + "}"); - - if (isCodeTemplate) { - final StringBuilder newRet = new StringBuilder("LARASystem.createCodeTemplate("); - newRet.append(ret); - newRet.append(")"); - ret = newRet; - } - return ret; - } - if (literal.type.equals(Types.Code.toString().toLowerCase())) { - return new StringBuilder("LARASystem.decode('" + value + "','" + Types.Base64 + "')"); - // return new StringBuilder("'" + literal.value + "'"); - } - if (literal.type.equals(Types.Base64.toString())) { - return new StringBuilder("LARASystem.decode('" + value + "','" + Types.Base64 + "')"); - } - } - ret.append(value); - return ret; - } - - // public static void main(String[] args) { - // - // List a = Arrays.asList("", "'", "aa", "aa'aa", "'aaaa", "aaaa'", "'aa'aa'", "\\'", "\\\\'"); - // for (String string : a) { - // System.out.print("checking \"" + string + "\": "); - // String[] result = consistentSplit(string, "'"); - // - // String escapedString = Arrays.asList(result).stream() - // .map(Interpreter::parseSplittedApostrofe) - // // .reduce("", ()) - // .collect(Collectors.joining("'")); - // - // System.out.println("Escaped String:" + escapedString); - // System.out.println(Arrays.toString(result)); - // } - - // } - - // private static String parseSplittedApostrofe(String element) { - // if (!element.endsWith("\\")) { - // return element;// + "\\"; - // } - // - // return requiresEscape(element) ? element + "\\" : element; - // } - // - // String[] split = value.split("'"); - // StringBuilder newString = new StringBuilder(); - // for (int i = 0; i < split.length - 1; i++) { - // String string = split[i]; - // newString.append(string); - // if (!string.endsWith("\\")) { - // newString.append('\\'); - // } else { - // if (requiresEscape(string)) { // requires escape! - // newString.append('\\'); - // } - // } - // newString.append('\''); - // } - // String str = split[split.length - 1]; - // newString.append(str); - // if (value.endsWith("'")) { - // if (requiresEscape(str)) { // requires escape! - // newString.append('\\'); - // } - // } - // newString.append('\''); - // return newString.toString(); - - private static String escapeApostrophe(String value) { // change to split + join(\') - - if (!value.contains("'")) { - return value; - } - if (value.equals("'")) { - return "\\'"; - } - - StringBuilder newString = new StringBuilder(); - int countSeparators = 0; - for (int i = 0; i < value.length(); i++) { - char charAt = value.charAt(i); - if (charAt == '\\') { - countSeparators++; - } else { - if (charAt == '\'') { - - if (countSeparators % 2 == 0) { // requires escape! - newString.append('\\'); - } - } - countSeparators = 0; - } - newString.append(charAt); - } - // StringBuilder newString = new StringBuilder(); - // for (int i = 0; i < value.length(); i++) { - // char charAt = value.charAt(i); - // if (charAt == '\'') { - // int sum = 0; - // int pos = i - 1; - // while (pos >= 0 && value.charAt(pos) == '\\') { - // sum++; - // pos--; - // } - // if (sum % 2 == 0) { // requires escape! - // newString.append('\\'); - // } - // } - // newString.append(charAt); - // } - return newString.toString(); - } - - // private static boolean requiresEscape(String string) { - // int sum = 0; - // int pos = string.length() - 1; - // while (pos >= 0 && string.charAt(pos) == '\\') { - // sum++; - // pos--; - // } - // return sum % 2 == 0; - // } - - public static String[] consistentSplit(String string, String pattern) { - if (string.isEmpty()) { - return new String[0]; - } - if (string.equals(pattern)) { - return new String[] { "", "" }; - } - - String[] splittedString = string.split(pattern); - - // If last character is different than original String, adds empty string to the end - if (splittedString.length != 0) { - String lastSplit = splittedString[splittedString.length - 1]; - Preconditions.checkArgument(!lastSplit.isEmpty(), - "Should not be empty last element? " + Arrays.toString(splittedString)); - - if (lastSplit.charAt(lastSplit.length() - 1) != string.charAt(string.length() - 1)) { - String[] concatenatedString = Arrays.copyOf(splittedString, splittedString.length + 1); - concatenatedString[splittedString.length] = ""; - return concatenatedString; - } - - } - - return splittedString; - } - - // ================================================================================// - // ExprOp // - // ================================================================================// - public StringBuilder getJavascriptString(ExprOp op, int depth) { - - if (op.name.equals("ArrowFN")) { - final StringBuilder ret = generateArrowFunctionExpression(op, depth); - return ret; - } - - StringBuilder exprString = getJavascriptString(op.exprs.get(0), 0); - if (op.name.equals("COND")) { - // Condition - final StringBuilder cond = new StringBuilder(LaraIUtils.getSpace(depth)); - cond.append("("); - cond.append(exprString); - cond.append(")?("); - // True - - cond.append(getJavascriptString(op.exprs.get(1), 0)); - cond.append("):("); - // False - cond.append(getJavascriptString(op.exprs.get(2), 0)); - cond.append(")"); - return cond; - } - if (op.name.equals("NEW")) { - final StringBuilder newOp = new StringBuilder(LaraIUtils.getSpace(depth)); - newInstance = true; - newOp.append(getJavascriptString(op.exprs.get(0), depth)); - // newOp.deleteCharAt(0); - // newOp.deleteCharAt(newOp.length()-1); - return newOp; - } - - if (op.exprs.size() == 1) { - final StringBuilder inc = new StringBuilder(LaraIUtils.getSpace(depth)); - if (op.name.equals("INCS")) { - inc.append(exprString); - inc.append("++"); - return inc; - } - if (op.name.equals("DECS")) { - inc.append(exprString); - inc.append("--"); - return inc; - } - // INCP and DECP are in this "else" - inc.append(Operators.getOpString(op.name)); - inc.append("(" + exprString + ")"); - return inc; - } - - final StringBuilder left = exprString; - // if (isFilter && (op.exprs.get(0) instanceof ExprId)) - // left.append("()"); - StringBuilder right = getJavascriptString(op.exprs.get(1), 0); - - if (op.name.equals("ASSIGN")) { - if (left.indexOf("(" + Interpreter.ATTRIBUTES + ".") == 0) { - return getAttributesMerge(op.exprs.get(0), right, depth); - } - } - - if (op.name.equals("MATCH")) { - final StringBuilder match = new StringBuilder(LaraIUtils.getSpace(depth) + "String("); - match.append(left); - match.append(").match(new RegExp("); - match.append(right); - match.append(")) != null"); - return match; - } - if (op.name.equals("FN")) { - final StringBuilder ret = generateFunctionExpression(op, depth); - return ret; - } - - if (op.name.equals("GFN")) { - final StringBuilder ret = generateFunctionExpression(op, depth, true); - return ret; - } - - if (op.name.equals("COMMA")) { // this type of expression is always binary, even if multiple commas are used - final StringBuilder commaExpr = new StringBuilder(LaraIUtils.getSpace(depth) + "("); - commaExpr.append(left); - commaExpr.append(","); - commaExpr.append(right); - commaExpr.append(")"); - return commaExpr; - } - final String operator = Operators.getOpString(op.name); - final StringBuilder opBuff = new StringBuilder("(" + LaraIUtils.getSpace(depth)); - opBuff.append(left); - opBuff.append(")" + operator + "("); - opBuff.append(right); - opBuff.append(")"); - for (int i = 2; i < op.exprs.size(); i++) { - right = getJavascriptString(op.exprs.get(i), 0); - opBuff.append(operator + "("); - opBuff.append(right); - opBuff.append(")"); - } - return opBuff; - - } - - /** - * Generate a function expression with the given expression element - * - * @param depth - * - * @param op - * the FN element containing the function expression - * @return - */ - private StringBuilder generateFunctionExpression(ExprOp fnOp, int depth) { - return generateFunctionExpression(fnOp, depth, false); - } - - private StringBuilder generateArrowFunctionExpression(ExprOp fnOp, int depth) { - final List exprs = fnOp.exprs; - - // System.out.println("ARROW EXPRS: " + fnOp.exprs.size()); - - // Last element is the body of the function, remaining elements are the arguments - List args = exprs.subList(0, exprs.size() - 1); - Expression body = exprs.get(exprs.size() - 1); - - final StringBuilder ret = new StringBuilder(); - - if (args.size() != 1) { - ret.append("("); - } - - String argsString = args.stream().map(arg -> getJavascriptString(arg, -1)) - .collect(Collectors.joining(", ")); - ret.append(argsString); - - if (args.size() != 1) { - ret.append(")"); - } - - ret.append(" => "); - - // What does this do? - if (oldDepth != 0) { - depth = oldDepth; - } - - final StringBuilder funcBody = getJavascriptString(body, -depth); - - // ret.append(funcBody.subSequence(0, funcBody.length() - 1)); - ret.append(funcBody.toString().strip()); - - // System.out.println("RET: " + ret); - - return ret; - } - - private StringBuilder generateFunctionExpression(ExprOp fnOp, int depth, boolean isGenerator) { - final List exprs = fnOp.exprs; - final StringBuilder ret = new StringBuilder("function"); - if (isGenerator) { - ret.append("*"); - } - ret.append(" "); - - final StringBuilder funcName = getJavascriptString(exprs.get(0), -1); // can be empty name - ret.append(funcName); - ret.append("("); - - if (exprs.size() > 2) { - StringBuilder argName = getJavascriptString(exprs.get(1), -1); - ret.append(argName); - for (int pos = 2; pos < exprs.size() - 1; pos++) { - argName = getJavascriptString(exprs.get(pos), -1); - ret.append(","); - ret.append(argName); - } - } - ret.append(")"); - if (oldDepth != 0) { - depth = oldDepth; - } - final StringBuilder funcBody = getJavascriptString(exprs.get(exprs.size() - 1), -depth); - ret.append(funcBody.subSequence(0, funcBody.length() - 1)); - return ret; - } - - private StringBuilder getAttributesMerge(Expression expression, StringBuilder right, int depth) { - final StringBuilder merging = new StringBuilder( - LaraIUtils.getSpace(depth) + Interpreter.ATTRIBUTES + ".set( {" + getAMObject(expression)); - amBrackets++; - merging.append(right); - merging.append(" "); - while (amBrackets > 0) { - merging.append("}"); - amBrackets--; - } - merging.append(")"); - return merging; - } - - private int amBrackets = 0; - - private StringBuilder getAMObject(Expression exp) { - - if (exp instanceof ExprId) { - return new StringBuilder(((ExprId) exp).name.substring(1) + ": "); - } - if (exp instanceof ExprLiteral) { - return new StringBuilder("" + ((ExprLiteral) exp).value + ": "); - } - if (exp.xmltag.equals("property")) { - final StringBuilder obj = getAMObject(exp.exprs.get(0)); - obj.append("{ "); - obj.append(getAMObject(exp.exprs.get(1))); - amBrackets++; - return obj; - } - return null; - } - - // ================================================================================// - // =================================== ExprKey ====================================// - // ================================================================================// - public StringBuilder getJavascriptString(ExprKey prop, int depth) { - final StringBuilder ret = new StringBuilder(LaraIUtils.getSpace(depth)); - ret.append(getJavascriptString(prop.exprs.get(0), 0)); - if (prop.exprs.size() > 1) { - ret.append("["); - ret.append(getJavascriptString(prop.exprs.get(1), 0)); - ret.append("]"); - return ret; - } - return ret; - } - - private Statement currentStatement; - - // ================================================================================// - // ================================== Statement ===================================// - // ================================================================================// - public StringBuilder getJavascriptString(Statement stat, int depth) { - currentStatement = stat; - return processStatement(stat, "var ", depth, ";\n"); - } - - public StringBuilder processStatement(Statement stat, String varStr, int depth, String sufix) { - - return statementProcessor.processStatement(stat, varStr, depth, sufix); - } - - private int oldDepth; - - // ================================================================================// - // IElement // - // ================================================================================// - // private IElement lastIElement = null; - public StringBuilder getJavascriptString(IElement el, int depth) { - if (el instanceof Expression) { - return getJavascriptString((Expression) el, depth); - } - if (el instanceof Statement) { - return getJavascriptString((Statement) el, depth); - } - if (el instanceof Parameter) { - return getJavascriptString((Parameter) el, depth); - } - if (el instanceof ParameterList) { - return getJavascriptString((ParameterList) el, depth); - } - if (el instanceof ParameterSection) { - return getJavascriptString(el, depth); - } - if (el instanceof Argument) { - return getJavascriptString((Argument) el, depth); - } - if (el instanceof Aspect) { - return getJavascriptString(el, depth); - } - if (el instanceof Aspects) { - return getJavascriptString(el, depth); - } - if (el instanceof Code) { - return getJavascriptString((Code) el, depth); - } - if (el instanceof ExprBody) { - return getJavascriptString((ExprBody) el, depth); - } - - throw new LaraIException( - "Interpreter.getJavaScriptString(" + el.getClass().getSimpleName() + ",int): not implemented!"); - - } - - public String getCurrentAspect() { - return aspectProcessor.getCurrentAspect(); - } - - public boolean hasEvents() { - return laraInterp.getWeaver().eventTrigger().hasListeners(); - } - - public List getActions() { - return laraInterp.getWeaver().getActions(); - } - - public Output out() { - return out; - } - - public LaraI getLaraI() { - return laraInterp; - } - - public LaraIDataStore getOptions() { - return options; - } - - /** - * Sets the specified value with the specified key in the ENGINE_SCOPE Bindings of the protected context field. - * - * @param key - * @param value - */ - public void put(String key, Object value) { - // Get function - // var setterFunction = engine.eval("setGlobalThis"); - // var setterFunction = engine.eval("function setGlobalThis(key, value) {\n" - // + " globalThis[key] = value;\n" - // + "}\n" - // + "setGlobalThis;"); - // - // engine.call(setterFunction, key, value); - // System.out.println("STREAM: " + value); - engine.put(key, value); - - } - - public WeaverStatementProcessor getWeaverStmtProcessor() { - return wStmtProcessor; - } - - public int getOldDepth() { - return oldDepth; - } - - public void setOldDepth(int oldDepth) { - this.oldDepth = oldDepth; - } - - public boolean useBrackets() { - return brackets; - } - - public void setBrackets(boolean brackets) { - this.brackets = brackets; - } - - public ImportProcessor getImportProcessor() { - - return importProcessor; - } - - public CallStackTrace getStackStrace() { - return stackStrace; - } - -} diff --git a/LARAI/src/org/lara/interpreter/cli/CLIConfigOption.java b/LARAI/src/org/lara/interpreter/cli/CLIConfigOption.java index d6640a6db..f1494ffee 100644 --- a/LARAI/src/org/lara/interpreter/cli/CLIConfigOption.java +++ b/LARAI/src/org/lara/interpreter/cli/CLIConfigOption.java @@ -18,10 +18,8 @@ public enum CLIConfigOption { - config("c", OptionArguments.ONE_ARG, "file", "configuration file with defined options"), - gui("g", "open in GUI mode"); + config("c", OptionArguments.ONE_ARG, "file", "configuration file with defined options"); - public static boolean ALLOW_GUI = true; private String shortOpt; private String description; private OptionArguments args; diff --git a/LARAI/src/org/lara/interpreter/cli/CLIOption.java b/LARAI/src/org/lara/interpreter/cli/CLIOption.java index b0086c680..9149b7980 100644 --- a/LARAI/src/org/lara/interpreter/cli/CLIOption.java +++ b/LARAI/src/org/lara/interpreter/cli/CLIOption.java @@ -25,56 +25,26 @@ public enum CLIOption implements WeaverOption { help("h", "print this message", LaraiKeys.SHOW_HELP), version("v", "print version information and exit", null), - javascript("j", "show the javascript output in the same stream as the application's output", - LaraiKeys.LOG_JS_OUTPUT), debug("d", "show all process information", LaraiKeys.DEBUG_MODE), - stack("s", "show detailed call stack trace instead of LARAI trace", LaraiKeys.TRACE_MODE), argv("av", OptionArguments.ONE_ARG, "arguments", "arguments for the main aspect. Supports passing a .properties file with the arguments", LaraiKeys.ASPECT_ARGS), - // argw("aw", OptionArguments.SEVERAL_ARGS, "arguments", "arguments for the weaver", LaraiKeys.WEAVER_ARGS), output("o", OptionArguments.ONE_ARG, "dir", "change output dir", LaraiKeys.OUTPUT_FOLDER), workspace("p", OptionArguments.ONE_ARG, "dir", "change the working directory", LaraiKeys.WORKSPACE_FOLDER), - workspace_extra("pe", OptionArguments.ONE_ARG, "sources", "extra sources", LaraiKeys.WORKSPACE_EXTRA), - verbose("b", OptionArguments.ONE_ARG, "level", "verbose level", LaraiKeys.VERBOSE), - main("m", OptionArguments.ONE_ARG, "aspect", "select main aspect", LaraiKeys.MAIN_ASPECT), - tools("t", OptionArguments.ONE_ARG, "tools.xml", "location of the tools description", LaraiKeys.TOOLS_FILE), log("l", OptionArguments.OPTIONAL_ARG, "fileName", "outputs to a log file. If file ends in .zip, compresses the file", LaraiKeys.LOG_FILE), - includes("i", OptionArguments.ONE_ARG, "dir", - "includes folder (imports files with extensions: lara, jar, js, class)", LaraiKeys.INCLUDES_FOLDER), - autoimport("ai", OptionArguments.NO_ARGS, LaraiKeys.AUTOMATICALLY_IMPORT_JS), - dependencies("dep", OptionArguments.ONE_ARG, "urls", - "external dependencies (URLs, git repos)", LaraiKeys.EXTERNAL_DEPENDENCIES), - report("r", OptionArguments.ONE_ARG, "file_name.json", "Output file for the main aspect, in JSON format", - LaraiKeys.REPORT_FILE), - metrics("e", OptionArguments.ONE_ARG, "file_name.json", "Output file for the weaving metrics", - LaraiKeys.METRICS_FILE), - loc("lc", OptionArguments.NO_ARGS, "loc", "LARA CSV with stats (LoC, #aspects, etc)", - LaraiKeys.LARA_LOC), - bundle_tags("bt", OptionArguments.ONE_ARG, "bundle tags", - "Bundle tags, in the following format: =[,=]*", - LaraiKeys.BUNDLE_TAGS), - restrict("rm", OptionArguments.NO_ARGS, "restrict", "Restrict mode (some Java classes are not allowed)", - LaraiKeys.RESTRICT_MODE), - call("ca", OptionArguments.ONE_ARG, "call args", LaraiKeys.CALL_ARGS.getLabel(), LaraiKeys.CALL_ARGS), - jsengine("js", OptionArguments.ONE_ARG, "engine name", - "JS Engine to use. Available: NASHORN, GRAALVM_COMPAT, GRAALVM", LaraiKeys.JS_ENGINE), - - jarpaths("jp", OptionArguments.ONE_ARG, "dir1/file1[;dir2/file2]*", "JAR files that will be added to a separate classpath and will be accessible in scripts", LaraiKeys.JAR_PATHS), - - - unit(LaraiKeys.getUnitTestFlag(), "run in unit test mode", LaraiKeys.UNIT_TEST_MODE), - doc(LaraiKeys.getDocGeneratorFlag(), "generate documentation mode", LaraiKeys.GENERATE_DOCUMENTATION); - // weaver("w"), //I'm forcing these two arguments to be passed as java arguments in LARAI.exec - // XMLspec("x"), + + jarpaths("jp", OptionArguments.ONE_ARG, "dir1/file1[;dir2/file2]*", + "JAR files that will be added to a separate classpath and will be accessible in scripts", + LaraiKeys.JAR_PATHS); private String shortArgument; private String description; private OptionArguments hasArgs; - // TODO: This argName seems to not be actually used, consider removing it. All constructors receive a DataKey, and should use its name + // TODO: This argName seems to not be actually used, consider removing it. All + // constructors receive a DataKey, and should use its name private String argName; private DataKey dataKey; diff --git a/LARAI/src/org/lara/interpreter/cli/JOptionsInterface.java b/LARAI/src/org/lara/interpreter/cli/JOptionsInterface.java index 4decbeaaa..273ad58f3 100644 --- a/LARAI/src/org/lara/interpreter/cli/JOptionsInterface.java +++ b/LARAI/src/org/lara/interpreter/cli/JOptionsInterface.java @@ -14,14 +14,12 @@ package org.lara.interpreter.cli; import org.lara.interpreter.joptions.config.interpreter.LaraiKeys; -import org.lara.interpreter.joptions.config.interpreter.VerboseLevel; import org.lara.interpreter.utils.LaraIUtils; import org.lara.interpreter.weaver.options.WeaverOption; import org.suikasoft.jOptions.Datakey.DataKey; import org.suikasoft.jOptions.Interfaces.DataStore; import pt.up.fe.specs.util.SpecsEnums; import pt.up.fe.specs.util.SpecsLogs; -import utils.LARASystem; import java.util.EnumSet; import java.util.HashMap; @@ -30,40 +28,18 @@ public class JOptionsInterface { + private static final String LARAPATH = "$LARAI"; + private static final Map> CONVERSION_MAP; static { CONVERSION_MAP = new HashMap<>(); - JOptionsInterface.CONVERSION_MAP.put(CLIOption.main, LaraiKeys.MAIN_ASPECT); JOptionsInterface.CONVERSION_MAP.put(CLIOption.argv, LaraiKeys.ASPECT_ARGS); - // JOptionsInterface.CONVERSION_MAP.put(CLIOption.argw, LaraiKeys.WEAVER_ARGS); JOptionsInterface.CONVERSION_MAP.put(CLIOption.workspace, LaraiKeys.WORKSPACE_FOLDER); - JOptionsInterface.CONVERSION_MAP.put(CLIOption.workspace_extra, LaraiKeys.WORKSPACE_EXTRA); JOptionsInterface.CONVERSION_MAP.put(CLIOption.output, LaraiKeys.OUTPUT_FOLDER); JOptionsInterface.CONVERSION_MAP.put(CLIOption.debug, LaraiKeys.DEBUG_MODE); - JOptionsInterface.CONVERSION_MAP.put(CLIOption.stack, LaraiKeys.TRACE_MODE); JOptionsInterface.CONVERSION_MAP.put(CLIOption.log, LaraiKeys.LOG_FILE); - JOptionsInterface.CONVERSION_MAP.put(CLIOption.javascript, LaraiKeys.LOG_JS_OUTPUT); - JOptionsInterface.CONVERSION_MAP.put(CLIOption.includes, LaraiKeys.INCLUDES_FOLDER); - JOptionsInterface.CONVERSION_MAP.put(CLIOption.autoimport, LaraiKeys.AUTOMATICALLY_IMPORT_JS); - JOptionsInterface.CONVERSION_MAP.put(CLIOption.dependencies, LaraiKeys.EXTERNAL_DEPENDENCIES); - JOptionsInterface.CONVERSION_MAP.put(CLIOption.report, LaraiKeys.REPORT_FILE); - JOptionsInterface.CONVERSION_MAP.put(CLIOption.metrics, LaraiKeys.METRICS_FILE); - JOptionsInterface.CONVERSION_MAP.put(CLIOption.loc, LaraiKeys.LARA_LOC); - JOptionsInterface.CONVERSION_MAP.put(CLIOption.bundle_tags, LaraiKeys.BUNDLE_TAGS); - JOptionsInterface.CONVERSION_MAP.put(CLIOption.tools, LaraiKeys.TOOLS_FILE); - JOptionsInterface.CONVERSION_MAP.put(CLIOption.restrict, LaraiKeys.RESTRICT_MODE); - // Setting custom decoder because Properties use numbers instead of names for the verbose level - JOptionsInterface.CONVERSION_MAP.put(CLIOption.verbose, - LaraiKeys.VERBOSE.setDecoder(s -> VerboseLevel.values()[Integer.parseInt(s)])); - JOptionsInterface.CONVERSION_MAP.put(CLIOption.call, LaraiKeys.CALL_ARGS); - JOptionsInterface.CONVERSION_MAP.put(CLIOption.jsengine, LaraiKeys.JS_ENGINE); JOptionsInterface.CONVERSION_MAP.put(CLIOption.jarpaths, LaraiKeys.JAR_PATHS); - - - JOptionsInterface.CONVERSION_MAP.put(CLIOption.unit, LaraiKeys.UNIT_TEST_MODE); - JOptionsInterface.CONVERSION_MAP.put(CLIOption.doc, LaraiKeys.GENERATE_DOCUMENTATION); - JOptionsInterface.CONVERSION_MAP.put(CLIOption.help, LaraiKeys.SHOW_HELP); } @@ -95,7 +71,7 @@ public static DataStore getDataStore(String name, Properties properties) { } String property = properties.getProperty(key.toString()); - property.replace(LARASystem.LARAPATH, LaraIUtils.getJarFoldername()); + property.replace(LARAPATH, LaraIUtils.getJarFoldername()); data.setString(datakey, property); } diff --git a/LARAI/src/org/lara/interpreter/cli/LaraCli.java b/LARAI/src/org/lara/interpreter/cli/LaraCli.java deleted file mode 100644 index 708e3b281..000000000 --- a/LARAI/src/org/lara/interpreter/cli/LaraCli.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright 2018 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.cli; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.apache.commons.cli.Option; -import org.apache.commons.cli.Options; -import org.lara.interpreter.weaver.interf.WeaverEngine; -import org.lara.interpreter.weaver.options.WeaverOption; -import org.lara.interpreter.weaver.options.WeaverOptions; - -public class LaraCli { - - /** - * Builds the list of command-line interface options available to the given weaver. - * - *

- * This is a super-set of getWeaverOptions(), which includes launch-specific flags, and returns an instance of the - * Apache Commons CLI package. - * - * @param weaverEngine - * @return - */ - public static Options getCliOptions(WeaverEngine weaverEngine) { - Collection

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.generator.stmt; - -import larai.LaraI; -import org.lara.interpreter.Interpreter; -import org.lara.interpreter.api.LaraIo; -import org.lara.interpreter.exception.AspectDefException; -import org.lara.interpreter.exception.JavaImportException; -import org.lara.interpreter.exception.ScriptImportException; -import org.lara.interpreter.exception.UserException; -import org.lara.interpreter.joptions.keys.FileList; -import org.lara.interpreter.utils.ExceptionUtils; -import org.lara.interpreter.utils.LaraIUtils; -import org.lara.interpreter.utils.MessageConstants; -import org.lara.interpreter.utils.WeaverSpecification; -import org.lara.interpreter.weaver.LaraExtension; -import org.lara.interpreter.weaver.MasterWeaver; -import org.lara.interpreter.weaver.interf.JoinPoint; -import org.lara.interpreter.weaver.interf.WeaverEngine; -import org.lara.interpreter.weaver.interf.events.Stage; -import org.lara.interpreter.weaver.utils.FilterExpression; -import org.lara.language.specification.dsl.LanguageSpecification; -import pt.up.fe.specs.jsengine.JsFileType; -import pt.up.fe.specs.tools.lara.logging.LaraLog; -import pt.up.fe.specs.tools.lara.trace.CallStackTrace; -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.SpecsLogs; -import pt.up.fe.specs.util.SpecsSystem; -import pt.up.fe.specs.util.providers.ResourceProvider; -import utils.LARASystem; - -import java.io.File; -import java.lang.reflect.Method; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public class ImportProcessor { - - private static final Class[] CLASSES_TO_IMPORT = {LARASystem.class, Stage.class, AspectDefException.class, - ExceptionUtils.class, UserException.class, FilterExpression.class, JoinPoint.class, LaraIo.class}; - - private final Interpreter interpreter; - private final Set loadedSources; - - public static ImportProcessor newInstance(Interpreter interpreter) { - return new ImportProcessor(interpreter); - } - - private ImportProcessor(Interpreter interpreter) { - this.interpreter = interpreter; - this.loadedSources = new HashSet<>(); - } - - /** - * Import the scripts and classes in the jar and the included folders - * - * @param laraInt - * @param cx - * @param scope - */ - public void importScriptsAndClasses() { - interpreter.out().println("Importing internal scripts:"); - - /* Load weaver API scripts */ - LaraI laraI = interpreter.getLaraI(); - MasterWeaver weaver = laraI.getWeaver(); - WeaverEngine engine = weaver.getEngine(); - - // Import all scripts in the new 'core' folder as modules (.mjs) - var newFilesToImport = engine.getApiManager().getNpmCoreFiles(); - newFilesToImport.stream().filter(file -> LaraExtension.isValidExtension(file)) - .forEach(source -> evaluateImport(SpecsIo.read(source), source.getAbsolutePath(), false, - JsFileType.MODULE)); - - // Import all scripts in the old 'core' folder - var oldFilesToImport = SpecsIo.getFilesRecursive(engine.getApiManager().getCoreFolder()); - oldFilesToImport.stream().filter(file -> LaraExtension.isValidExtension(file)) - .forEach(this::importScript); - - /* Load user scripts */ - FileList includeFolders = interpreter.getOptions().getProcessedIncludeDirs(engine); - - if (!includeFolders.isEmpty()) { - - interpreter.out().println("Importing scripts/classes in included folders:"); - - // Also include java and javascript files which respect the - // following structure inside the include folders: - // /java - // /scripts - for (final File includeFolder : includeFolders) { - - if (!includeFolder.exists()) { - interpreter.out().warnln("Included folder '" + includeFolder + "' does not exist."); - continue; - } - - // Get JAVA files from "java" folder - final File javaPath = new File(includeFolder, "java"); - // Get JS files from "scripts" folder - final File scriptsPath = new File(includeFolder, "scripts"); - - // Add scripts that are directly included in the 'includeFolders' - final List allJava = getAllJavaClassPaths(includeFolder); // right now it is just using jars - final List allScripts = new ArrayList<>(); - - var importScripts = interpreter.getOptions().isAutomaticallyIncludeJs(); - - if (importScripts) { - allScripts.addAll(SpecsIo.getFiles(includeFolder, "js"));// getAllScriptFiles(includeFolder); - allScripts.addAll(SpecsIo.getFiles(includeFolder, "mjs")); - } - - if (javaPath.exists()) { - final List javaFolderFiles = getAllJavaClassPaths(javaPath); - allJava.addAll(javaFolderFiles); - } - if (scriptsPath.exists()) { - final List scriptFolderFiles = getAllScriptFiles(scriptsPath); - allScripts.addAll(scriptFolderFiles); - } - // Add JAVA files - importClassPaths(allJava); - - // Add JS files - allScripts.forEach(this::importScript); - - } - } - - } - - /** - * - */ - public void importAndInitialize() { - - for (Class importingClass : CLASSES_TO_IMPORT) { - importClassWithSimpleName(importingClass); - } - - final File jarDir = new File(LaraIUtils.getJarFoldername()); - final String laraPath = "var " + LARASystem.LARAPATH + " = '" + jarDir.getAbsolutePath().replace('\\', '/') - + "';\n"; - final String attribute = "var " + Interpreter.ATTRIBUTES - + " = { set: function(newReport){ mergeObjects(this,newReport);}};\n"; - interpreter.evaluate(laraPath, "import_and_initialize"); - interpreter.evaluate(attribute, "import_and_initialize"); - LaraI laraI = interpreter.getLaraI(); - - if (laraI.getOptions().useStackTrace()) { - interpreter.put(CallStackTrace.STACKTRACE_NAME, interpreter.getStackStrace()); - } - interpreter.put(MasterWeaver.WEAVER_NAME, laraI.getWeaver()); - interpreter.put(LARASystem.LARA_SYSTEM_NAME, new LARASystem(laraI)); - WeaverEngine engine = laraI.getWeaver().getEngine(); - LanguageSpecification ls = engine.getLanguageSpecificationV2(); - interpreter.put(MasterWeaver.LANGUAGE_SPECIFICATION_NAME, - WeaverSpecification.newInstance(ls, engine.getScriptEngine())); - } - - /** - * Import a class in the interpreter and associate the simple name to the class - * - * @param classToImport - */ - public void importClassWithSimpleName(Class classToImport) { - // importClass(classToImport); - try { - String code = "var " + classToImport.getSimpleName() + " = Java.type('" + classToImport.getCanonicalName() - + "');\n"; - interpreter.evaluate(code, "import_class_" + classToImport.getSimpleName()); - } catch (Exception e) { - throw new JavaImportException(new File(classToImport.getCanonicalName()), e); - } - } - - /** - * This method returns all classpaths to use in LARA This includes the current folder and all the jars in this - * folder - * - * @param folder - * @return - */ - private List getAllJavaClassPaths(File folder) { - final ArrayList files = new ArrayList<>(); - // final File dir = new File(path); - if (!folder.isDirectory()) { - interpreter.out().warnln("The path for the includes is invalid: " + folder); - return files; - } - files.add(folder); - for (final File f : folder.listFiles()) { - if (f.isFile() && f.getName().endsWith(".jar") || f.getName().endsWith(".class")) { - files.add(f); - } - } - return files; - } - - // ================================================================================// - // Utilities // - // ================================================================================// - public static List getAllScriptFiles(File dir) { - final ArrayList files = new ArrayList<>(); - - if (!dir.isDirectory()) { - return files; - } - for (final File f : dir.listFiles()) { - if (f.isFile() && f.getName().endsWith(".js")) { - files.add(f); - } - } - return files; - } - - private void importClassPaths(final List jarFolderFiles) { - // Check if Java 9 or greater - if (SpecsSystem.getJavaVersionNumber() > 1.8) { - SpecsLogs.debug("Importing classes dynamically not supported for Java 9 or greater"); - return; - } - - URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader(); - - Class sysclass = URLClassLoader.class; - - for (final File classPath : jarFolderFiles) { - interpreter.out().println(" " + MessageConstants.BRANCH_STR + SpecsIo.getCanonicalPath(classPath)); - - try { - Method method = sysclass.getDeclaredMethod("addURL", URL.class); - method.setAccessible(true); - method.invoke(sysloader, new Object[]{classPath.toURI().toURL()}); - } catch (Throwable t) { - throw new JavaImportException(classPath, t); - } - } - } // end method - - private void importScript(ResourceProvider resource) { - final String internalScripts = SpecsIo.getResource(resource); - var extension = SpecsIo.getExtension(resource.getFilename()); - evaluateImport(internalScripts, resource.getResource(), true, JsFileType.getType(extension)); - } - - private void importScript(File source) { - final String internalScripts = SpecsIo.read(source); - var extension = SpecsIo.getExtension(source); - evaluateImport(internalScripts, source.getAbsolutePath(), false, JsFileType.getType(extension)); - } - - private void evaluateImport(final String internalScripts, String source, boolean isInternal, JsFileType type) { - try { - - // Check if source was already loaded - if (loadedSources.contains(source)) { - LaraLog.debug("ImportProcessor: ignoring already loaded source '" + source + "'"); - return; - } - - interpreter.out().println(" " + MessageConstants.BRANCH_STR + source); - interpreter.evaluate(internalScripts, type, source); - - // Add source to loaded sources - loadedSources.add(source); - - } catch (Exception e) { - throw new ScriptImportException(source, isInternal, e); - } - } - -} diff --git a/LARAI/src/org/lara/interpreter/generator/stmt/StatementProcessor.java b/LARAI/src/org/lara/interpreter/generator/stmt/StatementProcessor.java deleted file mode 100644 index 47045a6a1..000000000 --- a/LARAI/src/org/lara/interpreter/generator/stmt/StatementProcessor.java +++ /dev/null @@ -1,376 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.generator.stmt; - -import org.lara.interpreter.Interpreter; -import org.lara.interpreter.utils.Coordinates; -import org.lara.interpreter.utils.LaraIUtils; -import org.lara.interpreter.utils.LaraIUtils.Statements; - -import larac.objects.Enums.LoopTypes; -import pt.up.fe.specs.jsengine.ForOfType; -import pt.up.fe.specs.lara.aspectir.Code; -import pt.up.fe.specs.lara.aspectir.CodeElem; -import pt.up.fe.specs.lara.aspectir.ExprOp; -import pt.up.fe.specs.lara.aspectir.Expression; -import pt.up.fe.specs.lara.aspectir.Statement; - -public class StatementProcessor { - private static final String CARDINAL = "__CARDINAL__"; - - private final Interpreter interpreter; - private final StringBuilder afterCall = new StringBuilder(); - - public static StatementProcessor newInstance(Interpreter interpreter) { - return new StatementProcessor(interpreter); - } - - private StatementProcessor(Interpreter interpreter) { - this.interpreter = interpreter; - } - - public StringBuilder processStatement(Statement stat, String prefix, int depth, String sufix) { - final StringBuilder ret = new StringBuilder(); - LaraIUtils.appendComment(stat, ret); - - // Add label, if present - if (stat.label != null) { - ret.append(stat.label).append(": "); - } - - switch (Statements.valueOf(stat.name.toUpperCase())) { - case SELECT: - interpreter.getWeaverStmtProcessor().processSelect(stat, depth, ret); - break; - case APPLY: - interpreter.getWeaverStmtProcessor().processApply(stat, depth, ret); - break; - case VARDECL: - declareVariables(stat, prefix, depth, sufix, ret); - break; - case FNDECL: - functionDeclaration(stat, depth, sufix, ret); - break; - case GFNDECL: - functionDeclaration(stat, depth, sufix, ret, true); - break; - case RETURN: - case EXIT: - returnStmt(stat, depth, sufix, ret); - break; - case YIELD: - yieldStmt(stat, depth, sufix, ret); - break; - case YIELD_STAR: - yieldStmt(stat, depth, sufix, ret, true); - break; - case EXPR: - exprStmt(stat, depth, sufix, ret); - break; - case LOOP: - loopStmt(stat, depth, sufix, ret); - break; - case IF: - ifStmt(stat, depth, ret); - break; - case TRY: - tryStmt(stat, depth, ret); - break; - case WITH: - withStmt(stat, depth, ret); - break; - case SWITCH: - switchStmt(stat, depth, ret); - break; - case BLOCK: - blockStmt(stat, depth, ret); - break; - case BREAK: - case CONTINUE: - jumpStmt(stat, depth, sufix, ret); - break; - case THROW: - throwStmt(stat, depth, sufix, ret); - break; - case SCRIPTIMPORT: - scriptImportStmt(stat, ret); - break; - case JSIMPORT: - jsImportStmt(stat, ret); - break; - case LARAIMPORT: - laraImportStmt(stat, ret); - break; - default: - ret.append(LaraIUtils.getSpace(depth) + "throw 'Aspect-IR statement type " + stat.name - + " is not implemented. Please contact the developers for further information.'" + sufix); - } - return ret; - } - - private void scriptImportStmt(Statement stat, StringBuilder ret) { - ret.append(stat.desc); - } - - private void jsImportStmt(Statement stat, StringBuilder ret) { - ret.append("import '" + stat.desc + "';\n"); - } - - private void laraImportStmt(Statement stat, StringBuilder ret) { - ret.append(stat.desc + ";\n"); - } - - private void throwStmt(Statement stat, int depth, String sufix, final StringBuilder ret) { - ret.append(LaraIUtils.getSpace(depth) + "throw "); - int line = (new Coordinates(stat.coord)).getLineBegin(); - ret.append("new UserException("); - ret.append(interpreter.getJavascriptString(stat.components.get(0), 0)); - ret.append("," + line + ")"); - ret.append(sufix); - } - - private void jumpStmt(Statement stat, int depth, String sufix, final StringBuilder ret) { - ret.append(LaraIUtils.getSpace(depth) + stat.name.toLowerCase()); - final Expression exprJumpLabel = (Expression) stat.components.get(0); - if (!exprJumpLabel.exprs.isEmpty()) { - - String label = interpreter.getJavascriptString(exprJumpLabel.exprs.get(0), 0).toString(); - label = label.replace("#", CARDINAL); - ret.append(" " + label); - } - ret.append(sufix); - } - - private void blockStmt(Statement stat, int depth, final StringBuilder ret) { - ret.append(interpreter.getJavascriptString(stat.components.get(0), depth)); - } - - private void switchStmt(Statement stat, int depth, final StringBuilder ret) { - ret.append(LaraIUtils.getSpace(depth) + "switch("); - ret.append(interpreter.getJavascriptString(stat.components.get(0), 0)); - ret.append("){\n"); - for (int i = 1; i < stat.components.size(); i++) { - final CodeElem elem = stat.components.get(i); - if (elem instanceof Code && elem.desc.equals("default")) { // default - ret.append(LaraIUtils.getSpace(depth + 1) + "default:"); - ret.append(interpreter.getJavascriptString(elem, -(depth + 1))); - } else { - ret.append(LaraIUtils.getSpace(depth + 1) + "case "); - ret.append(interpreter.getJavascriptString(elem, 0)); - ret.append(":"); - i++; - ret.append(interpreter.getJavascriptString(stat.components.get(i), -(depth + 1))); - } - } - ret.append(LaraIUtils.getSpace(depth) + "}\n"); - } - - private void withStmt(Statement stat, int depth, final StringBuilder ret) { - ret.append(LaraIUtils.getSpace(depth) + "with("); - ret.append(interpreter.getJavascriptString(stat.components.get(0), 0)); - ret.append(")"); - ret.append(interpreter.getJavascriptString(stat.components.get(1), -depth)); - } - - private void tryStmt(Statement stat, int depth, final StringBuilder ret) { - ret.append(LaraIUtils.getSpace(depth) + "try"); - ret.append(interpreter.getJavascriptString(stat.components.get(0), -depth)); - int pos = 1; - if (stat.components.get(1) instanceof Expression) { // Catch - ret.append(LaraIUtils.getSpace(depth) + "catch("); - ret.append(interpreter.getJavascriptString(stat.components.get(1), 0)); - ret.append(")"); - ret.append(interpreter.getJavascriptString(stat.components.get(2), -depth)); - pos = 3; - } - if (pos < stat.components.size()) { // finally - ret.append(LaraIUtils.getSpace(depth) + "finally"); - ret.append(interpreter.getJavascriptString(stat.components.get(pos), -depth)); - pos++; - } - } - - private void ifStmt(Statement stat, int depth, final StringBuilder ret) { - ret.append(LaraIUtils.getSpace(depth) + "if("); - ret.append(interpreter.getJavascriptString(stat.components.get(0), 0)); - ret.append(")"); // Condition - final Code then = (Code) stat.components.get(1); - final Code elseC = (Code) stat.components.get(2); - if (then.statements.isEmpty()) { - ret.append("\n" + LaraIUtils.getSpace(depth + 1) + ";\n"); // Then - } else { - ret.append(interpreter.getJavascriptString(then, -depth)); - } - if (!elseC.statements.isEmpty()) { - ret.append(LaraIUtils.getSpace(depth) + "else "); - ret.append(interpreter.getJavascriptString(elseC, -depth)); // Else - } - } - - private void loopStmt(Statement stat, int depth, String sufix, final StringBuilder ret) { - if (stat.components.get(0) instanceof Code) { // For|do-While - // statement - final Code c = (Code) stat.components.get(0); - if (c.desc.equals("init")) { // For [var|in] statement - ret.append(LaraIUtils.getSpace(depth) + "for "); - - if (interpreter.getEngine().getForOfType() == ForOfType.FOR_EACH) { - if (stat.desc != null && stat.desc.equals(LoopTypes.FOREACH.toString())) { - ret.append("each "); - } - } - - ret.append("("); - if (stat.components.get(1).desc.equals("container")) { // For - // in - // statement - ret.append("var "); - - final Expression leftExpr = (Expression) c.statements.get(0).components.get(0); - ret.append(interpreter.getJavascriptString(leftExpr, -1)); - - if (stat.desc.equals(LoopTypes.FOREACH.toString()) && - interpreter.getEngine().getForOfType() == ForOfType.NATIVE) { - ret.append(" of "); - } else { - ret.append(" in "); - } - - ret.append(interpreter.getJavascriptString(stat.components.get(1), 0)); - } else { // For [var] statement - if (!c.statements.isEmpty()) { - interpreter.setBrackets(false); - - if (c.statements.get(0).name.equals("vardecl")) { - ret.append("var "); - } - for (final Statement varStat : c.statements) { - ret.append(processStatement(varStat, "", 0, ", ")); - } - ret.delete(ret.length() - 2, ret.length()); - } - ret.append(";"); - ret.append(interpreter.getJavascriptString(stat.components.get(1), 0) + ";"); - ret.append(interpreter.getJavascriptString(stat.components.get(3), 0)); - - } - ret.append(")"); - interpreter.setBrackets(true); - ret.append(interpreter.getJavascriptString(stat.components.get(2), -depth)); - } else { // do-while statement - ret.append(LaraIUtils.getSpace(depth) + "do"); - ret.append(interpreter.getJavascriptString(stat.components.get(0), -depth)); // d - - if ('\n' == ret.charAt(ret.length() - 1)) {// equals(ret.charAt(ret.length() - 1))) { - ret.deleteCharAt(ret.length() - 1); - } - ret.append("while("); - ret.append(interpreter.getJavascriptString(stat.components.get(1), 0)); - ret.append(")" + sufix); // while - } - } else { // while statement - ret.append(LaraIUtils.getSpace(depth) + "while("); - ret.append(interpreter.getJavascriptString(stat.components.get(0), 0)); - ret.append(")"); // Condition - ret.append(interpreter.getJavascriptString(stat.components.get(1), -depth)); // do - } - } - - private void exprStmt(Statement stat, int depth, String sufix, final StringBuilder ret) { - ret.append(LaraIUtils.getSpace(depth)); - interpreter.setOldDepth(depth); - ret.append(interpreter.getJavascriptString(stat.components.get(0), 0)); - interpreter.setOldDepth(0); - ret.append(sufix); - - if (afterCall.length() != 0) { - interpreter.out().warnln("AFTER CALL: " + afterCall); - afterCall.delete(0, afterCall.length()); - } - } - - private void returnStmt(Statement stat, int depth, String sufix, final StringBuilder ret) { - StringBuilder value = new StringBuilder(); - if (!stat.components.isEmpty()) { - value = interpreter.getJavascriptString(stat.components.get(0), 0); - } - ret.append(LaraIUtils.getSpace(depth) + "return " + value + sufix); - } - - private void yieldStmt(Statement stat, int depth, String sufix, final StringBuilder ret) { - yieldStmt(stat, depth, sufix, ret, false); - } - - private void yieldStmt(Statement stat, int depth, String sufix, final StringBuilder ret, boolean hasStar) { - StringBuilder value = new StringBuilder(); - if (!stat.components.isEmpty()) { - value = interpreter.getJavascriptString(stat.components.get(0), 0); - } - ret.append(LaraIUtils.getSpace(depth) + "yield "); - if (hasStar) { - ret.append("* "); - } - ret.append(value + sufix); - } - - private void declareVariables(Statement stat, String prefix, int depth, String sufix, final StringBuilder ret) { - for (int i = 0; i < stat.components.size(); i += 2) { - final Expression leftExpr = (Expression) stat.components.get(i); - final Expression rightExpr = (Expression) stat.components.get(i + 1); // always has an expression, even if - // it is empty! - ret.append(LaraIUtils.getSpace(depth) + prefix - + interpreter.getJavascriptString(leftExpr, -1)); - ret.append(" = "); - if (rightExpr.exprs.isEmpty()) { - ret.append("undefined"); - } else { - interpreter.setOldDepth(depth); - } - ret.append(interpreter.getJavascriptString(rightExpr, 0)); - interpreter.setOldDepth(0); - ret.append(sufix); - } - } - - private void functionDeclaration(Statement stat, int depth, String sufix, final StringBuilder ret) { - functionDeclaration(stat, depth, sufix, ret, false); - } - - private void functionDeclaration(Statement stat, int depth, String sufix, final StringBuilder ret, - boolean isGenerator) { - - final Expression exp = (Expression) stat.components.get(0); - final ExprOp op = (ExprOp) exp.exprs.get(0); - // get functionName - String funcName = interpreter.getJavascriptString(op.exprs.get(0), 0).toString(); - funcName = funcName.replaceAll("'", ""); - // ret.append(LaraIUtils.getSpace(depth) + "function " + funcName + "("); - ret.append(LaraIUtils.getSpace(depth) + "function"); - if (isGenerator) { - ret.append("*"); - } - ret.append(" " + funcName + "("); - final StringBuilder args = new StringBuilder(); - for (int i = 1; i < op.exprs.size() - 1; i++) { - args.append( - interpreter.getJavascriptString(op.exprs.get(i), 0) + (i == op.exprs.size() - 2 ? "" : ",")); - } - ret.append(args.toString().replaceAll("'", "")); - ret.append(")"); - Expression body = op.exprs.get(op.exprs.size() - 1); - ret.append(interpreter.getJavascriptString(body, -depth)); // body - ret.append(sufix); - } - -} diff --git a/LARAI/src/org/lara/interpreter/generator/stmt/WeaverStatementProcessor.java b/LARAI/src/org/lara/interpreter/generator/stmt/WeaverStatementProcessor.java deleted file mode 100644 index 6c6a8e4fb..000000000 --- a/LARAI/src/org/lara/interpreter/generator/stmt/WeaverStatementProcessor.java +++ /dev/null @@ -1,493 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.generator.stmt; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.dojo.jsl.parser.ast.utils.LARACConstantPool; -import org.lara.interpreter.Interpreter; -import org.lara.interpreter.generator.js.ExpressionProcessor; -import org.lara.interpreter.utils.Coordinates; -import org.lara.interpreter.utils.LaraIUtils; -import org.lara.interpreter.utils.LaraIUtils.Operators; -import org.lara.interpreter.utils.SelectUtils; -import org.lara.interpreter.weaver.JoinpointUtils; -import org.lara.interpreter.weaver.MasterWeaver; -import org.lara.interpreter.weaver.events.EventTriggerGenerator; -import org.lara.interpreter.weaver.interf.events.Stage; -import org.lara.interpreter.weaver.joinpoint.LaraJoinPoint; - -import larac.objects.Enums; -import larac.objects.Enums.JoinOperator; -import larai.LaraI; -import pt.up.fe.specs.lara.aspectir.Code; -import pt.up.fe.specs.lara.aspectir.CodeElem; -import pt.up.fe.specs.lara.aspectir.ExprId; -import pt.up.fe.specs.lara.aspectir.ExprOp; -import pt.up.fe.specs.lara.aspectir.Expression; -import pt.up.fe.specs.lara.aspectir.Statement; -import pt.up.fe.specs.util.exceptions.NotImplementedException; - -public class WeaverStatementProcessor { - - private static final String APPLY_PREFIX = "_apply_counter_"; - private static final String CARDINAL = "__CARDINAL__"; - private static final String WRAP_JOINPOINT = "wrapJoinPoint"; - private static final String UNWRAP_JOINPOINT = "unwrapJoinPoint"; - - private final Interpreter interpreter; - private final Map> selects; - private int laraApplyCounter; - private String lastInChain; - - /** - * A processor that deals with statements related to the weaving process, such as selects, applies and actions - * - * @param interpreter - */ - public static WeaverStatementProcessor newInstance(Interpreter interpreter) { - return new WeaverStatementProcessor(interpreter); - } - - private WeaverStatementProcessor(Interpreter interpreter) { - this.interpreter = interpreter; - selects = new HashMap<>(); - laraApplyCounter = 0; - } - - /** - * Process a given statement that portrays a select - * - * @param stat - * @param depth - * @param ret - */ - public void processSelect(Statement stat, int depth, final StringBuilder ret) { - ret.append(LaraIUtils.getSpace(depth) + "var " + stat.label + " = "); - ret.append(generateSelectArguments(stat)); - - selects.put(stat.label, getAliasList(stat)); - } - - /** - * Process a given statement that portrays an apply - * - * @param stat - * @param depth - * @param ret - */ - public void processApply(Statement stat, int depth, final StringBuilder ret) { - - if (stat.dynamic) { - processDynamicApply(stat, depth, ret); - } else { - processStaticApply(stat, depth, ret); - } - - } - - private static void processDynamicApply(Statement stat, int depth, final StringBuilder ret) { - throw new NotImplementedException( - "Dynamic applies are not supported in current interpreter version (" + LaraI.LARA_VERSION + ")"); - } - - private void processStaticApply(Statement stat, int depth, final StringBuilder ret) { - final Expression conditionExpr = (Expression) stat.components.get(1); - final Code beforeExpr = (Code) stat.components.get(2); - final Code codeExpr = (Code) stat.components.get(3); - final Code afterExpr = (Code) stat.components.get(4); - - StringBuilder selectLabel = null; - final Expression selectExpr = (Expression) stat.components.get(0); - if (!(selectExpr.exprs.get(0) instanceof ExprId)) { - selectLabel = new StringBuilder("__LARAI_SELECT_" + getApplyCounter()); - ret.append(LaraIUtils.getSpace(depth) + "var " + selectLabel + " = "); - ret.append(generateSelectArguments(stat)); - - selects.put(selectLabel.toString(), getAliasList(stat)); - - // LaraI.die("On larai, the expression for 'apply to' can only - // be a list of identifiers, no operators are available."); - - } else { - selectLabel = interpreter.getJavascriptString(selectExpr, 0); - } - ret.append(LaraIUtils.getSpace(depth) + "//Before: apply to " + selectLabel + "\n"); - final List select = selects.get(selectLabel.toString()); - - // TRIGGER APPLY BEGIN EVENT - if (interpreter.hasEvents()) { - EventTriggerGenerator.triggerApply(Stage.BEGIN, interpreter.getCurrentAspect(), stat.label, - selectLabel.toString(), - depth, ret, select.get(0)); - } - ret.append(interpreter.getJavascriptString(beforeExpr, depth)); - - final StringBuilder after = interpreter.getJavascriptString(afterExpr, depth); - - // out.println(select); - ret.append(LaraIUtils.getSpace(depth) + "//Apply to " + selectLabel + "\n"); - - ret.append(getLoopForSelect(selectLabel.toString(), stat.label, select, codeExpr, conditionExpr, depth + 1)); - - ret.append(LaraIUtils.getSpace(depth) + "//After: apply to " + selectLabel + "\n"); - ret.append(after); - // TRIGGER APPLY END EVENT - if (interpreter.hasEvents()) { - EventTriggerGenerator.triggerApply(Stage.END, interpreter.getCurrentAspect(), stat.label, - selectLabel.toString(), - depth, - ret, select.get(0)); - } - } - - private StringBuilder getLoopForSelect(String selectLabel, String applyLabel, List select, Code codeExpr, - Expression conditionExpr, - int depth) { - - String before = selectLabel; - final List pointcutChainNames = new ArrayList<>(); - final StringBuilder ret = new StringBuilder(LaraIUtils.getSpace(depth)); - // TODO: change select.get(0) with "children" - - ret.append(LaraIUtils.getSpace(depth) + "if (" + selectLabel + " != null && " + selectLabel - + ".hasChildren()){\n"); - final int oldDepth = depth++; - String finalCode = ""; - for (String jpAlias : select) { - - final String simpleJPName = jpAlias.substring(1, jpAlias.length() - 1); - final String jpArrayName = "__" + simpleJPName + "List__"; - final String assignment = before + ".getChildren(); // get " + simpleJPName + " join points"; // TODO: - // change - // jpAlias with - // "children" - ret.append(LaraIUtils.getSpace(depth) + "var " + jpArrayName + " = " + assignment + ";\n"); - final String counterName = getApplyCounter(); - ret.append(LaraIUtils.getSpace(depth)); - ret.append(WeaverStatementProcessor.CARDINAL + simpleJPName + ": "); - ret.append("for( var " + counterName + "= 0; "); - ret.append(counterName + " < " + jpArrayName + ".size(); "); - ret.append(counterName + "++){\n"); - - finalCode = LaraIUtils.getSpace(depth) + "}\n" + finalCode; - depth++; - String jpWrapper = "__" + simpleJPName + "Wrapper_"; - jpAlias = '$' + simpleJPName; - // var __appWrapper_ = __appList__.get(_apply_counter_0); //foreach app - ret.append(LaraIUtils.getSpace(depth) + "var " + jpWrapper + " = " + jpArrayName + ".get(" + counterName - + ");\n"); - ret.append(LaraIUtils.getSpace(depth) + "if(!" + jpWrapper + "." + JoinpointUtils.getAliasProperty() - + ".equals('" + simpleJPName + "')) {\n"); - ret.append(LaraIUtils.getSpace(depth + 1) + "continue;\n"); - ret.append(LaraIUtils.getSpace(depth) + "}\n"); - ret.append(LaraIUtils.getSpace(depth) + "var " + jpAlias + " = " - + WRAP_JOINPOINT + "(" + jpWrapper + "." - + JoinpointUtils.getReferenceProperty() + ");\n"); - // ret.append(LaraIUtils.getSpace(depth) + "println('current wrapper: '+" + jpWrapper + ");\n"); - // ret.append(LaraIUtils.getSpace(depth) + "println('current ref: '+" + jpWrapper + "." - // + JoinpointUtils.getReferenceProperty() + ");\n"); - // ret.append(LaraIUtils.getSpace(depth) + "println('current join point: '+" + jpAlias + - // ".joinPointType);\n"); - pointcutChainNames.add(jpAlias); - before = jpWrapper;// jpArrayName + "[" + counterName + "]"; - } - if (!conditionExpr.exprs.isEmpty()) { - ret.append(LaraIUtils.getSpace(depth) + "if(!("); - ret.append(interpreter.getJavascriptString(conditionExpr, 0)); - ret.append("))\n"); - ret.append(LaraIUtils.getSpace(depth + 1) + "continue;\n"); - } - lastInChain = select.get(select.size() - 1); - lastInChain = '$' + lastInChain.replace("'", ""); - if (interpreter.hasEvents()) { - - EventTriggerGenerator.triggerApply(Stage.BEGIN, interpreter.getCurrentAspect(), applyLabel, - selectLabel, - depth, - ret, - pointcutChainNames); - } - ret.append(interpreter.getJavascriptString(codeExpr, depth)); - - lastInChain = null; - ret.append(finalCode); - ret.append(LaraIUtils.getSpace(oldDepth) + "}\n"); - return ret; - } - - public StringBuilder generateSelectArguments(Statement stat) { - - final ArrayList statComponents = stat.components; - final Expression firstExpr = ((Expression) statComponents.get(0)); - final Expression firstExprOp = firstExpr.exprs.get(0); - if (firstExprOp instanceof ExprOp) { - final StringBuilder joinSelect = generateJoin((ExprOp) firstExprOp); - joinSelect.append(";\n"); - return joinSelect; - } - final StringBuilder jpChain = new StringBuilder("["); - final StringBuilder aliasChain = new StringBuilder("["); - final StringBuilder filterChain = new StringBuilder("["); - String userDeclaredVariable = null; - for (int i = 0; i < statComponents.size(); i += 3) { - - final Expression jpClass = (Expression) statComponents.get(i); - if (jpClass.exprs.get(0) instanceof ExprId) { - userDeclaredVariable = interpreter.getJavascriptString(jpClass, 0).toString(); - jpChain.append("'"); - jpChain.append(interpreter.getJavascriptString(jpClass, 0)); - jpChain.append("'"); - } else { - jpChain.append(interpreter.getJavascriptString(jpClass, 0)); - } - jpChain.append(", "); - final Expression jpAlias = (Expression) statComponents.get(i + 1); - aliasChain.append(interpreter.getJavascriptString(jpAlias, 0)); - aliasChain.append(", "); - final Expression jpFilter = (Expression) statComponents.get(i + 2); - filterChain.append('['); - if (jpFilter.exprs.isEmpty()) { - filterChain.append("FilterExpression.newEmpty()"); - } else { - StringBuilder filterExpressionsStr = convert2FilterExpression(jpFilter.exprs.get(0)); - // isFilter = true; - filterChain.append(filterExpressionsStr); - } - // filterChain.append(getJavascriptString(jpFilter, 0)); - // isFilter = false; - filterChain.append(']'); - filterChain.append(", "); - // convert2FilterExpression(statComponents, filterChain, i); - } - jpChain.append("], "); - aliasChain.append("], "); - filterChain.append("]"); - final StringBuilder ret = new StringBuilder(MasterWeaver.WEAVER_NAME); - ret.append(".select( "); - if (userDeclaredVariable != null) { - ret.append(UNWRAP_JOINPOINT + "(" + userDeclaredVariable + "), "); - } - ret.append("'"); - ret.append(stat.label); // Name of the select - ret.append("'"); - ret.append(", "); - ret.append(jpChain); - ret.append(aliasChain); - ret.append(filterChain); - ret.append(",'" + interpreter.getCurrentAspect() + "'"); - // if (interpreter.getEngine().supportsModifyingThis()) { - ret.append(",this"); - // } - ret.append(","); - ret.append(new Coordinates(stat.coord).getLineBegin()); - ret.append(");\n"); - // out.println("---> "+ret); - // java.lang.System.exit(-1); - return ret; - } - - /** - * Creates a select for a join expression - * - * @param exprOp - * @return - */ - private StringBuilder generateJoin(ExprOp exprOp) { - - final StringBuilder ret = new StringBuilder(MasterWeaver.WEAVER_NAME); - final String joinFunctionName = exprOp.name.toLowerCase(); - try { - MasterWeaver.class.getMethod(joinFunctionName, String.class, LaraJoinPoint.class, String.class, - LaraJoinPoint.class); - } catch (final NoSuchMethodException e) { - final JoinOperator op = JoinOperator.valueOf(joinFunctionName.toUpperCase()); - throw new RuntimeException( - "The join operator " + joinFunctionName + "(" + op.getOp() + ")" + " is not implemented!"); - } catch (final SecurityException e) { - throw new RuntimeException("No permissions to use " + joinFunctionName + "!"); - } - - ret.append("." + joinFunctionName + "("); - - final StringBuilder left = generateJoinAux(exprOp.exprs.get(0)); - final String leftName = getLiteralJoin(exprOp.exprs.get(0)); - - ret.append("'" + leftName + "'"); - ret.append(","); - ret.append(left); - ret.append(","); - - final StringBuilder right = generateJoinAux(exprOp.exprs.get(1)); - final String rightName = getLiteralJoin(exprOp.exprs.get(1)); - ret.append("'" + rightName + "'"); - ret.append(","); - ret.append(right); - ret.append(")"); - - return ret; - } - - private StringBuilder generateJoinAux(Expression expression) { - - if (expression instanceof ExprId) { - - final StringBuilder ret = ExpressionProcessor.getJavascriptString((ExprId) expression, 0); - // ret.append(".laraJoinPoint"); - return ret; - } - - final StringBuilder ret = generateJoin((ExprOp) expression); - // ret.append(".laraJoinPoint"); - return ret; - - } - - private String getLiteralJoin(Expression expression) { - - if (expression instanceof ExprId) { - - final StringBuilder ret = ExpressionProcessor.getJavascriptString((ExprId) expression, 0); - return ret.toString(); - } - - final ExprOp exprOp = (ExprOp) expression; - final String op = Enums.JoinOperator.valueOf(exprOp.name.toUpperCase()).getOp(); - final String left = getLiteralJoin(exprOp.exprs.get(0)); - final String right = getLiteralJoin(exprOp.exprs.get(1)); - - return left + op + right; - - } - - private List getJoinChain(ExprOp exprOp) { - List chain = null; - final Expression left = exprOp.exprs.get(0); - final Expression right = exprOp.exprs.get(1); - List leftChain = null; - List rightChain = null; - if (left instanceof ExprOp) { - leftChain = getJoinChain((ExprOp) left); - } else { - final String leftLabel = ExpressionProcessor.getJavascriptString((ExprId) left, 0).toString(); - // out.println(leftLabel); - leftChain = selects.get(leftLabel); - } - if (right instanceof ExprOp) { - rightChain = getJoinChain((ExprOp) right); - } else { - final String rightLabel = ExpressionProcessor.getJavascriptString((ExprId) right, 0).toString(); - // out.println(rightLabel); - rightChain = selects.get(rightLabel); - } - chain = SelectUtils.getJoinChain(leftChain, rightChain); - final Set set = new HashSet<>(chain); - - if (set.size() < chain.size()) { - String error = "The resulting join point chain of the join operation contains duplicate join point names: \n\t"; - for (int i = 0; i < chain.size() - 1; i++) { - - final String joinPoint = chain.get(i); - if (joinPoint.contains(LARACConstantPool.HIDDEN_TAG)) { - error += " a hidden " + joinPoint.substring(0, joinPoint.indexOf(LARACConstantPool.HIDDEN_TAG)) - + "'"; - } else { - error += joinPoint; - } - error += " -> "; - } - error += chain.get(chain.size() - 1); - error += "\nNote: Do not forget to use the same join point names at the beginning of the chain!"; - throw new RuntimeException(error); - } - // out.println(chain); - return chain; - } - - private StringBuilder convert2FilterExpression(Expression jpFilter) { - // jpFilter must always be a binary expression! - if (jpFilter.exprs.isEmpty()) { - return new StringBuilder("FilterExpression.newEmpty()"); - } - if (!(jpFilter instanceof ExprOp) || jpFilter.exprs.size() < 2) { - throw new RuntimeException("Filter must be defined as binary expressions"); - } - ExprOp op = (ExprOp) jpFilter; - final String operator = Operators.getOpString(op.name); - - if (op.name.equals("OR") || op.name.equals("AND")) { - StringBuilder left = convert2FilterExpression(op.exprs.get(0)); - for (int i = 1; i < op.exprs.size(); i++) { - left.append(", FilterExpression.newComparator('" + operator + "'),"); - StringBuilder right = convert2FilterExpression(op.exprs.get(i)); - left.append(right); - } - return left; - - } - final StringBuilder left = interpreter.getJavascriptString(op.exprs.get(0), 0); - StringBuilder right = interpreter.getJavascriptString(op.exprs.get(1), 0); - if (op.name.equals("MATCH")) { - return new StringBuilder("FilterExpression.newMatch('" + left + "'," + right + ",\"" + right + "\")"); - } - - return new StringBuilder( - "FilterExpression.newInstance('" + left + "','" + operator + "'," + right + ",\"" + right + "\")"); - - } - - private List getAliasList(Statement stat) { - final ArrayList statComponents = stat.components; - final Expression firstExpr = ((Expression) statComponents.get(0)); - final Expression firstExprOp = firstExpr.exprs.get(0); - if (firstExprOp instanceof ExprOp) { - return getJoinChain((ExprOp) firstExprOp); - } - final List aliasChain = new ArrayList<>(); - for (int i = 1; i < stat.components.size(); i += 3) { - final Expression jpAlias = (Expression) stat.components.get(i); - aliasChain.add(interpreter.getJavascriptString(jpAlias, 0).toString()); - } - return aliasChain; - } - - public boolean verifyAction(String methodName) { - if (methodName.equals("insert") || methodName.equals("def")) { - return true; - } - - boolean contains = interpreter.getActions().contains(methodName); - if (contains) { - return true; - } - return false; - } - - public String getApplyCounter() { - return WeaverStatementProcessor.APPLY_PREFIX + (laraApplyCounter++); - } - - public String getLastInChain() { - return lastInChain; - } - - public void setLastInChain(String lastInChain) { - this.lastInChain = lastInChain; - } -} diff --git a/LARAI/src/org/lara/interpreter/joptions/config/engine/WeaverEngineStoreDefinition.java b/LARAI/src/org/lara/interpreter/joptions/config/engine/WeaverEngineStoreDefinition.java index 0fcc27097..fd0a6d949 100644 --- a/LARAI/src/org/lara/interpreter/joptions/config/engine/WeaverEngineStoreDefinition.java +++ b/LARAI/src/org/lara/interpreter/joptions/config/engine/WeaverEngineStoreDefinition.java @@ -27,30 +27,26 @@ public class WeaverEngineStoreDefinition implements StoreDefinitionProvider { private final WeaverEngine weaver; - // private LanguageSpecification langSpec; - public WeaverEngineStoreDefinition(WeaverEngine weaver) { - this.weaver = weaver; - // // TODO Auto-generated constructor stub + this.weaver = weaver; } @Override public StoreDefinition getStoreDefinition() { - StoreDefinitionBuilder builder = new StoreDefinitionBuilder( - // WeaverEngineStoreDefinition.DEFINITION_NAME + " " + weaver.getClass().getName()); - weaver.getClass().getSimpleName() + " Options"); - List opts = weaver.getOptions(); + StoreDefinitionBuilder builder = new StoreDefinitionBuilder( + weaver.getClass().getSimpleName() + " Options"); + List opts = weaver.getOptions(); - for (WeaverOption weaverOption : opts) { - builder.addKey(weaverOption.dataKey()); - } + for (WeaverOption weaverOption : opts) { + builder.addKey(weaverOption.dataKey()); + } - return builder.build(); + return builder.build(); } public static String getDefinitionName() { - return WeaverEngineStoreDefinition.DEFINITION_NAME; + return WeaverEngineStoreDefinition.DEFINITION_NAME; } } diff --git a/LARAI/src/org/lara/interpreter/joptions/config/interpreter/LaraIDataStore.java b/LARAI/src/org/lara/interpreter/joptions/config/interpreter/LaraIDataStore.java index 54715cf22..ad6970754 100644 --- a/LARAI/src/org/lara/interpreter/joptions/config/interpreter/LaraIDataStore.java +++ b/LARAI/src/org/lara/interpreter/joptions/config/interpreter/LaraIDataStore.java @@ -12,48 +12,27 @@ */ package org.lara.interpreter.joptions.config.interpreter; -import com.google.common.base.Preconditions; -import com.google.gson.Gson; import larai.LaraI; -import larai.larabundle.LaraBundle; -import larai.lararesource.LaraResource; import org.lara.interpreter.exception.LaraIException; -import org.lara.interpreter.joptions.keys.FileList; -import org.lara.interpreter.joptions.keys.OptionalFile; -import org.lara.interpreter.utils.Tools; import org.lara.interpreter.weaver.interf.WeaverEngine; import org.lara.interpreter.weaver.options.WeaverOption; import org.suikasoft.jOptions.Datakey.DataKey; import org.suikasoft.jOptions.Interfaces.DataStore; -import org.suikasoft.jOptions.JOptionKeys; import org.suikasoft.jOptions.JOptionsUtils; -import org.xml.sax.SAXException; -import pt.up.fe.specs.git.GitRepos; -import pt.up.fe.specs.jsengine.JsEngineType; -import pt.up.fe.specs.lara.aspectir.Argument; -import pt.up.fe.specs.tools.lara.logging.LaraLog; import pt.up.fe.specs.util.SpecsIo; import pt.up.fe.specs.util.SpecsLogs; -import pt.up.fe.specs.util.properties.SpecsProperties; -import pt.up.fe.specs.util.utilities.StringList; - -import javax.xml.parsers.ParserConfigurationException; import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; import java.util.*; /** * TODO: Should deprecate and just use DataStore directly? - * TODO: Also, the "ifs" in the getters interfere with the default values set in the DataKey + * TODO: Also, the "ifs" in the getters interfere with the default values set in + * the DataKey * * @author JoaoBispo */ public class LaraIDataStore implements LaraiKeys { - // private static final String GIT_QUERY_FOLDER = "folder"; - // private static final Set GIT_URL_QUERIES = new HashSet<>(Arrays.asList(GIT_QUERY_FOLDER)); - public static final String CONFIG_FILE_NAME = "larai.properties"; private static final String SYSTEM_OPTIONS_FILENAME = "system_options.xml"; @@ -66,35 +45,20 @@ public static String getSystemOptionsFilename() { } private final DataStore dataStore; - private final LaraI larai; - private Tools tools = null; - - private final GitRepos gitRepos; public LaraIDataStore(LaraI lara, DataStore dataStore, WeaverEngine weaverEngine) { - larai = lara; // Merge system-wise options with local options - var mergedDataStore = mergeSystemAndLocalOptions(weaverEngine, dataStore); // this.dataStore = dataStore; - this.dataStore = mergedDataStore; - - this.gitRepos = new GitRepos(); + this.dataStore = mergeSystemAndLocalOptions(weaverEngine, dataStore); for (WeaverOption option : weaverEngine.getOptions()) { DataKey key = option.dataKey(); Optional value = this.dataStore.getTry(key); - if (value.isPresent()) { - // weaverDataStore.setRaw(key, value.get()); - this.dataStore.setRaw(key, value.get()); - } + value.ifPresent(o -> this.dataStore.setRaw(key, o)); } setLaraProperties(); - // System.out.println("\n\n" + this.dataStore); - // System.out.println("........................."); - // System.out.println("\n\n" + dataStore); - } private DataStore mergeSystemAndLocalOptions(WeaverEngine weaverEngine, DataStore localArgs) { @@ -120,10 +84,8 @@ private DataStore mergeSystemAndLocalOptions(WeaverEngine weaverEngine, DataStor DataStore defaultOptions = JOptionsUtils.loadDataStore(systemOptionsFilename, getClass(), storeDef, persistence); - var defaultOptionsFile = defaultOptions.getConfigFile().orElse(null); - if (defaultOptionsFile != null) { - SpecsLogs.debug("Loading default options in file '" + defaultOptionsFile.getAbsolutePath() + "'"); - } + defaultOptions.getConfigFile().ifPresent(defaultOptionsFile -> SpecsLogs + .debug("Loading default options in file '" + defaultOptionsFile.getAbsolutePath() + "'")); SpecsLogs.debug(() -> "Loading system-wide options"); SpecsLogs.debug(() -> "Original options: " + localArgs); @@ -153,467 +115,19 @@ private DataStore mergeSystemAndLocalOptions(WeaverEngine weaverEngine, DataStor } /** - * Set an option on lara according to the value given, if the option exists on the enum {@link Argument} - * - * @param option - * @param value - * @return + * Set an option on lara according to the value given, if the option exists on + * the enum {@link Argument} */ private void setLaraProperties() { if (!dataStore.hasValue(LaraiKeys.LARA_FILE)) { throw new LaraIException( - "The lara aspect file is mandatory! Please define the input lara file (e.g.: aspect.lara)"); - } - if (dataStore.hasValue(LaraiKeys.LOG_FILE)) { - OptionalFile logFile = dataStore.get(LaraiKeys.LOG_FILE); - if (larai != null && logFile.isUsed()) { - larai.out.addFileStream(logFile.getFile()); - } + "The script file is mandatory! Please define the input script file (e.g.: main.js)"); } - - if (dataStore.hasValue(LaraiKeys.VERBOSE)) { - int level = dataStore.get(LaraiKeys.VERBOSE).ordinal(); - if (larai != null) { - larai.out.setLevel(level); - } - } - if (dataStore.hasValue(LaraiKeys.OUTPUT_FOLDER)) { File output = dataStore.get(LaraiKeys.OUTPUT_FOLDER); SpecsIo.mkdir(output); } - - } - - public Tools getTools() { - if (tools == null) { - setTools(createTools(dataStore, larai)); - } - return tools; - } - - private static Tools createTools(DataStore dataStore, LaraI larai) { - try { - - if (dataStore.hasValue(LaraiKeys.TOOLS_FILE)) { - - OptionalFile optionalFile = dataStore.get(LaraiKeys.TOOLS_FILE); - - if (optionalFile.isUsed()) { - return new Tools(optionalFile.getFile()); - } - - } - - } catch (final FileNotFoundException e) { - larai.out.warn("Could not find tools.xml in the given path"); - } catch (final ParserConfigurationException | SAXException | IOException e) { - larai.out.warn("Could not parse tools.xml: " + e.getLocalizedMessage()); - } - return null; - } - - public void setTools(Tools tools) { - this.tools = tools; - } - - /** - * Right now the arguments are going as a single String! - * - * @return - */ - public DataStore getWeaverArgs() { - - // return weaverDataStore; - return dataStore; - } - - public File getLaraFile() { - return dataStore.get(LaraiKeys.LARA_FILE); - } - - public String getMainAspect() { - if (dataStore.hasValue(LaraiKeys.MAIN_ASPECT)) { - return dataStore.get(LaraiKeys.MAIN_ASPECT); - } - return ""; - } - - public FileList getWorkingDir() { - return getTrySources(LaraiKeys.WORKSPACE_FOLDER); - } - - public List getExtraSources() { - if (dataStore.hasValue(LaraiKeys.WORKSPACE_EXTRA)) { - // test1.c$prefix$test1.c;test2.c - return new ArrayList<>(dataStore.get(WORKSPACE_EXTRA).keySet()); - /* - String workspaceExtra = dataStore.get(WORKSPACE_EXTRA); - - List paths = PathList.parse(workspaceExtra); - - // Split using ; - // String[] paths = workspaceExtra.split(";"); - List extraSources = new ArrayList<>(); - - for (String path : paths) { - // Trim - String trimmedPath = path.strip(); - - // Ignore if empty - if (trimmedPath.isEmpty()) { - continue; - } - - File parsedFile = KeyFactory.customGetterFile(new File(trimmedPath), dataStore, false, false, false, - true); - - extraSources.add(parsedFile); - } - - return extraSources; - */ - } - - return Collections.emptyList(); - } - - public boolean isDebug() { - if (dataStore.hasValue(LaraiKeys.DEBUG_MODE)) { - return dataStore.get(LaraiKeys.DEBUG_MODE); - } - return false; - } - - public boolean isRestricMode() { - return dataStore.get(LaraiKeys.RESTRICT_MODE); - } - - public boolean useStackTrace() { - if (dataStore.hasValue(LaraiKeys.TRACE_MODE)) { - return dataStore.get(LaraiKeys.TRACE_MODE); - } - return false; - } - - public File getOutputDir() { - return getTryFolder(LaraiKeys.OUTPUT_FOLDER); - } - - private File getTryFolder(DataKey folder) { - if (dataStore.hasValue(folder)) { - return dataStore.get(folder); - } - return new File("."); - } - - private FileList getTrySources(DataKey folder) { - - return dataStore.get(folder); - /* - if (dataStore.hasValue(folder)) { - return dataStore.get(folder); - } - return FileList.newInstance(new File(".")); - */ - } - - public FileList getIncludeDirs() { - if (dataStore.hasValue(LaraiKeys.INCLUDES_FOLDER)) { - FileList includesFolder = dataStore.get(LaraiKeys.INCLUDES_FOLDER); - - return includesFolder; - } - return FileList.newInstance(); - } - - public boolean isAutomaticallyIncludeJs() { - return dataStore.get(LaraiKeys.AUTOMATICALLY_IMPORT_JS); - // if (dataStore.hasValue(LaraiKeys.AUTOMATICALLY_IMPORT_JS)) { - // return dataStore.get(LaraiKeys.AUTOMATICALLY_IMPORT_JS); - // } - // return false; - } - - public StringList getExternalDependencies() { - if (dataStore.hasValue(LaraiKeys.EXTERNAL_DEPENDENCIES)) { - return dataStore.get(LaraiKeys.EXTERNAL_DEPENDENCIES); - } - - return StringList.newInstance(); - } - - public OptionalFile getReportFile() { - if (dataStore.hasValue(LaraiKeys.REPORT_FILE)) { - return dataStore.get(LaraiKeys.REPORT_FILE); - } - return OptionalFile.newInstance(null); - } - - public OptionalFile getMetricsFile() { - if (dataStore.hasValue(LaraiKeys.METRICS_FILE)) { - return dataStore.get(LaraiKeys.METRICS_FILE); - } - return OptionalFile.newInstance(null); - } - - public boolean isLaraLoc() { - if (dataStore.hasValue(LaraiKeys.LARA_LOC)) { - return dataStore.get(LaraiKeys.LARA_LOC); - } - return false; - } - - /** - * Returns a JSON string representing the aspect arguments. If the value represents a json file, reads it before - * returning. - * - * @return the aspect arguments as a JSON string - */ - public String getAspectArgumentsStr() { - if (dataStore.hasValue(LaraiKeys.ASPECT_ARGS)) { - - String aspectArgs = dataStore.get(LaraiKeys.ASPECT_ARGS); - - // [Old] Can return directly, custom getter of ASPECT_ARGS already parses files and sanitizes JSON - // [New] Disabled this, because if a json file is given as input, this prevents storing again the path - // to the JSON file (instead, it stores the contents of the json file itself - // return aspectArgs; - - // Parse aspect args (e.g., in case it is a file, sanitize) - return parseAspectArgs(aspectArgs); - - } - return ""; - } - - private String parseAspectArgs(String aspectArgs) { - // Moved logic from customGetter of ASPECT_ARGS to here, to preserve storing the arguments as a JSON file - - // In the end, we want to return a JSON string - var jsonString = aspectArgs; - - // Check if an existing file was given as argument - var file = JOptionKeys.getContextPath(aspectArgs, dataStore); - - if (file.isFile()) { - - var extension = SpecsIo.getExtension(file).toLowerCase(); - - // Check if JSON - if (extension.equals("json")) { - jsonString = SpecsIo.read(file); - } - - // Check if properties - else if (extension.equals("properties")) { - jsonString = SpecsProperties.newInstance(file).toJson(); - } else { - // Throw exception - throw new RuntimeException("Invalid file format (" + aspectArgs - + ") for aspect arguments. Supported formats: .json, .properties"); - } - - } - - // String json before testing for curly braces - jsonString = jsonString.strip(); - - // Fix curly braces - if (!jsonString.startsWith("{")) { - jsonString = "{" + jsonString; - } - - if (!jsonString.endsWith("}")) { - jsonString = jsonString + "}"; - } - - // Sanitize - var gson = new Gson(); - try { - return gson.toJson(gson.fromJson(jsonString, Object.class)); - } catch (Exception e) { - throw new RuntimeException("Passed invalid JSON as argument: '" + aspectArgs + "'", e); - } - - } - - public boolean isJavaScriptStream() { - if (dataStore.hasValue(LaraiKeys.LOG_JS_OUTPUT)) { - return dataStore.get(LaraiKeys.LOG_JS_OUTPUT); - } - return false; - } - - public boolean disableWithKeywordInLaraJs() { - return dataStore.get(LaraiKeys.DISABLE_WITH_KEYWORD_IN_LARA_JS); - } - - // public List getLaraAPIs() { - // return laraAPIs; - // } - - /* - public List getCoreScripts() { - return coreScripts; - } - */ - - public Map getBundleTags() { - // System.out.println("DATA STORE:" + dataStore); - if (dataStore.hasValue(LaraiKeys.BUNDLE_TAGS)) { - // System.out.println("BUNDLE TAGS:" + dataStore.get(LaraiKeys.BUNDLE_TAGS)); - return parseBundleTags(dataStore.get(LaraiKeys.BUNDLE_TAGS)); - } - return Collections.emptyMap(); - } - - public JsEngineType getJsEngine() { - if (dataStore.hasValue(LaraiKeys.JS_ENGINE)) { - return dataStore.get(LaraiKeys.JS_ENGINE); - } - return JS_ENGINE.getDefault().get(); - } - - private Map parseBundleTags(String bundleTagsString) { - Map bundleTags = new HashMap<>(); - - if (bundleTagsString.trim().isEmpty()) { - return bundleTags; - } - - // Split around the comma - String[] tagPairs = bundleTagsString.split(","); - for (String tagPair : tagPairs) { - int equalIndex = tagPair.indexOf('='); - Preconditions.checkArgument(equalIndex != -1, - "Malformed 'Bundle Tags' option, found a tag-value pair without equal sign (=): '" - + bundleTagsString + "'"); - - String tag = tagPair.substring(0, equalIndex); - String value = tagPair.substring(equalIndex + 1, tagPair.length()); - - bundleTags.put(tag, value); - } - - return bundleTags; - } - - public FileList getProcessedIncludeDirs(WeaverEngine weaverEngine) { - FileList includeDirs = getIncludeDirs(); - - // SpecsLogs.debug(() -> "Original LARA include dirs: " + includeDirs); - - // Process GIT repositories - FileList includeDirsAfterGit = processExternalDependencies(includeDirs); - // SpecsLogs.debug(() -> "Include dirs after GIT repositories: " + includeDirsAfterGit); - - // Process Bundles - LaraBundle laraBundle = new LaraBundle(weaverEngine.getName(), getBundleTags()); - FileList includeDirsAfterBundles = laraBundle.process(includeDirsAfterGit); - // SpecsLogs.debug(() -> "Include dirs after bundles: " + includeDirsAfterBundles); - - // Process LARA Resources, but only of active bundles - LaraResource laraResource = new LaraResource(weaverEngine); - FileList includeDirsAfterResources = laraResource.process(includeDirsAfterBundles); - // SpecsLogs.debug(() -> "Include dirs after LARA resources: " + includeDirsAfterResources); - - return includeDirsAfterResources; - } - - private FileList processExternalDependencies(FileList includeDirs) { - // Check if there are external dependencies - List externalDependencies = getExternalDependencies().getStringList(); - - if (externalDependencies.isEmpty()) { - return includeDirs; - } - - List files = includeDirs.getFiles(); - - // Process each dependency - for (String externalDependency : externalDependencies) { - processExternalDependency(externalDependency, files); - } - - return FileList.newInstance(files); - // List files = new ArrayList<>(); - // - // for (File file : includeDirs.getFiles()) { - // files.add(file); - // } - // - // return includeDirs.newInstance(files); - } - - private void processExternalDependency(String externalDependency, List files) { - var urlTry = SpecsIo.parseUrl(externalDependency); - if (urlTry.isEmpty()) { - LaraLog.info("Could not parse URL of external dependency: " + externalDependency); - return; - } - - var url = urlTry.get(); - - // String lowercaseDep = externalDependency.toLowerCase(); - // String lowercaseDep = url.getPath().toLowerCase(); - String protocol = url.getProtocol().toLowerCase(); - String path = url.getPath().toLowerCase(); - - if (path.endsWith(".git") || protocol.equals("git")) { - // Map query = SpecsIo.parseUrlQuery(url); - // var gitDependency = url.getQuery() != null ? externalDependency.replace("?" + url.getQuery(), "") - // : externalDependency; - // processGitDependency(gitDependency, files, query); - processGitDependency(externalDependency, files); - return; - } - - if (protocol.equals("http") || protocol.equals("https")) { - LaraLog.info("Pure HTTP links not yet supported as external dependency: '" + externalDependency + "'"); - return; - } - - LaraLog.info("Could not determine the external dependency link kind: '" + externalDependency + "'"); - } - - private void processGitDependency(String externalDependency, List files) { - // private void processGitDependency(String externalDependency, List files, Map query) { - // Check queries - // if (!query.isEmpty()) { - // List unsupportedQueries = query.keySet().stream() - // .map(String::toLowerCase) - // .filter(key -> !GIT_URL_QUERIES.contains(key)) - // .collect(Collectors.toList()); - // - // if (!unsupportedQueries.isEmpty()) { - // LaraLog.info("Found unsuppoted queries " + unsupportedQueries + " in git URL. Supported queries: " - // + GIT_URL_QUERIES); - // } - // } - - File gitRepoFolder = gitRepos.getFolder(externalDependency); - // File gitRepoFolder = SpecsGit.parseRepositoryUrl(externalDependency); - if (gitRepoFolder == null || !gitRepoFolder.isDirectory()) { - LaraLog.info("Could not prepare external dependency '" + externalDependency + "'"); - return; - } - - // Check if there is a specific folder specified - // var foldername = query.get(GIT_QUERY_FOLDER); - // if (foldername != null) { - // var specificFolder = new File(gitRepoFolder, foldername); - // if (!specificFolder.isDirectory()) { - // LaraLog.info("Repo folder '" + specificFolder + "' does not exist"); - // } else { - // LaraLog.info("Adding folder '" + specificFolder + "' as LARA include"); - // gitRepoFolder = specificFolder; - // } - // } - - // Add repository - files.add(gitRepoFolder); } @Override diff --git a/LARAI/src/org/lara/interpreter/joptions/config/interpreter/LaraiStoreDefinition.java b/LARAI/src/org/lara/interpreter/joptions/config/interpreter/LaraiStoreDefinition.java index 1999c8494..f1c595fb7 100644 --- a/LARAI/src/org/lara/interpreter/joptions/config/interpreter/LaraiStoreDefinition.java +++ b/LARAI/src/org/lara/interpreter/joptions/config/interpreter/LaraiStoreDefinition.java @@ -36,50 +36,15 @@ public class LaraiStoreDefinition implements StoreDefinitionProvider { private static final String DEFINITION_NAME = "LaraI Options"; private final List> extraKeys = new ArrayList<>(); - // private final List> extraKeys = new ArrayList<>(Arrays.asList(LaraiKeys.CONFIGURATION_FILE)); @Override public StoreDefinition getStoreDefinition() { StoreDefinitionBuilder builder = new StoreDefinitionBuilder(LaraiKeys.STORE_DEFINITION.getName()); builder.addDefinition(LaraiKeys.STORE_DEFINITION); - - /* - StoreDefinitionBuilder builder = new StoreDefinitionBuilder(LaraiStoreDefinition.DEFINITION_NAME); - - builder.addKey(LaraiKeys.LARA_FILE); - - builder.addKey(LaraiKeys.MAIN_ASPECT); - builder.addKey(LaraiKeys.ASPECT_ARGS); - // builder.addKey(LaraiKeys.WEAVER_ARGS); - // builder.addKey(LaraiKeys.LANGUAGE_SPECIFICATION_FOLDER); - builder.addKey(LaraiKeys.WORKSPACE_FOLDER); - builder.addKey(LaraiKeys.OUTPUT_FOLDER); - builder.addKey(LaraiKeys.INCLUDES_FOLDER); - builder.addKey(LaraiKeys.EXTERNAL_DEPENDENCIES); - // DataKey weaverClass = LaraiKeys.WEAVER_CLASS.setDefault(ClassProvider.newInstance(weaver)); - // builder.addKey(weaverClass); - builder.addKey(LaraiKeys.VERBOSE); - builder.addKey(LaraiKeys.REPORT_FILE); - builder.addKey(LaraiKeys.METRICS_FILE); - builder.addKey(LaraiKeys.TOOLS_FILE); - builder.addKey(LaraiKeys.LOG_FILE); - builder.addKey(LaraiKeys.LOG_JS_OUTPUT); - builder.addKey(LaraiKeys.DEBUG_MODE); - builder.addKey(LaraiKeys.TRACE_MODE); - builder.addKey(LaraiKeys.BUNDLE_TAGS); - // builder.addKey(LaraiKeys.SHOW_HELP); - */ final StoreDefinitionBuilder finalBuilder = builder.setDefaultValues(getDefaultValues()); extraKeys.forEach(finalBuilder::addKey); - // List engineOptions; - // try { - // engineOptions = this.weaver.newInstance().getOptions(); - // engineOptions.forEach(opt -> finalBuilder.addKey(opt.dataKey())); - // } catch (InstantiationException | IllegalAccessException e) { - // LoggingUtils.msgWarn("Error message:\n", e); - // } return finalBuilder.build(); } @@ -103,14 +68,13 @@ private static Properties getDefaultProperties() { } /** - * Loads the properties from a given file. It does not load/given an exception if the file does not exist! + * Loads the properties from a given file. It does not load/given an exception + * if the file does not exist! * - * @param properties - * @param globalFile */ private static void loadProperties(Properties properties, File globalFile) { if (globalFile.exists()) { - try (final InputStream inputConfigStream = new FileInputStream(globalFile);) { + try (final InputStream inputConfigStream = new FileInputStream(globalFile)) { properties.load(inputConfigStream); } catch (IOException e) { SpecsLogs.warn("Error message:\n", e); @@ -121,8 +85,4 @@ private static void loadProperties(Properties properties, File globalFile) { public static String getDefinitionName() { return LaraiStoreDefinition.DEFINITION_NAME; } - - public void addExtraKeys(StoreDefinition storeDefinition) { - extraKeys.addAll(storeDefinition.getKeys()); - } } diff --git a/LARAI/src/org/lara/interpreter/joptions/gui/LaraLauncher.java b/LARAI/src/org/lara/interpreter/joptions/gui/LaraLauncher.java deleted file mode 100644 index 3d666264d..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/gui/LaraLauncher.java +++ /dev/null @@ -1,222 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.gui; - -import java.awt.Dimension; -import java.awt.Frame; -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -import javax.swing.JFrame; -import javax.swing.JTabbedPane; -import javax.swing.WindowConstants; - -import org.apache.commons.cli.CommandLine; -import org.lara.interpreter.cli.OptionsParser; -import org.lara.interpreter.exception.LaraIException; -import org.lara.interpreter.joptions.config.interpreter.LaraiKeys; -import org.lara.interpreter.joptions.panels.editor.EditorPanel; -import org.lara.interpreter.joptions.panels.editor.listeners.WindowsFocusGainedListener; -import org.lara.interpreter.joptions.panels.editor.utils.SearchUtils; -import org.lara.interpreter.weaver.defaultweaver.DefaultWeaver; -import org.lara.interpreter.weaver.interf.WeaverEngine; -import org.suikasoft.jOptions.Interfaces.DataStore; -import org.suikasoft.jOptions.app.App; -import org.suikasoft.jOptions.app.AppKernel; -import org.suikasoft.jOptions.app.AppPersistence; -import org.suikasoft.jOptions.gui.SimpleGui; -import org.suikasoft.jOptions.gui.panels.app.ProgramPanel; -import org.suikasoft.jOptions.gui.panels.app.TabProvider; -import org.suikasoft.jOptions.gui.panels.option.StringListPanel; -import org.suikasoft.jOptions.persistence.XmlPersistence; -import org.suikasoft.jOptions.storedefinition.StoreDefinition; - -import larai.LaraI; -import pt.up.fe.specs.util.SpecsLogs; -import pt.up.fe.specs.util.SpecsSystem; - -public class LaraLauncher { - - public static void main(String[] args) { - SpecsSystem.programStandardInit(); - - launch(args, new DefaultWeaver()); - } - - /** - * Launch LaraI with the given engine and the input arguments. If no arguments are given a GUI is launched - * - *

- * Can throw exceptions. - * - * @param args - * @param engine - */ - public static boolean launch(String[] args, WeaverEngine engine) { - - // SpecsSystem.programStandardInit(); - - return LaraI.exec(args, engine); - // - // try { - // return LaraI.exec(args, engine); - // // if (!sucess) { - // // LoggingUtils.msgInfo("LARAI execution returned false"); - // // System.exit(1); - // // } - // } catch (RuntimeException e) { - // LoggingUtils.msgInfo("Exception while running weaver: " + e.getMessage()); - // return false; - // } - // - } - - public static void launchGUI(WeaverEngine engine, Optional configFile) { - long time = System.currentTimeMillis(); - AppKernel kernel = new LaraiLauncherKernel(engine); - SpecsLogs.msgInfo("Starting GUI..."); // replace this with a splash screen - - StoreDefinition laraiDefinition = OptionsParser.getLaraStoreDefinition(engine); - - String appName = engine.getNameAndBuild(); - // String appName = engine.getName(); - // - // var implVersion = SpecsSystem.getBuildNumber(); - // if (implVersion != null) { - // appName += " (build " + implVersion + ")"; - // } - - List otherTabs = new ArrayList<>(); - XmlPersistence persistence = OptionsParser.getXmlPersistence(laraiDefinition); - - otherTabs.add(dataStore -> EditorPanel.newInstance(dataStore, persistence, engine)); - - App app = App.newInstance(appName, laraiDefinition, persistence, kernel) - .setOtherTabs(otherTabs) - .setNodeClass(engine.getClass()) - .setIcon(engine.getIcon()); - - SimpleGui gui = new SimpleGui(app); - - JFrame guiFrame = gui.getFrame(); - - guiFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);// <- prevent closing - guiFrame.setPreferredSize(new Dimension(1200, 750)); - guiFrame.setExtendedState(guiFrame.getExtendedState() | Frame.MAXIMIZED_BOTH); - guiFrame.addWindowFocusListener(new WindowsFocusGainedListener(e -> refreshCurrentTab(guiFrame))); - guiFrame.addWindowListener(new java.awt.event.WindowAdapter() { - @Override - public void windowClosing(java.awt.event.WindowEvent windowEvent) { - EditorPanel editorPanel = SearchUtils.findFirstComponentOfType(guiFrame, EditorPanel.class); - JTabbedPane parent = (JTabbedPane) editorPanel.getParent(); - parent.setSelectedComponent(editorPanel); - - boolean success = editorPanel.getTabsContainer().getMainTab().saveBeforeClose(); - if (!success) { - return; - } - success = editorPanel.closingProgram(); - // success = editorPanel.getTabsContainer().closeAll(); - if (!success) { - return; - } - - // guiFrame.dispose(); <-- this does not close the JVM instance, i.e., the window is closed but the - // process is still executing - System.exit(0); // TODO - replace with correct close method - - } - }); - - if (configFile.isPresent()) { - ProgramPanel programPanel = SearchUtils.findFirstComponentOfType(guiFrame, ProgramPanel.class); - programPanel.getFilenameTextField().setSelectedItem(configFile.get()); - } - - // Initialize External Dependencies predefined values - - var externalDependenciesPanel = (StringListPanel) gui.getAppFrame().getTabbedPane().getOptionsPanel() - .getPanel(LaraiKeys.EXTERNAL_DEPENDENCIES); - externalDependenciesPanel.setPredefinedValues(engine.getPredefinedExternalDependencies()); - - // externalDependencies.getDefaultSeparator() - - // System.out.println("NAME: " + LaraiKeys.EXTERNAL_DEPENDENCIES.getName()); - // var externalDependenciesPanel = (StringListPanel) LaraiKeys.EXTERNAL_DEPENDENCIES.getPanel(null); - // externalDependenciesPanel.setPredefinedValues(engine.getPredefinedExternalDependencies()); - // guiFrame.revalidate(); - // guiFrame.repaint(); - - SpecsLogs.debug(() -> "Lara GUI load time: " + (System.currentTimeMillis() - time)); - - // This code is making the console area to use all window - // JTabbedPane tabbedPane = SearchUtils.findFirstComponentOfType(guiFrame, JTabbedPane.class); - // tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1); // So it opens in the editor tab - gui.execute(); - - } - - private static void refreshCurrentTab(JFrame guiFrame) { - EditorPanel editorPanel = SearchUtils.findFirstComponentOfType(guiFrame, EditorPanel.class); - if (editorPanel != null) { - - editorPanel.getTabsContainer().getCurrentTab().refresh(); - } - } - - /** - * Execute LaraI with the given configuration file and other options - * - * @param cmd - */ - public static void launch(WeaverEngine weaverEngine, File configFile, boolean guiMode) { - // System.out.println( - // "running config " + configFile + " in gui mode? " + guiMode + ". weaver: " - // + weaverEngine.getClass().getName()); - - if (!guiMode) { - StoreDefinition laraiDefinition = OptionsParser.getLaraStoreDefinition(weaverEngine); - AppPersistence persistence = OptionsParser.getXmlPersistence(laraiDefinition); - DataStore laraiStore = persistence.loadData(configFile); - LaraI.exec(laraiStore, weaverEngine); - } else { - launchGUI(weaverEngine, Optional.of(configFile)); - } - - } - - /** - * Execute LaraI with the given configuration file and other options - * - * @param cmd - */ - public static void launch(WeaverEngine weaverEngine, File configFile, boolean guiMode, String fileName, - CommandLine cmd) { - - if (!guiMode) { - StoreDefinition laraiDefinition = OptionsParser.getLaraStoreDefinition(weaverEngine); - AppPersistence persistence = OptionsParser.getXmlPersistence(laraiDefinition); - DataStore laraiStore = persistence.loadData(configFile); - // OptionsConverter.commandLine2DataStore(cmd.get, cmd, weaverOptions) - LaraI.exec(laraiStore, weaverEngine); - } else { - throw new LaraIException( - "Cannot use configuration file and GUI mode and overriding options at the same time. Alternatives: Config + GUI or Config + "); - // launchGUI(weaverEngine, Optional.of(configFile)); - } - - } -} diff --git a/LARAI/src/org/lara/interpreter/joptions/gui/LaraiLauncherKernel.java b/LARAI/src/org/lara/interpreter/joptions/gui/LaraiLauncherKernel.java deleted file mode 100644 index 24d10f1ee..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/gui/LaraiLauncherKernel.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.gui; - -import org.lara.interpreter.weaver.interf.WeaverEngine; -import org.suikasoft.jOptions.Interfaces.DataStore; -import org.suikasoft.jOptions.app.AppKernel; - -import larai.LaraI; - -public class LaraiLauncherKernel implements AppKernel { - - private final WeaverEngine engine; - - public LaraiLauncherKernel(WeaverEngine engine) { - this.engine = engine; - } - - @Override - public int execute(DataStore options) { - // // System.out.println(options); - try { - - // // Check if unit-testing mode - // if (options.get(LaraiKeys.UNIT_TEST_MODE)) { - // boolean result = engine.executeUnitTestMode(options.get(LaraiKeys.UNIT_TEST_ARGS)); - // return result ? 0 : 1; - // } - - boolean exec = LaraI.exec(options, engine); - return exec ? 0 : 1; - - } catch (Exception e) { - e.printStackTrace(); - } - return 1; - } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/EditorPanel.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/EditorPanel.java deleted file mode 100644 index 3eb7a24fe..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/EditorPanel.java +++ /dev/null @@ -1,602 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor; - -import java.awt.BorderLayout; -import java.awt.Font; -import java.io.File; -import java.util.Collection; - -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSplitPane; -import javax.swing.JTextArea; -import javax.swing.text.DefaultCaret; - -import org.lara.interpreter.joptions.config.interpreter.LaraiKeys; -import org.lara.interpreter.joptions.config.interpreter.VerboseLevel; -import org.lara.interpreter.joptions.keys.FileList; -import org.lara.interpreter.joptions.panels.editor.components.EditorToolBar; -import org.lara.interpreter.joptions.panels.editor.components.Explorer; -import org.lara.interpreter.joptions.panels.editor.components.LanguageSpecificationSideBar; -import org.lara.interpreter.joptions.panels.editor.components.OutlinePanel; -import org.lara.interpreter.joptions.panels.editor.components.SearchPanel; -import org.lara.interpreter.joptions.panels.editor.listeners.FocusGainedListener; -import org.lara.interpreter.joptions.panels.editor.tabbed.MainLaraTab; -import org.lara.interpreter.joptions.panels.editor.tabbed.TabsContainerPanel; -import org.lara.interpreter.joptions.panels.editor.utils.LaraWorker; -import org.lara.interpreter.joptions.panels.editor.utils.SettingsManager; -import org.lara.interpreter.weaver.interf.WeaverEngine; -import org.lara.interpreter.weaver.options.WeaverOption; -import org.suikasoft.jOptions.Interfaces.DataStore; -import org.suikasoft.jOptions.app.AppPersistence; -import org.suikasoft.jOptions.gui.panels.app.AppKeys; -import org.suikasoft.jOptions.gui.panels.app.GuiTab; -import org.suikasoft.jOptions.gui.panels.app.TabbedPane; - -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.SpecsLogs; -import pt.up.fe.specs.util.logging.TextAreaHandler; - -/** - * THis is the complete tab containing all the panels of the editor - * - * @author Tiago - * - */ -public class EditorPanel extends GuiTab { - - /** - * - */ - private static final long serialVersionUID = 1L; - public static final int DEFAULT_FONT = 12; - - private final SettingsManager settings; - private final TabsContainerPanel tabsContainer; - // private final LanguageSpecificationSideBar langSpecSideBar; - private final AppPersistence persistence; - private final Collection customWeaverOptions; - private File canonicalAspectFile; - private DataStore optionsDataStore; - private File outputFile; - private final SearchPanel searchPanel; - private final JTextArea outputArea; - private final JScrollPane consolePanel; - private final JSplitPane tabsConsoleSplit; - private final JSplitPane explorerOutlineSplit; - private final OutlinePanel outline; - private final JScrollPane scrollableOutline; - - // private boolean init = true; - private final LanguageSpecificationSideBar langSpecSideBar; - private double lasSplitSize = 0.75; - private Explorer explorer; - private final LaraWorker worker; - private final EditorToolBar menu; - // private boolean requiresUpdate = false; - - private boolean runDebug = false; - - private JSplitPane explorerEditorSplit; - - private boolean firstEntry = true; - - // public static EditorPanel newInstance(DataStore dataStore) { - // return new EditorPanel(dataStore); - // } - // - // public EditorPanel(DataStore dataStore) { - // this(dataStore, null, null); - // } - - public static EditorPanel newInstance(DataStore dataStore, AppPersistence persistence, - WeaverEngine weaverEngine) { - return new EditorPanel(dataStore, persistence, weaverEngine); - } - - private EditorPanel(DataStore dataStore, AppPersistence persistence, WeaverEngine weaverEngine) { - super(dataStore); - setLayout(new BorderLayout()); - settings = new SettingsManager(this, getAppName()); - this.persistence = persistence; - this.customWeaverOptions = weaverEngine.getOptions(); - canonicalAspectFile = null; - explorer = new Explorer(this); - worker = new LaraWorker(this); - - tabsContainer = new TabsContainerPanel(explorer); - menu = new EditorToolBar(this); - searchPanel = new SearchPanel(this); - outputArea = new JTextArea(); - outputArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, EditorPanel.DEFAULT_FONT)); - outputArea.setEditable(false); - outputArea.setLineWrap(true); - outline = new OutlinePanel(this); - this.scrollableOutline = new JScrollPane(outline); - // scrollableOutline.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - // scrollableOutline.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); - // Set small preferred size, to avoid unnecessary scroll bars - // outline.setPreferredSize(new Dimension(10, 10)); - // outputArea.setColumns(20); - // outputArea.setRows(5); - consolePanel = new javax.swing.JScrollPane(outputArea); - // consolePanel.setPreferredSize(new Dimension(200, 200)); - TextAreaHandler jTextAreaHandler = new TextAreaHandler(outputArea); - SpecsLogs.addHandler(jTextAreaHandler); - - DefaultCaret caret = (DefaultCaret) outputArea.getCaret(); - caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); - - langSpecSideBar = new LanguageSpecificationSideBar(this, weaverEngine.getLanguageSpecificationV2()); - add(menu, BorderLayout.NORTH); - - JPanel centerPanel = new JPanel(new BorderLayout()); - - centerPanel.add(tabsContainer, BorderLayout.CENTER); - - // lsScrollBar = new JScrollPane(langSpecSideBar); - // lsScrollBar = langSpecSideBar; - - centerPanel.add(langSpecSideBar, BorderLayout.EAST); - - tabsConsoleSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, centerPanel, consolePanel); - tabsConsoleSplit.addPropertyChangeListener("dividerLocation", p -> { - // System.out.println("changed: " + p.getNewValue()); - // Only save split factor if the console panel is visible (hiding the console panel makes split factor to be - // almost 1.0 - if (consolePanel.isVisible()) { - // System.out.println("Changing size when console is not visible"); - settings.saveConsoleSplitFactor(getDividerProportion(tabsConsoleSplit)); - } - }); - // splitterConsole.setDividerLocation(this.lasSplitSize); - // splitterConsole.add(centerPanel); - // splitterConsole.add(consolePanel); - // add(splitterConsole, BorderLayout.CENTER); - - explorerOutlineSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT); - explorerOutlineSplit.add(explorer); - explorerOutlineSplit.add(scrollableOutline); - explorerOutlineSplit.addPropertyChangeListener("dividerLocation", p -> { - double dividerProportion = getDividerProportion(explorerOutlineSplit); - settings.saveExplorerOutlineSplitFactor(dividerProportion); - }); - - explorerEditorSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); - explorerEditorSplit.add(explorerOutlineSplit); - explorerEditorSplit.add(tabsConsoleSplit); - explorerEditorSplit.addPropertyChangeListener("dividerLocation", p -> { - // System.out.println("changed: " + p.getNewValue()); - double dividerProportion = getDividerProportion(explorerEditorSplit); - settings.saveExplorerSplitFactor(dividerProportion); - // System.out.println("Exp. SAVE: " + dividerProportion); - }); - - add(explorerEditorSplit, BorderLayout.CENTER); - - add(searchPanel, BorderLayout.SOUTH); - - addFocusListener(new FocusGainedListener(x -> tabsContainer.requestFocus())); - } - - public void setOutputAreaFont(Float size) { - - outputArea.setFont(outputArea.getFont().deriveFont(size)); - settings.saveConsoleFontSize(size); - } - - public void setTabsFont(Float size) { - - tabsContainer.setTabsFont(size); - settings.saveEditorFontSize(size); - } - - @Override - public void enterTab() { - - if (firstEntry) { - firstEntry = false; - loadEditorPreferences(); - } - - optionsDataStore = null; - outputFile = null; - - if (!getData().hasValue(AppKeys.CONFIG_FILE)) { - menu.deativateExecButton(); - return; - } - outputFile = getData().get(AppKeys.CONFIG_FILE); - - optionsDataStore = extractDataStore(outputFile); - - if (optionsDataStore == null) { - menu.deativateExecButton(); - return; - } - menu.ativateExecButton(); - - // DataStore setup = application.getPersistence().loadData(file); - updateProjects(optionsDataStore); - // } - explorer.refreshAllExceptMain(); - - } - - private void loadEditorPreferences() { - - lasSplitSize = settings.loadConsoleSplitFactor(0.75); - tabsConsoleSplit.setDividerLocation(lasSplitSize); - double newSplitFactor = settings.loadExplorerSplitFactor(0.25); - double explorerOutlineSplitFactor = settings.loadExplorerOutlineSplitFactor(0.65); - // System.out.println("Exp. LOAD: " + newSplitFactor); - explorerEditorSplit.setDividerLocation(newSplitFactor); - explorerOutlineSplit.setDividerLocation(explorerOutlineSplitFactor); - boolean showConsole = settings.loadShowConsole(true); - consolePanel.setVisible(showConsole); - boolean showLangSpec = settings.loadShowLangSpec(true); - langSpecSideBar.setVisible(showLangSpec); - float fontSize = settings.loadEditorFontSize(DEFAULT_FONT); - setTabsFont(fontSize); - menu.setSelectedEditorFont(fontSize); - fontSize = settings.loadConsoleFontSize(DEFAULT_FONT); - setOutputAreaFont(fontSize); - menu.setSelectedConsoleFont(fontSize); - - String openedFiles = settings.loadOpenedFiles(); - if (!openedFiles.isEmpty()) { - String[] split = SpecsIo.splitPaths(openedFiles); - for (String fileName : split) { - File file = new File(fileName); - if (file.exists()) { - tabsContainer.open(file); - } - } - } - revalidate(); - } - - // - // private void loadEditorProperties() { - // if (optionsDataStore.hasValue(EditorKeys.splitSize)) { - // Double proportionalLocation = optionsDataStore.get(EditorKeys.splitSize); - // System.out.println("LAST: " + proportionalLocation); - // splitterConsole.setDividerLocation(proportionalLocation); - // // System.out.println("SPLIT: " + proportionalLocation); - // } else { - // if (init) { - // splitterConsole.setDividerLocation(lasSplitSize); - // init = false; - // } - // } - // - // if (optionsDataStore.hasValue(EditorKeys.isBarShown)) { - // lsScrollBar.setVisible(optionsDataStore.get(EditorKeys.isBarShown)); - // revalidate(); - // } - // if (optionsDataStore.hasValue(EditorKeys.isOutputShown)) { - // lsScrollBar.setVisible(optionsDataStore.get(EditorKeys.isOutputShown)); - // revalidate(); - // } - // } - - private DataStore extractDataStore(File file) { - - if (!file.isFile()) { - SpecsLogs.getLogger().warning("Configuration file does not exist: '" + file + "'"); - return null; - } - try { - - return persistence.loadData(file); - } catch (Exception e) { - SpecsLogs - .msgWarn("Configuration file '" + file + "' is not a compatible options file: " + e.getMessage()); - - } - return null; - } - - private void updateProjects(DataStore dataStore) { - - if (dataStore.hasValue(LaraiKeys.LARA_FILE)) { - File inFile = dataStore.get(LaraiKeys.LARA_FILE); - File newCanonFile = SpecsIo.getCanonicalFile(inFile); - // System.out.println("Options Lara file: " + inFile + "(" + newCanonFile + ")"); - if (canonicalAspectFile != null - && SpecsIo.getCanonicalPath(newCanonFile).equals(SpecsIo.getCanonicalPath(canonicalAspectFile))) { - return; // It is still the same file so we do not want to update - } - tabsContainer.loadMainAspectFile(newCanonFile); - canonicalAspectFile = newCanonFile; - } else { - // System.out.println("Options data store has no lara file"); - } - - if (dataStore.hasValue(LaraiKeys.WORKSPACE_FOLDER)) { - FileList inFile = dataStore.get(LaraiKeys.WORKSPACE_FOLDER); - - // System.out.println("Options Lara file: " + inFile + "(" + newCanonFile + ")"); - // if (canonicalAspectFile != null - // && IoUtils.getCanonicalPath(newCanonFile).equals(IoUtils.getCanonicalPath(canonicalAspectFile))) { - // return; // It is still the same file so we do not want to update - // } - - // TODO: Add WORKSPACE_EXTRA - explorer.setWorkspaces(inFile); - } - if (dataStore.hasValue(LaraiKeys.OUTPUT_FOLDER)) { - File outputDir = dataStore.get(LaraiKeys.OUTPUT_FOLDER); - explorer.setOutputDir(outputDir); - } - } - - @Override - public void exitTab() { - - if (outputFile == null || optionsDataStore == null) { - MainLaraTab mainTab = tabsContainer.getMainTab(); - if (!mainTab.isNew()) { - File laraFile = mainTab.getLaraFile(); - canonicalAspectFile = SpecsIo.getCanonicalFile(laraFile); - } - return; - } - - // saveEditorPreferences(); - updateDataStore(); - } - - // private void saveEditorPreferences() { - // String appName = getAppName(); - // double lasSplitSize = getDividerProportion(); - // Preferences.userRoot().putDouble(CONSOLE_SPLIT_FACTOR_PREFIX + appName, lasSplitSize); - // } - - private String getAppName() { - return getData().get(TabbedPane.getAppNameKey()); - } - - public void updateDataStore() { - // saveEditorProperties(); - - MainLaraTab mainTab = tabsContainer.getMainTab(); - if (mainTab.isNew()) { - return; // Do nothing - } - File laraFile = mainTab.getLaraFile(); - File canonFile = SpecsIo.getCanonicalFile(laraFile); - - if (canonicalAspectFile == null - || SpecsIo.getCanonicalPath(canonFile).equals(SpecsIo.getCanonicalPath(canonicalAspectFile))) { - return; - } - canonicalAspectFile = canonFile; - optionsDataStore.setRaw(LaraiKeys.LARA_FILE, canonicalAspectFile); - - persistence.saveData(outputFile, optionsDataStore); - - } - - // private void saveEditorProperties() { - // optionsDataStore.setRaw(EditorKeys.splitSize, getDividerProportion()); - // optionsDataStore.setRaw(EditorKeys.isBarShown, langSpecSideBar.isVisible()); - // optionsDataStore.setRaw(EditorKeys.isOutputShown, outputArea.isVisible()); - // } - - // public double getConsoleDividerProportion() { - // return getDividerProportion(splitterConsole); - // } - // - // public double getConsoleDividerProportion() { - // return getDividerProportion(splitterConsole); - // } - - public double getDividerProportion(JSplitPane splitter) { - int orientation = splitter.getOrientation(); - int location = splitter.getDividerLocation(); - if (orientation == JSplitPane.HORIZONTAL_SPLIT) { - int width = splitter.getWidth(); - int divSize = splitter.getDividerSize(); - return location / (double) (width - divSize); - } - int height = splitter.getHeight(); - int divSize = splitter.getDividerSize(); - return location / (double) (height - divSize); - - } - - @Override - public String getTabName() { - return "LARA Editor"; - } - - public TabsContainerPanel getTabsContainer() { - return tabsContainer; - } - - public JScrollPane getConsoleScroll() { - return consolePanel; - } - - public JTextArea getConsoleArea() { - return outputArea; - } - - // public LanguageSpecificationSideBar getLangSpecSideBar() { - // return langSpecSideBar; - // } - - public JComponent getLsScrollBar() { - return langSpecSideBar; - } - - // public double getLasSplitSize() { - // return lasSplitSize; - // } - - // public void setLasSplitSize(double lasSplitSize) { - // this.lasSplitSize = lasSplitSize; - // } - - // public JSplitPane getSplitter() { - // return splitterConsole; - // } - - public void swapConsoleVisibility() { - // consolePanel.setVisible(!consolePanel.isVisible()); - if (consolePanel.isVisible()) { - lasSplitSize = getDividerProportion(tabsConsoleSplit); - consolePanel.setVisible(false); - } else { - consolePanel.setVisible(true); - tabsConsoleSplit.setDividerLocation(lasSplitSize); - } - settings.saveShowConsole(consolePanel.isVisible()); - // Preferences.userRoot().putBoolean(getShowConsoleSetting(), consolePanel.isVisible()); - revalidate(); - } - - public SearchPanel getSearchPanel() { - return searchPanel; - } - - public Explorer getExplorer() { - return explorer; - } - - public void setExplorer(Explorer explorer) { - this.explorer = explorer; - } - - public void execute() { - - getConsoleArea().setText(""); - if (optionsDataStore == null) { - JOptionPane.showMessageDialog(this, EditorToolBar.NO_CONFIG_MESSAGE); - return; - } - - boolean success = getTabsContainer().askSave(); - if (!success) { - return; - } - - updateDataStore(); - runDebug = false; - worker.execute(optionsDataStore); - } - - public void test() { - - getConsoleArea().setText(""); - if (optionsDataStore == null) { - JOptionPane.showMessageDialog(this, EditorToolBar.NO_CONFIG_MESSAGE); - return; - } - - boolean success = getTabsContainer().askSave(); - if (!success) { - return; - } - - updateDataStore(); - runDebug = false; - - // Build DataStore for testing - DataStore testOptions = DataStore.newInstance("Unit testing options"); - testOptions.addAll(optionsDataStore); - testOptions.add(LaraiKeys.UNIT_TEST_MODE, true); - - worker.execute(testOptions); - } - - public void runDebug() { - - getConsoleArea().setText(""); - if (optionsDataStore == null) { - JOptionPane.showMessageDialog(this, EditorToolBar.NO_CONFIG_MESSAGE); - return; - } - - boolean success = getTabsContainer().askSave(); - if (!success) { - return; - } - - updateDataStore(); - // boolean originalDebug = optionsDataStore.get(LaraiKeys.DEBUG_MODE); - // VerboseLevel originalVerbose = optionsDataStore.get(LaraiKeys.VERBOSE); - // System.out.println(optionsDataStore); - - DataStore tempDS = DataStore.newInstance( - optionsDataStore.getStoreDefinitionTry().map(sd -> sd.getName()).orElse(optionsDataStore.getName()), - optionsDataStore); - tempDS.setRaw(LaraiKeys.DEBUG_MODE, true); - tempDS.setRaw(LaraiKeys.TRACE_MODE, true); - tempDS.setRaw(LaraiKeys.VERBOSE, VerboseLevel.all); - runDebug = true; - executeLARA(tempDS); - - } - - private void executeLARA(DataStore setup) { - worker.execute(setup); - } - - public void cancelExecution() { - worker.shutdown(); - } - - public void setPlayButton() { - menu.setPlay2(); - } - - public void setStopButton() { - if (runDebug) { - menu.setStopDebug(); - } else { - menu.setStopRun(); - } - } - - public SettingsManager getSettings() { - return settings; - } - - public void updateOpenedFiles(String openedFiles) { - settings.saveOpenedFiles(openedFiles); - } - - public boolean closingProgram() { - boolean saved = getTabsContainer().saveAllForClose(); - return saved; - } - - public OutlinePanel getOutline() { - // public JComponent getOutline() { - return outline; - } - - public AppPersistence getPersistence() { - return persistence; - } - - public Collection getCustomWeaverOptions() { - return customWeaverOptions; - } -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/TextEditorDemo.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/TextEditorDemo.java deleted file mode 100644 index 127b279df..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/TextEditorDemo.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.lara.interpreter.joptions.panels.editor; - -import java.awt.Dimension; -import java.awt.event.WindowEvent; -import java.awt.event.WindowFocusListener; - -import javax.swing.JFrame; -import javax.swing.SwingUtilities; -import javax.swing.UIManager; - -import org.lara.interpreter.joptions.panels.editor.tabbed.TabsContainerPanel; - -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -public class TextEditorDemo extends JFrame { - - /** - * - */ - private static final long serialVersionUID = 1L; - public static final String LARA_STYLE_KEY = "text/lara"; - - // private final List textAreas; - private final TabsContainerPanel tabbedPane; - - public TextEditorDemo() { - tabbedPane = new TabsContainerPanel(null); - setPreferredSize(new Dimension(600, 400)); - setContentPane(tabbedPane); - setTitle("Text Editor Demo"); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - - addWindowFocusListener(new WindowFocusListener() { - @Override - public void windowGainedFocus(WindowEvent e) { - tabbedPane.getCurrentTab().refresh(); - } - - @Override - public void windowLostFocus(WindowEvent e) { - - } - }); - pack(); - setLocationRelativeTo(null); - - } - - public static void main(String[] args) throws Exception { - UIManager.setLookAndFeel( - UIManager.getSystemLookAndFeelClassName()); - // Start all Swing applications on the EDT. - SwingUtilities.invokeLater(() -> new TextEditorDemo().setVisible(true)); - } - -} \ No newline at end of file diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/ButtonTabComponent.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/ButtonTabComponent.java deleted file mode 100644 index 59520a808..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/ButtonTabComponent.java +++ /dev/null @@ -1,139 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.components; - -import java.awt.Component; -import java.awt.FlowLayout; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; - -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTabbedPane; -import javax.swing.SwingUtilities; - -import org.lara.interpreter.joptions.panels.editor.listeners.FocusGainedListener; -import org.lara.interpreter.joptions.panels.editor.tabbed.SourceTextArea; - -public class ButtonTabComponent extends JPanel { - /** - * - */ - private static final long serialVersionUID = 1L; - // private final EditorTab tab; - private final JLabel label; - - public ButtonTabComponent(final SourceTextArea tab) { - // unset default FlowLayout' gaps - super(new FlowLayout(FlowLayout.LEFT, 0, 0)); - if (tab == null) { - throw new NullPointerException("TabbedPane is null"); - } - // this.tab = tab; - setOpaque(false); - - // make JLabel read titles from JTabbedPane - label = new JLabel(tab.getTextArea().getFileName()); - add(label); - - label.addFocusListener(new FocusGainedListener(e -> tab.requestFocus())); - - label.addMouseListener(new MouseListener() { - - @Override - public void mouseReleased(MouseEvent e) { - dispatch(e); - Component parent = ButtonTabComponent.this; - - do { - // System.out.println(parent.getClass()); - parent = parent.getParent(); - } while (parent != null); - } - - private void dispatch(MouseEvent e) { - JTabbedPane ancestorOfClass = (JTabbedPane) SwingUtilities.getAncestorOfClass(JTabbedPane.class, - ButtonTabComponent.this); - ancestorOfClass.dispatchEvent(e); - } - - @Override - public void mousePressed(MouseEvent e) { - dispatch(e); - } - - @Override - public void mouseExited(MouseEvent e) { - dispatch(e); - } - - @Override - public void mouseEntered(MouseEvent e) { - dispatch(e); - } - - @Override - public void mouseClicked(MouseEvent e) { - dispatch(e); - } - }); - - /*label.addMouseListener(TabbedContextMenu.newMouseAdapter(tab.getTabbedParent())); - label.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent e) { - - switch (e.getButton()) { - case MouseEvent.BUTTON1: - doFocus(e); - break; - default: - break; - } - } - - @Override - public void mouseReleased(MouseEvent e) { - switch (e.getButton()) { - case MouseEvent.BUTTON2: - tab.close(); - break; - default: - break; - } - } - - private void doFocus(MouseEvent e) { - tab.getTabbedParent().moveTab(tab); - - } - - }); - */ - // add more space between the label and the button - label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); - // tab button - JButton button = new CloseButton(x -> tab.close()); - add(button); - // add more space to the top of the component - setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); - } - - public void setTitle(String title) { - label.setText(title); - } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/CloseButton.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/CloseButton.java deleted file mode 100644 index 569f8c1d4..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/CloseButton.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.components; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.util.function.Consumer; - -import javax.swing.AbstractButton; -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.plaf.basic.BasicButtonUI; - -public class CloseButton extends JButton implements ActionListener { - /** - * - */ - private static final long serialVersionUID = 1L; - private final Consumer listener; - - public CloseButton(Consumer listener) { - int size = 17; - this.listener = listener; - setPreferredSize(new Dimension(size, size)); - setToolTipText("Close this tab"); - // Make the button looks the same for all Laf's - setUI(new BasicButtonUI()); - // Make it transparent - setContentAreaFilled(false); - // No need to be focusable - setFocusable(false); - setBorder(BorderFactory.createEtchedBorder()); - setBorderPainted(false); - // Making nice rollover effect - // we use the same listener for all buttons - addMouseListener(buttonMouseListener); - setRolloverEnabled(true); - // Close the proper tab by clicking the button - addActionListener(this); - } - - @Override - public void actionPerformed(ActionEvent e) { - listener.accept(e); - } - - // we don't want to update UI for this button - @Override - public void updateUI() { - } - - // paint the cross - @Override - protected void paintComponent(Graphics g) { - super.paintComponent(g); - Graphics2D g2 = (Graphics2D) g.create(); - // shift the image for pressed buttons - if (getModel().isPressed()) { - g2.translate(1, 1); - } - g2.setStroke(new BasicStroke(2)); - g2.setColor(Color.BLACK); - if (getModel().isRollover()) { - g2.setColor(Color.BLACK); - } - int delta = 6; - g2.drawLine(delta, delta, getWidth() - delta - 1, getHeight() - delta - 1); - g2.drawLine(getWidth() - delta - 1, delta, delta, getHeight() - delta - 1); - g2.dispose(); - } - - private final static MouseListener buttonMouseListener = new MouseAdapter() { - @Override - public void mouseEntered(MouseEvent e) { - Component component = e.getComponent(); - if (component instanceof AbstractButton) { - AbstractButton button = (AbstractButton) component; - button.setBorderPainted(true); - } - } - - @Override - public void mouseExited(MouseEvent e) { - Component component = e.getComponent(); - if (component instanceof AbstractButton) { - AbstractButton button = (AbstractButton) component; - button.setBorderPainted(false); - } - } - }; -} \ No newline at end of file diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/DevUtils.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/DevUtils.java deleted file mode 100644 index 9425dc45a..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/DevUtils.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.components; - -import java.io.File; -import java.util.HashMap; -import java.util.Map; - -import tdrc.utils.Pair; -import tdrc.utils.PairList; - -public final class DevUtils { - - final static PairList DEV_PROJECTS = new PairList<>(); - final static Map> PROJECT_EXPAND = new HashMap<>(); - - public static void addDevProject(File f, String comment, boolean expand, boolean closeable) { - DevUtils.DEV_PROJECTS.add(f, comment); - DevUtils.PROJECT_EXPAND.put(f, Pair.newInstance(expand, closeable)); - } - - public static void getDevProjects(Explorer explorer) { - - for (Pair project : DevUtils.DEV_PROJECTS) { - File left = project.getLeft(); - if (left.exists()) { - Pair pair = DevUtils.PROJECT_EXPAND.get(left); - explorer.addProject(left, project.getRight(), - pair.getLeft(), pair.getRight()); - } - } - - } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/DontAskMeAgainPanel.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/DontAskMeAgainPanel.java deleted file mode 100644 index b2ac53be0..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/DontAskMeAgainPanel.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.components; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.FlowLayout; -import java.util.function.Consumer; -import java.util.prefs.Preferences; - -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; - -public class DontAskMeAgainPanel extends JPanel { - - /** - * - */ - private static final long serialVersionUID = -4536122924262111427L; - - private JCheckBox dontAskMeAgain; - - public DontAskMeAgainPanel(Object message) { - setLayout(new BorderLayout()); - if (message instanceof Component) { - add((Component) message); - } else if (message != null) { - add(new JLabel(message.toString())); - } - dontAskMeAgain = new JCheckBox("Don't ask me again"); - JPanel panel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - panel.add(dontAskMeAgain); - add(panel, BorderLayout.SOUTH); - } - - public boolean dontAskMeAgain() { - return dontAskMeAgain.isSelected(); - } - - // private static Properties settings; - - // protected static void loadProperties() { - // if (settings != null) { - // settings = new Properties(); - // File source = new File("..."); - // if (source.exists()) { - // try (Reader r = new FileReader(source)) { - // settings.load(r); - // } catch (IOException exp) { - // exp.printStackTrace(); - // } - // } - // } - // } - // - // String askSaveSetting = getEditor().getEditorPanel().getAskSaveSetting(); - // boolean askSave = true; - // try { - // askSave = !Preferences.userRoot().nodeExists(askSaveSetting); - // } catch (BackingStoreException e) { - // SpecsLogs.warn("Could not get 'ask to save' setting:\n", e); - // } - // if (askSave) { - // for (int i = 0; i < tabbedPane.getTabCount(); i++) { - // - // SourceTextArea editorTab = getTab(i); - // boolean success = editorTab.askSave(); - // if (!success) { - // return false; - // } - // } - // return true; - // } - // boolean save = Preferences.userRoot().getBoolean(askSaveSetting, true); - // if (save) { - // for (int i = 0; i < tabbedPane.getTabCount(); i++) { - // SourceTextArea editorTab = getTab(i); - // boolean wasSaved = editorTab.save(); - // if (!wasSaved) { - // SpecsLogs.warn("Could not save file " + editorTab.getLaraFile()); - // } - // } - // return true; - // } - - protected static void saveProperties(String prefKey, int result) { - // if (settings != null) { - // settings = new Properties(); - // File source = new File("..."); - // try (Writer w = new FileWriter(source)) { - // settings.store(w, "Don't prompt for settings"); - // } catch (IOException exp) { - // exp.printStackTrace(); - // } - // } - Preferences.userRoot().putInt(prefKey, result); - } - - public static int showConfirmDialog(Component parent, Object message, String title, int optionType, - Consumer saveProperty) { - - // if (result != NO_VALUE) { - // return result; - // } - int result = JOptionPane.NO_OPTION; - - // if (settings.containsKey(key + ".prompt") && !Boolean.parseBoolean(settings.getProperty(key + ".value"))) { - // result = Integer.parseInt(settings.getProperty(key + ".value")); - // } else { - DontAskMeAgainPanel panel = new DontAskMeAgainPanel(message); - result = JOptionPane.showConfirmDialog(parent, panel, title, optionType); - if (panel.dontAskMeAgain() && (result != JOptionPane.CANCEL_OPTION && result != JOptionPane.CLOSED_OPTION)) { - // settings.put(key + ".prompt", "false"); - // settings.put(key + ".value", Integer.toString(result)); - saveProperty.accept(result); - // saveProperties(key, result); - // } - } - return result; - } -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/EditorToolBar.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/EditorToolBar.java deleted file mode 100644 index a60b46cc2..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/EditorToolBar.java +++ /dev/null @@ -1,487 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.components; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Image; -import java.awt.event.ActionEvent; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyEvent; -import java.io.File; -import java.util.function.Consumer; - -import javax.imageio.ImageIO; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JTextArea; -import javax.swing.JToolBar; -import javax.swing.KeyStroke; - -import org.fife.ui.rtextarea.RTextArea; -import org.fife.ui.rtextarea.SearchContext; -import org.fife.ui.rtextarea.SearchEngine; -import org.lara.interpreter.cli.LaraCli; -import org.lara.interpreter.joptions.panels.editor.EditorPanel; -import org.lara.interpreter.joptions.panels.editor.listeners.FocusGainedListener; -import org.lara.interpreter.joptions.panels.editor.listeners.StrokesAndActions; -import org.lara.interpreter.joptions.panels.editor.tabbed.SourceTextArea; -import org.lara.interpreter.joptions.panels.editor.tabbed.TabsContainerPanel; -import org.suikasoft.jOptions.Interfaces.DataStore; -import org.suikasoft.jOptions.gui.panels.app.AppKeys; - -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.swing.GenericActionListener; -import pt.up.fe.specs.util.utilities.heapwindow.HeapBar; - -public class EditorToolBar extends JPanel { - - private static final String RUN_LARA_IN_DEBUG_MODE_TEXT = "Run LARA in debug mode"; - private static final String DEBUG_LARA_TEXT = "Debug LARA"; - private static final String RUN_LARA_TEXT = "Run LARA"; - private static final String TEST_LARA_TEXT = "Test LARA"; - /** - * - */ - private static final long serialVersionUID = 1L; - public static final String NO_CONFIG_MESSAGE = "Please open a configuration file in 'Program' tab or save into a new configuration in 'Options' tab"; - private final EditorPanel editor; - - // private final JToolBar menuBar; - - private final JToolBar toolBar; - - private JButton execButton; - private boolean running; - private JButton debugButton; - private JButton testButton; - private JComboBox editorCombo; - private JComboBox consoleCombo; - private HeapBar heapBar; - - public EditorToolBar(EditorPanel editorPanel) { - // super(new FlowLayout(FlowLayout.LEFT)); - super(new BorderLayout()); - - // FlowLayout leftArea = new FlowLayout(FlowLayout.LEFT); - // setBackground(Colors.BLUE_GREY); - editor = editorPanel; - // menuBar = new JToolBar(); - // add(menuBar); - toolBar = newLeftToolBar("Tool Bar"); - // toolBar.setBackground(Colors.BLUE_GREY); - addFileButtons(); - toolBar.addSeparator(); - addSearchButtons(); - toolBar.addSeparator(); - addRunButtons(); - toolBar.addSeparator(); - addFontControls(); - - addFocusListener(new FocusGainedListener(e -> getCurrentTab().requestFocus())); - add(new JLabel(), BorderLayout.CENTER); - heapBar = new HeapBar(); - add(heapBar, BorderLayout.EAST); - heapBar.run(); - } - - private void addFontControls() { - - Integer[] values = { 10, 12, 14, 16, 18, 20 }; - - editorCombo = addSizeCombo(values, 12, "Editor Font Size", " Editor Font Size ", editor::setTabsFont); - - consoleCombo = addSizeCombo(values, EditorPanel.DEFAULT_FONT, "Output Font Size", " Output Font Size ", - editor::setOutputAreaFont); - - } - - public void setSelectedEditorFont(float value) { - editorCombo.setSelectedItem((int) value); - // editorCombo.revalidate(); - // editorCombo.repaint(); - } - - public void setSelectedConsoleFont(float value) { - consoleCombo.setSelectedItem((int) value); - // consoleCombo.revalidate(); - // consoleCombo.repaint(); - } - - /** - * @return - * @return - */ - private JComboBox addSizeCombo(Integer[] values, int defaultValue, String tooltip, String label, - Consumer c) { - - JLabel sizeLabel = new JLabel(label); - toolBar.add(sizeLabel); - - JComboBox combo = new JComboBox<>(values); - - combo.setSelectedItem(defaultValue); - combo.setPreferredSize(new Dimension(60, 25)); - combo.setToolTipText(tooltip); - - combo.addItemListener(new ItemListener() { - - @Override - public void itemStateChanged(ItemEvent e) { - - if (e.getStateChange() == ItemEvent.SELECTED) { - - Float value = Float.parseFloat(e.getItem().toString()); - - c.accept(value); - } - } - }); - - toolBar.add(combo); - return combo; - } - - private JToolBar newLeftToolBar(String name) { - JToolBar toolBar = new JToolBar(name); - // toolBar.setLayout(new FlowLayout(FlowLayout.LEFT)); - toolBar.setFloatable(false); - - add(toolBar, BorderLayout.WEST); - return toolBar; - } - - private void addFileButtons() { - - addNewItem("New", "new", KeyEvent.VK_N, StrokesAndActions.CTRL_N, o -> getTabsContainer().addTab()); - - addNewItem("Open File", "open", KeyEvent.VK_O, StrokesAndActions.CTRL_O, o -> getTabsContainer().open()); - addNewItem("Open Main Lara File", "open_lara", KeyEvent.VK_T, StrokesAndActions.CTRL_M, - o -> getTabsContainer().openMain()); - - toolBar.addSeparator(); - - addNewItem("Close", "close", KeyEvent.VK_W, StrokesAndActions.CTRL_W, - o -> getCurrentTab().close()); - addNewItem("Close All", "close_all", 0, StrokesAndActions.CTRL_SHIFT_W, - o -> getTabsContainer().closeAll()); - - toolBar.addSeparator(); - - addNewItem("Save", "save", KeyEvent.VK_S, StrokesAndActions.CTRL_S, - o -> getCurrentTab().save()); - addNewItem("Save As", "save_as", 0, null, - o -> getCurrentTab().saveAs()); - addNewItem("Save All", "save_all", KeyEvent.VK_A, StrokesAndActions.CTRL_SHIFT_S, - o -> editor.getTabsContainer().saveAll()); - - // newItem( "Comment", "comment", 0, StrokesAndActions.CTRL_SHIFT_C, getCurrentTab()::commentSelection); - - // newItem(file, "Refresh", KeyEvent.VK_R, StrokesAndActions.F5, - // o -> getCurrentTab().refresh()); - - } - - private void addSearchButtons() { - addNewItem("Find", "find", 0, StrokesAndActions.CTRL_F, a -> editor.getSearchPanel().getFocus()); - addNewItem("Clear Markup", "mark", 0, StrokesAndActions.CTRL_SHIFT_M, - a -> { - RTextArea textArea = getCurrentTab().getTextArea(); - - SearchEngine.find(textArea, new SearchContext()); - }); - } - - private void addRunButtons() { - addExecButton(); - addDebugButton(); - addTestButton(); - addNewItem("Clear Console", "clear", 0, null, o -> editor.getConsoleArea().setText("")); - addNewItem("Show/Hide Console", "console", 0, StrokesAndActions.CTRL_SHIFT_O, - o -> editor.swapConsoleVisibility()); - addNewItem("Show/Hide Language Specification Bar", "sidebar", 0, StrokesAndActions.CTRL_SHIFT_B, - o -> showLS()); - addNewItem("Show Equivalent Command-Line", "command_prompt", 0, StrokesAndActions.CTRL_SHIFT_C, - o -> showCLI()); - } - - private void showLS() { - JComponent sideBar = editor.getLsScrollBar(); - sideBar.setVisible(!sideBar.isVisible()); - editor.getSettings().saveShowLangSpec(sideBar.isVisible()); - // Preferences.userRoot().putBoolean(editor.getShowLangSpecSetting(), sideBar.isVisible()); - // editor.revalidate(); - editor.updateUI(); - } - - private void showCLI() { - // Get config file - File configFile = editor.getData().get(AppKeys.CONFIG_FILE); - - if (configFile == null) { - JOptionPane.showMessageDialog(null, "Config file not defined"); - return; - } - - if (!configFile.isFile()) { - JOptionPane.showMessageDialog(null, "Could not find config file '" + configFile + "'"); - return; - } - - DataStore dataStore = editor.getPersistence().loadData(configFile); - - String string = "clava " + LaraCli.getWeaverOptions(editor.getCustomWeaverOptions()).toCli(dataStore); - - // Show in the console - // editor.getConsoleArea().append(string + "\n"); - - // Show in a dialog - JTextArea text = new JTextArea(string); - text.setEditable(false); - // text.setLineWrap(true); - JOptionPane.showMessageDialog(null, text); - // JOptionPane.showMessageDialog(null, text, "Equivalent Command-Line Arguments", JOptionPane.OK_OPTION); - } - - private JButton addExecButton() { - - execButton = new JButton(); - setIcon(execButton, "run", EditorToolBar.RUN_LARA_TEXT); - // try { - // Image img = ImageIO.read(IoUtils.resourceToStream("larai/resources/img/cancel.gif")); - // execButton.setSelectedIcon(new ImageIcon(img)); - // } catch (Exception ex) { - // } - running = false; - // execButton.setSelected(false); - // execButton.setMnemonic(StrokesAndActions.F11); - - Consumer listener = e -> { - - if (!running) { - // if (execButton.isSelected()) { - editor.execute(); - // setIcon(newItem, "run", "Run LARA"); - } else { - // setIcon(newItem, "cancel", "Cancel"); - editor.cancelExecution(); - - } - }; - execButton.addActionListener(new GenericActionListener(listener)); - String replace = StrokesAndActions.prettyString(StrokesAndActions.F11); - execButton.setToolTipText(EditorToolBar.RUN_LARA_TEXT + " (" + replace + ")"); - execButton.registerKeyboardAction(new GenericActionListener(listener), StrokesAndActions.F11, - JComponent.WHEN_IN_FOCUSED_WINDOW); - // ListenerUtils.mapAction(newItem, stroke, actionName, - // listener); - execButton.addFocusListener(new FocusGainedListener(e -> getCurrentTab().requestFocus())); - toolBar.add(execButton); - return execButton; - } - - private JButton addDebugButton() { - - debugButton = new JButton(); - setIcon(debugButton, "debug", EditorToolBar.DEBUG_LARA_TEXT); - // try { - // Image img = ImageIO.read(IoUtils.resourceToStream("larai/resources/img/cancel.gif")); - // execButton.setSelectedIcon(new ImageIcon(img)); - // } catch (Exception ex) { - // } - running = false; - // execButton.setSelected(false); - // execButton.setMnemonic(StrokesAndActions.F11); - - Consumer listener = e -> { - - if (!running) { - // if (execButton.isSelected()) { - editor.runDebug(); - // setIcon(newItem, "run", "Run LARA"); - } else { - // setIcon(newItem, "cancel", "Cancel"); - editor.cancelExecution(); - } - }; - debugButton.addActionListener(new GenericActionListener(listener)); - String replace = StrokesAndActions.prettyString(StrokesAndActions.CTRL_F11); - debugButton.setToolTipText(EditorToolBar.RUN_LARA_IN_DEBUG_MODE_TEXT + " (" + replace + ")"); - debugButton.registerKeyboardAction(new GenericActionListener(listener), StrokesAndActions.CTRL_F11, - JComponent.WHEN_IN_FOCUSED_WINDOW); - // ListenerUtils.mapAction(newItem, stroke, actionName, - // listener); - debugButton.addFocusListener(new FocusGainedListener(e -> getCurrentTab().requestFocus())); - toolBar.add(debugButton); - return debugButton; - } - - private JButton addTestButton() { - - testButton = new JButton(); - setIcon(testButton, "test", EditorToolBar.RUN_LARA_TEXT); - - running = false; - - Consumer listener = e -> { - - if (!running) { - editor.test(); - ; - } else { - editor.cancelExecution(); - - } - }; - testButton.addActionListener(new GenericActionListener(listener)); - // String replace = StrokesAndActions.prettyString(StrokesAndActions.F11); - // testButton.setToolTipText(EditorToolBar.TEST_LARA_TEXT + " (" + replace + ")"); - testButton.setToolTipText(EditorToolBar.TEST_LARA_TEXT); - // testButton.registerKeyboardAction(new GenericActionListener(listener), StrokesAndActions.F11, - // JComponent.WHEN_IN_FOCUSED_WINDOW); - - testButton.addFocusListener(new FocusGainedListener(e -> getCurrentTab().requestFocus())); - toolBar.add(testButton); - return testButton; - } - - public static void setIcon(JButton execButton2, String icon, String fallbackText) { - try { - Image img = ImageIO.read(SpecsIo.resourceToStream("larai/resources/img/" + icon + ".gif")); - execButton2.setIcon(new ImageIcon(img)); - execButton2.setText(""); - } catch (Exception ex) { - execButton2.setIcon(null); - execButton2.setText(fallbackText); - } - } - - private JButton addNewItem(String toolTip, String icon, int keyEvent, KeyStroke stroke, - Consumer listener) { - - JButton newItem = new JButton(); - try { - Image img = ImageIO.read(SpecsIo.resourceToStream("larai/resources/img/" + icon + ".gif")); - newItem.setIcon(new ImageIcon(img)); - } catch (Exception ex) { - - newItem.setText(toolTip); - } - - // newItem.setMnemonic(keyEvent); - newItem.addActionListener(new GenericActionListener(listener)); - newItem.setToolTipText(toolTip); - if (stroke != null) { - String replace = StrokesAndActions.prettyString(stroke); - newItem.setToolTipText(toolTip + " (" + replace + ")"); - newItem.registerKeyboardAction(new GenericActionListener(listener), stroke, - JComponent.WHEN_IN_FOCUSED_WINDOW); - // ListenerUtils.mapAction(newItem, stroke, actionName, - // listener); - } - newItem.addFocusListener(new FocusGainedListener(e -> getCurrentTab().requestFocus())); - toolBar.add(newItem); - return newItem; - } - - // private void cancel() { - // editor.updateDataStore(); - // TabbedPane tabbedPane = (TabbedPane) SwingUtilities.getAncestorOfClass(TabbedPane.class, editor); - // ProgramPanel program = SearchUtils.findFirstComponentOfType(tabbedPane, ProgramPanel.class); - // System.err.println("TODO CANCEL"); - // System.err.println("Create new worker based on " + ApplicationWorker.class.getCanonicalName()); - // // program.cancel(); - // - // } - - private TabsContainerPanel getTabsContainer() { - return editor.getTabsContainer(); - } - - private SourceTextArea getCurrentTab() { - return getTabsContainer().getCurrentTab(); - } - - public void setExecSelected(boolean bool) { - execButton.setSelected(bool); - } - - public void ativateExecButton() { - if (!execButton.isEnabled()) { - execButton.setEnabled(true); - execButton.setToolTipText(EditorToolBar.RUN_LARA_TEXT); - } - } - - public void deativateExecButton() { - if (execButton.isEnabled()) { - execButton.setEnabled(false); - execButton.setToolTipText(EditorToolBar.NO_CONFIG_MESSAGE); - } - } - - public void setStopRun() { - setIcon(execButton, "cancel", "Terminate"); - execButton.setToolTipText("Terminate"); - execButton.setEnabled(true); - - setIcon(debugButton, "debug", EditorToolBar.DEBUG_LARA_TEXT); - debugButton.setToolTipText(EditorToolBar.RUN_LARA_IN_DEBUG_MODE_TEXT); - debugButton.setEnabled(false); - running = true; - } - - public void setStopDebug() { - setIcon(execButton, "run", EditorToolBar.RUN_LARA_TEXT); - execButton.setToolTipText(EditorToolBar.RUN_LARA_TEXT); - execButton.setEnabled(false); - - setIcon(debugButton, "cancel", "Terminate"); - debugButton.setToolTipText("Terminate"); - debugButton.setEnabled(true); - running = true; - } - - public void setPlay2() { - setIcon(execButton, "run", EditorToolBar.RUN_LARA_TEXT); - execButton.setToolTipText(EditorToolBar.RUN_LARA_TEXT); - execButton.setEnabled(true); - - setIcon(debugButton, "debug", EditorToolBar.DEBUG_LARA_TEXT); - debugButton.setToolTipText(EditorToolBar.RUN_LARA_IN_DEBUG_MODE_TEXT); - debugButton.setEnabled(true); - running = false; - } - - public void setPlay() { - setExecButton("run", EditorToolBar.RUN_LARA_TEXT, false); - } - - public void setStop() { - setExecButton("cancel", "Terminate", true); - } - - public void setExecButton(String icon, String text, boolean isRunning) { - setIcon(execButton, icon, text); - execButton.setToolTipText(text); - running = isRunning; - } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/Explorer.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/Explorer.java deleted file mode 100644 index 89f77b479..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/Explorer.java +++ /dev/null @@ -1,711 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.components; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.KeyEvent; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Enumeration; -import java.util.List; - -import javax.swing.JCheckBox; -import javax.swing.JFileChooser; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.JScrollPane; -import javax.swing.JTextField; -import javax.swing.JTree; -import javax.swing.SwingConstants; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; -import javax.swing.filechooser.FileSystemView; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.MutableTreeNode; -import javax.swing.tree.TreeNode; -import javax.swing.tree.TreePath; - -import org.lara.interpreter.joptions.keys.FileList; -import org.lara.interpreter.joptions.panels.editor.EditorPanel; -import org.lara.interpreter.joptions.panels.editor.listeners.FileTreeCellRenderer; -import org.lara.interpreter.joptions.panels.editor.listeners.GenericKeyListener; -import org.lara.interpreter.joptions.panels.editor.utils.Factory; - -import pt.up.fe.specs.util.SpecsSwing; -import pt.up.fe.specs.util.swing.GenericMouseListener; - -public class Explorer extends JPanel { - - /** - * - */ - private static final long serialVersionUID = 1L; - private final EditorPanel parent; - private final DefaultTreeModel treeModel; - private final JTree tree; - final FileSystemView fileSystemView; - private final DefaultMutableTreeNode root; - private final JPopupMenu popupMenu; - private File lastDirectory; - private WorkDirNode workspaceNode; - private DefaultMutableTreeNode outputNode; - - public Explorer(EditorPanel parent) { - super(new BorderLayout()); - // setBackground(Colors.BLUE_GREY); - this.parent = parent; - fileSystemView = FileSystemView.getFileSystemView(); - // the File tree - root = new DefaultMutableTreeNode("Workspace"); - treeModel = new DefaultTreeModel(root); - - tree = new JTree(treeModel); - initTree(); - JScrollPane treeScroll = new JScrollPane(tree); - // tree.setCellRenderer(new DefaultTreeCellRenderer()); - - popupMenu = new ExplorerPopup(this); - // Dimension preferredSize = treeScroll.getPreferredSize(); - Dimension widePreferred = new Dimension( - 200, - // (int) preferredSize.getHeight()); - 800); - // (int) preferredSize2.height); - treeScroll.setPreferredSize(widePreferred); - add(treeScroll, BorderLayout.CENTER); - lastDirectory = new File("."); - // setMainWorkspace(lastDirectory); - addDefaultProjects(lastDirectory); - - DevUtils.getDevProjects(this); - } - - private void addDefaultProjects(File source) { - addProject(source, "Aspects", true, false); - workspaceNode = new WorkDirNode("Workspace"); - outputNode = new FileNode(new File("Output")); - - root.add(workspaceNode); - root.add(outputNode); - - } - - private void initTree() { - - tree.addKeyListener(new GenericKeyListener().onPressed(e -> { - if (e.getKeyCode() == KeyEvent.VK_F5) { - refresh(); - } - })); - tree.setRootVisible(false); - tree.setEditable(false); - // tree.addTreeSelectionListener(treeSelectionListener); - tree.setCellRenderer(new FileTreeCellRenderer(this)); - tree.expandRow(0); - - tree.setVisibleRowCount(15); - - MouseListener onRelease = GenericMouseListener.click(this::clicked) - .onRelease(this::released); - tree.addMouseListener(onRelease); - tree.addTreeSelectionListener(e -> { - TreePath path = e.getPath(); - Object lastPathComponent = path.getLastPathComponent(); - if (lastPathComponent instanceof FileNode) { - FileNode node = (FileNode) lastPathComponent; - if (node.getFile().isDirectory()) { - if (node.isLeaf()) { - showChildren(node, false, 3); - } else { - updateChildren(node, 3); - } - } - } else if (lastPathComponent instanceof WorkDirNode) { - DefaultMutableTreeNode wdNode = (DefaultMutableTreeNode) lastPathComponent; - for (int i = 0; i < wdNode.getChildCount(); i++) { - updateChildren((FileNode) wdNode.getChildAt(i), 3); - } - } - tree.scrollPathToVisible(path); - }); - - } - - public void setMainWorkspace(File source) { - if (!source.isDirectory()) { - source = source.getParentFile(); - } - setMain(source); - - } - - public void refreshAllExceptMain() { - for (int i = 3; i < root.getChildCount(); i++) { - reload((FileNode) root.getChildAt(i)); - } - } - - public void refreshAll() { - for (int i = 0; i < root.getChildCount(); i++) { - reload((FileNode) root.getChildAt(i)); - } - } - - public void refresh() { - // Enumeration expandedDescendants = tree.getExpandedDescendants(new TreePath(root)); - TreePath[] selectionPaths = tree.getSelectionPaths(); - if (selectionPaths != null) { - for (TreePath treePath : selectionPaths) { - Object lastPathComponent2 = treePath.getLastPathComponent(); - if (lastPathComponent2 instanceof WorkDirNode) { - WorkDirNode wdNode = (WorkDirNode) lastPathComponent2; - for (int i = 0; i < wdNode.getChildCount(); i++) { - reload((FileNode) wdNode.getChildAt(i)); - } - } else { - FileNode lastPathComponent = (FileNode) lastPathComponent2; - reload(lastPathComponent); - } - } - } - // treeModel.nodeStructureChanged(root); // this works - // tree.expandRow(0); // together with this - - // while (expandedDescendants.hasMoreElements()) { - // TreePath path = expandedDescendants.nextElement(); - // tree.expandPath(path); - // } - // tree.setSelectionPaths(selectionPaths); - } - - private void reload(FileNode lastPathComponent) { // for now an update removes all child and adds new - updateChildren(lastPathComponent, 2); - } - - private void setMain(File source) { // this method will only be called when source is guaranteed existent - // if (root.isLeaf()) { - // addProject(source, "Aspects", true, false); - // } else { - FileNode sourceNode = newFileNode(source, "Aspects", false); - - showChildren(sourceNode, true, 2); - FileNode old = (FileNode) root.getChildAt(0); - if (old.getFile().equals(source)) { - return; - } - Enumeration expandedDescendants = tree.getExpandedDescendants(new TreePath(root)); - treeModel.removeNodeFromParent(old); - treeModel.insertNodeInto(sourceNode, root, 0); - treeModel.nodeStructureChanged(root); - TreePath newPath = new TreePath(treeModel.getPathToRoot(sourceNode)); - tree.expandPath(newPath); - - if (expandedDescendants != null) { - while (expandedDescendants.hasMoreElements()) { - TreePath path = expandedDescendants.nextElement(); - - tree.expandPath(path); - } - } - - // } - - } - - private void reloadInserted(int position) { - treeModel.nodesWereInserted(root, new int[] { position }); - } - - private static FileNode newFileNode(File source, String comment) { - return newFileNode(source, comment, true); - } - - private static FileNode newFileNode(File source, String comment, boolean isCloseable) { - - FileNode node = new FileNode(source, comment, isCloseable); - return node; - } - - void addProject(File file, String comment, boolean collapse, boolean isCloseable) { - FileNode fileNode = addFileWithChildren(file, comment, root, collapse, isCloseable, 2); - reloadInserted(root.getChildCount() - 1); - TreeNode[] nodePath = treeModel.getPathToRoot(fileNode); - - TreePath path = new TreePath(nodePath); - tree.expandPath(path); - } - - private FileNode addFileWithChildren(File file, String comment, DefaultMutableTreeNode parent, boolean expand, - boolean isCloseable, - int depth) { - FileNode thisFileNode = addNode(file, comment, parent, isCloseable); - showChildren(thisFileNode, expand, depth); - return thisFileNode; - } - - public FileNode addNode(File file, String comment, DefaultMutableTreeNode parent, boolean isCloseable) { - FileNode thisFileNode = newFileNode(file, comment, isCloseable); - parent.add(thisFileNode); - return thisFileNode; - } - - /** - * Add the files that are contained within the directory of this node. Thanks to Hovercraft Full Of Eels. - */ - private void showChildren(final FileNode node, boolean expand, int depthLevel) { - tree.setEnabled(false); - SwingWorker worker = new SwingWorker() { - @Override - public Void doInBackground() { - File file = node.getFile(); - if (file.isDirectory()) { - - File[] files = fileSystemView.getFiles(file, true); - if (node.isLeaf()) { - for (File child : files) { - publish(child); - } - } - } - return null; - } - - @Override - protected void process(List chunks) { - - for (File child : chunks) { - FileNode newFileNode = newFileNode(child, ""); - if (child.isDirectory() && depthLevel > 1) { - addFileWithChildren(child, "", node, false, true, depthLevel - 1); - } else { - treeModel.insertNodeInto(newFileNode, node, 0); - } - } - } - - @Override - protected void done() { - tree.setEnabled(true); - if (expand) { - TreeNode[] pathToRoot = treeModel.getPathToRoot(node); - - TreePath nodePath = new TreePath(pathToRoot); - tree.expandPath(nodePath); - } - } - - }; - worker.execute(); - - } - - /** - * Update the children of a node - * - * @param depth - */ - private synchronized void updateChildren(final FileNode node, int depth) { - tree.setEnabled(false); - SwingWorker worker = new SwingWorker() { - private final List childrenList = new ArrayList<>(); - - @Override - public Void doInBackground() { - - // if (node.isLeaf()) { - // return null; - // } - - for (int i = 0; i < node.getChildCount(); i++) { - childrenList.add((FileNode) node.getChildAt(i)); - } - - boolean[] exists = new boolean[childrenList.size()]; - File file = node.getFile(); - if (file.isDirectory()) { - - File[] files = fileSystemView.getFiles(file, true); - for (File child : files) { - - for (int i = 0; i < childrenList.size(); i++) { - - File nodeFile = childrenList.get(i).getFile(); - if (nodeFile.equals(child)) { - exists[i] = true; - break; - } - } - - publish(child); - } - - } - for (int i = 0; i < exists.length; i++) { - if (!exists[i]) { - FileNode aNode = childrenList.get(i); - - if (treeModel.getPathToRoot(aNode) != null) { // if is in tree - treeModel.removeNodeFromParent(aNode); - } - } - } - return null; - } - - @Override - protected void process(List chunks) { - - for (File child : chunks) { - FileNode childNode = getNode(child); - if (childNode == null) { - // if (depth > 1) { - // addFileWithChildren(child, "", node, false, depth - 1); - // } else { - // treeModel.insertNodeInto(newFileNode(child, ""), node, node.getChildCount()); - treeModel.insertNodeInto(newFileNode(child, ""), node, 0); - // System.out.println("Adding: " + child); - // } - } - // else { - // updateChildren(childNode, depth - 1); - // } - } - } - - /** - * If contains file will remove the node from the list - * - * @param file - * @return - */ - private FileNode getNode(File file) { - - for (FileNode child : childrenList) { - - File nodeFile = child.getFile(); - if (nodeFile.equals(file)) { - return child; - } - } - return null; - } - - @Override - protected void done() { - - tree.setEnabled(true); - } - - }; - worker.execute(); - - } - - private void released(MouseEvent e) { - if (SwingUtilities.isRightMouseButton(e)) { - TreePath selPath = tree.getPathForLocation(e.getX(), e.getY()); - if (selPath != null) { - if (!tree.isPathSelected(selPath)) { - if (!e.isControlDown() && !e.isShiftDown()) { - tree.setSelectionPath(selPath); - } - } - - } - popupMenu.show(e.getComponent(), e.getX(), e.getY()); - } - return; - - } - - private void clicked(MouseEvent e) { - if (SwingUtilities.isRightMouseButton(e)) { - - return; - } - - TreePath selPath = tree.getPathForLocation(e.getX(), e.getY()); - if (selPath == null) { - return; - } - if (e.getButton() == MouseEvent.BUTTON1) { - - switch (e.getClickCount()) { - case 1: // This case is to control the situation in which the popup steals focus and clicking in the - // explorer it does nothing! - if (e.isControlDown()) { - tree.addSelectionPath(selPath); - } else if (e.isShiftDown()) { - - } else { - tree.setSelectionPath(selPath); - } - break; - case 2: - if (selPath.getLastPathComponent() instanceof FileNode) { - FileNode lastPathComponent = (FileNode) selPath - .getLastPathComponent(); - File userObject = lastPathComponent.getFile(); - if (!userObject.isDirectory()) { - parent.getTabsContainer().open(userObject); - } - } - break; - default: - break; - } - } - } - - public EditorPanel getEditorPanel() { - return parent; - } - - public void open(ActionEvent e) { - TreePath[] selectionPaths = tree.getSelectionPaths(); - if (selectionPaths == null) { - JOptionPane.showMessageDialog(parent, "Please first select a file to open."); - return; - } - for (TreePath treePath : selectionPaths) { - File file = getFile(treePath); - if (file != null) { - if (file.isDirectory()) { - tree.expandPath(treePath); - } else { - parent.getTabsContainer().open(file); - } - } - } - } - - public void openMainLara(ActionEvent e) { - TreePath[] selectionPaths = tree.getSelectionPaths(); - if (selectionPaths == null) { - JOptionPane.showMessageDialog(parent, "Please first select a file to open."); - return; - } - if (selectionPaths.length > 1) { - JOptionPane.showMessageDialog(parent, "Only one file can be opened."); - return; - } - TreePath treePath = selectionPaths[0]; - FileNode node = (FileNode) treePath.getLastPathComponent(); - parent.getTabsContainer().loadMainAspectFile(node.getFile()); - - } - - public void openInSystemExplorer(ActionEvent e) { - TreePath[] selectionPaths = tree.getSelectionPaths(); - if (selectionPaths == null) { - JOptionPane.showMessageDialog(parent, "Please first select a file to open."); - return; - } - for (TreePath treePath : selectionPaths) { - File file = getFile(treePath); - if (file != null) { - SpecsSwing.browseFileDirectory(file); - } - } - - } - - public void newProject(ActionEvent e) { - JFileChooser fc = Factory.newFileChooser("Open Project", JFileChooser.DIRECTORIES_ONLY, "Open", - Collections.emptyList(), lastDirectory); - - JPanel allPanel = new JPanel(); - allPanel.setPreferredSize(new Dimension(200, 300)); - allPanel.add(new JLabel("Properties", SwingConstants.CENTER), BorderLayout.NORTH); - - GridLayout layout = new GridLayout(2, 2); - JPanel contentPanel = new JPanel(layout); - contentPanel.add(new JLabel("Description: ", SwingConstants.TRAILING)); - JTextField descText = new JTextField(); - descText.setPreferredSize(new Dimension(100, 20)); - contentPanel.add(descText); - - contentPanel.add(new JLabel("Expand: ", SwingConstants.TRAILING)); - JCheckBox expand = new JCheckBox(); - expand.setSelected(true); - contentPanel.add(expand); - - allPanel.add(contentPanel, BorderLayout.CENTER); - fc.setAccessory(allPanel); - - int returnVal = fc.showOpenDialog(parent); - - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - String comment = descText.getText().trim(); - if (comment.isEmpty()) { - comment = file.getAbsolutePath(); - } - addProject(file, comment, expand.isSelected(), true); - lastDirectory = file; - } - } - - public void removeProject(ActionEvent e) { - - TreePath[] selectionPaths = tree.getSelectionPaths(); - if (selectionPaths == null) { - return; - } - for (TreePath treePath : selectionPaths) { - Object pathComponent2 = treePath.getPathComponent(1); - if (pathComponent2 instanceof WorkDirNode) { - - JOptionPane.showMessageDialog(parent, "The project is protected and cannot be closed."); - continue; - } - FileNode pathComponent = (FileNode) pathComponent2; - if (pathComponent.isCloseable()) { - - treeModel.removeNodeFromParent(pathComponent); - } else { - - JOptionPane.showMessageDialog(parent, "The project is protected and cannot be closed."); - } - // } - } - - } - - public void expand(ActionEvent e) { - TreePath[] selectionPaths = tree.getSelectionPaths(); - if (selectionPaths == null) { - return; - } - for (TreePath treePath : selectionPaths) { - tree.expandPath(treePath); - } - } - - public void collapse(ActionEvent e) { - TreePath[] selectionPaths = tree.getSelectionPaths(); - if (selectionPaths == null) { - return; - } - for (TreePath treePath : selectionPaths) { - tree.collapsePath(treePath); - } - } - - private static File getFile(TreePath path) { - Object lastPathComponent = path.getLastPathComponent(); - if (lastPathComponent == null || !(lastPathComponent instanceof FileNode)) { - return null; - } - FileNode node = (FileNode) lastPathComponent; - return node.getFile(); - } - - public FileSystemView getFileSystemView() { - return fileSystemView; - } - - // public void setTargetWorkspaces(FileList inFile) { - // - // } - - // public void setOutputDir(File outputDir) { - // root.insert(outputNode, 2); - // reloadInserted(2); - // TreeNode childAt = root.getChildAt(2); - // System.out.println("Replaced with " + outputDir + " result: " + childAt); - // } - - public void setOutputDir(File source) { // this method will only be called when source is guaranteed existent - // if (root.isLeaf()) { - // addProject(source, "Aspects", true, false); - // } else { - FileNode sourceNode = newFileNode(source, "Output", false); - - showChildren(sourceNode, true, 2); - FileNode old = (FileNode) root.getChildAt(2); - if (old.getFile().equals(source)) { - return; - } - Enumeration expandedDescendants = tree.getExpandedDescendants(new TreePath(root)); - treeModel.removeNodeFromParent(old); - treeModel.insertNodeInto(sourceNode, root, 2); - treeModel.nodeStructureChanged(root); - TreePath newPath = new TreePath(treeModel.getPathToRoot(sourceNode)); - tree.expandPath(newPath); - - if (expandedDescendants != null) { - while (expandedDescendants.hasMoreElements()) { - TreePath path = expandedDescendants.nextElement(); - - tree.expandPath(path); - } - } - - // } - - } - - public void setWorkspaces(FileList sources) { // this method will only be called when source is guaranteed existent - // if (root.isLeaf()) { - // addProject(source, "Aspects", true, false); - // } else { - // List sourceNodes = SpecsFactory.newArrayList(); - - for (int i = 0; i < workspaceNode.getChildCount(); i++) { - MutableTreeNode node = (MutableTreeNode) workspaceNode.getChildAt(i); - treeModel.removeNodeFromParent(node); - } - int i = 0; - for (File file : sources.getFiles()) { - FileNode sourceNode = newFileNode(file, "", false); - showChildren(sourceNode, true, 1); - // sourceNodes.add(sourceNode); - // System.out.println(file); - // treeModel.removeNodeFromParent(old); - treeModel.insertNodeInto(sourceNode, workspaceNode, i++); - - } - // Enumeration expandedDescendants = tree.getExpandedDescendants(new TreePath(root)); - // treeModel.nodeStructureChanged(workspaceNode); - // TreePath newPath = new TreePath(treeModel.getPathToRoot(sourceNode)); - // tree.expandPath(newPath); - - // if (expandedDescendants != null) { - // while (expandedDescendants.hasMoreElements()) { - // TreePath path = expandedDescendants.nextElement(); - // - // tree.expandPath(path); - // } - // } - - // FileNode old = (FileNode) root.getChildAt(2); - // if (old.getFile().equals(source)) { - // return; - // } - - // } - - } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/ExplorerPopup.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/ExplorerPopup.java deleted file mode 100644 index f6808af0e..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/ExplorerPopup.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.components; - -import java.awt.event.ActionEvent; -import java.util.function.Consumer; - -import javax.swing.JMenuItem; -import javax.swing.JPopupMenu; - -import pt.up.fe.specs.util.swing.GenericActionListener; - -public class ExplorerPopup extends JPopupMenu { - - /** - * - */ - private static final long serialVersionUID = 1L; - - public ExplorerPopup(Explorer explorer) { - // JPopupMenu popupMenu = new JPopupMenu("POPUP"); - newItem("Open File", explorer::open); - newItem("Open Main Lara File", explorer::openMainLara); - newItem("Open in System Explorer", explorer::openInSystemExplorer); - addSeparator(); - newItem("New Project", explorer::newProject); - newItem("Remove Project", explorer::removeProject); - addSeparator(); - newItem("Expand", explorer::expand); - newItem("Collapse", explorer::collapse); - newItem("Refresh", e -> explorer.refresh()); - } - - private JMenuItem newItem(String name, Consumer listener) { - - JMenuItem newItem = new JMenuItem(name); - - // newItem.setMnemonic(keyEvent); - newItem.addActionListener(new GenericActionListener(listener)); - - return add(newItem); - } -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/FileNode.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/FileNode.java deleted file mode 100644 index 370f0746c..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/FileNode.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.components; - -import java.io.File; - -import javax.swing.tree.DefaultMutableTreeNode; - -public class FileNode extends DefaultMutableTreeNode { - - /** - * - */ - private static final long serialVersionUID = 1L; - private final File file; - private final String comment; - private final boolean closeable; - - public FileNode(File file) { - this(file, ""); - } - - public FileNode(File file, String comment) { - this(file, comment, true); - } - - public FileNode(File file, String comment, boolean closeable) { - // super(file); - super(addFileAnnotation(file, comment)); - this.file = file; - this.comment = comment; - this.closeable = closeable; - } - - private static Object addFileAnnotation(File file, String comment) { - if (comment != null && !comment.isEmpty()) { - return new File(file.getName() + comment); - } - return file; - } - - public File getFile() { - return file; - } - - public String getComment() { - return comment; - } - - public boolean isCloseable() { - return closeable; - } - - // @Override - // public boolean isLeaf() { - // - // return !file.isDirectory() || file.listFiles().length == 0; - // } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/FileNotExistPane.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/FileNotExistPane.java deleted file mode 100644 index 1d5ae593b..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/FileNotExistPane.java +++ /dev/null @@ -1,128 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.components; - -import java.awt.BorderLayout; -import java.awt.Font; -import java.awt.Panel; -import java.awt.event.ActionEvent; -import java.util.function.Consumer; - -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; - -import org.lara.interpreter.joptions.panels.editor.tabbed.SourceTextArea; -import org.lara.interpreter.joptions.panels.editor.utils.Colors; - -import pt.up.fe.specs.util.swing.GenericActionListener; - -public class FileNotExistPane extends Panel { - - /** - * - */ - private static final long serialVersionUID = 1L; - // private final JButton cancelBtn = new JButton("Ignore"); - private final JLabel messageLbl = new JLabel("This file does not exist or was removed"); - private JButton reload; - private JButton create; - // private JButton close; - private CloseButton closeX; - - public FileNotExistPane(SourceTextArea editorTab) { - super(new BorderLayout()); - setBackground(Colors.BLUE); - - // JLabel label = new JLabel("File content was modified"); - Font currentFont = messageLbl.getFont(); - Font newFont = currentFont.deriveFont(11f).deriveFont(Font.BOLD); - - add(messageLbl, BorderLayout.CENTER); - - JPanel buttonsPanel = new JPanel(); - buttonsPanel.setBackground(Colors.BLUE); - reload = new JButton("Reload"); - reload.setFont(newFont); - addButtonListener(reload, x -> { - if (editorTab.getLaraFile().exists()) { - editorTab.reload(); - editorTab.closeReloadPane(); - } - }); - buttonsPanel.add(reload); - create = new JButton("Create"); - create.setFont(newFont); - addButtonListener(create, x -> { - editorTab.save(); - editorTab.closeReloadPane(); - }); - buttonsPanel.add(create); - // reload.addActionListener(new GenericActionListener(x -> editorTab.reload())); - // close = new JButton("Close"); - // addButtonListener(close, x -> { - // editorTab.getTabbedParent().closeTab(editorTab); - // editorTab.closeReloadPane(); - // }); - // close.setFont(newFont); - // buttonsPanel.add(close); - closeX = new CloseButton(x -> { - // editorTab.getTabbedParent().closeTab(editorTab); - editorTab.setAsked(true); - editorTab.closeReloadPane(); - // ativate(false); - }); - closeX.setFont(newFont); - buttonsPanel.add(closeX); - add(buttonsPanel, BorderLayout.EAST); - validate(); - // setVisible(true); // true for debugging - } - - public void addButtonListener(JButton button, Consumer consumer) { - button.addActionListener(new GenericActionListener(x -> { - consumer.accept(x); - // ativate(false); - - })); - } - - // public void ativate(boolean b) { - // setVisible(b); - // // get - // EventQueue.invokeLater(new Runnable() { - // @Override - // public void run() { - // repaint(); - // revalidate(); - // } - // }); - // - // // messageLbl.setVisible(b); - // // close.setVisible(b); - // // reload.setVisible(b); - // // overwrite.setVisible(b); - // // // this.repaint(); - // // // this.revalidate(); - // // messageLbl.repaint(); - // // messageLbl.revalidate(); - // // close.repaint(); - // // close.revalidate(); - // // reload.repaint(); - // // reload.revalidate(); - // // overwrite.repaint(); - // // overwrite.revalidate(); - // } - -} \ No newline at end of file diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/LanguageSpecificationSideBar.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/LanguageSpecificationSideBar.java deleted file mode 100644 index c980637d4..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/LanguageSpecificationSideBar.java +++ /dev/null @@ -1,600 +0,0 @@ -/** - * Copyright 2016 SPeCS. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.components; - -import org.lara.interpreter.joptions.panels.editor.EditorPanel; -import org.lara.interpreter.joptions.panels.editor.components.langspecsidebar.LangSpecSorting; -import org.lara.language.specification.dsl.Action; -import org.lara.language.specification.dsl.*; -import org.lara.language.specification.dsl.types.GenericType; -import pt.up.fe.specs.util.SpecsEnums; -import pt.up.fe.specs.util.SpecsStrings; -import pt.up.fe.specs.util.exceptions.NotImplementedException; -import pt.up.fe.specs.util.swing.GenericActionListener; - -import javax.swing.*; -import javax.swing.border.EmptyBorder; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.function.Function; -import java.util.prefs.Preferences; -import java.util.stream.Collectors; - -public class LanguageSpecificationSideBar extends JPanel { - - private static final String SEPARATOR_TYPE = "%LARA_SIDEBAR_SEPARATOR%"; - - /** - * - */ - private static final long serialVersionUID = 1L; - - private static final String PREFERENCE_SORTING_METHOD = "langSpecSortingMethod"; - - private final LanguageSpecification langSpec; - private JComboBox joinPoints; - - private final EditorPanel editor; - - private JPanel rootPanel; - private JPanel sortPanel; - - private DefaultListModel attributes; - private JoinPointClass currentExtend = null; - private DefaultListModel selectedBy; - private static final Color SELECTION_COLOR = Color.LIGHT_GRAY; - private static final int preferedWidth = 350; - // private static final int preferedListHeight = 140; - private static final int listCharMaxWidth = 260; - - private JPanel inner; - private JPanel joinPointPanel; - private JPanel extendsPanel; - private JButton extendsButton; - - private LangSpecSorting sortingMethod; - - /** - * This constructor exists for compatibility purposes - * - * @param editor - * @param langSpec - */ - // public LanguageSpecificationSideBar(EditorPanel editor, LanguageSpecification langSpec) { - // this(editor, JoinPointFactory.fromOld(langSpec)); - // } - public LanguageSpecificationSideBar(EditorPanel editor, LanguageSpecification langSpec) { - super(new BorderLayout()); - setBorder(new EmptyBorder(4, 0, 5, 0)); - // setBackground(Colors.BLUE_GREY); - Dimension preferredSize = this.getPreferredSize(); - preferredSize.setSize(preferedWidth, preferredSize.getHeight()); - this.setPreferredSize(preferredSize); - this.langSpec = langSpec; - this.editor = editor; - - // Get sorting method - - this.sortingMethod = getSortingMethod(); - - addHeader(); - addLists(); - init(); - - } - - private LangSpecSorting getSortingMethod() { - // Using root join point to identify weaver - Preferences prefs = Preferences.userNodeForPackage(langSpec.getRoot().getClass()); - String sortingMethodString = prefs.get(PREFERENCE_SORTING_METHOD, LangSpecSorting.ALPHABETICALLY.name()); - return SpecsEnums.valueOf(LangSpecSorting.class, sortingMethodString); - } - - private void setSortingMethod(LangSpecSorting sortingMethod) { - // Set internally - this.sortingMethod = sortingMethod; - - // Update preferences - Preferences prefs = Preferences.userNodeForPackage(langSpec.getRoot().getClass()); - prefs.put(PREFERENCE_SORTING_METHOD, sortingMethod.name()); - } - - private void addHeader() { - JPanel header = new JPanel(new BorderLayout()); - - add(header, BorderLayout.NORTH); - JPanel topHeader = new JPanel(new BorderLayout()); - JLabel comp = new JLabel("Language Specification", SwingConstants.CENTER); - comp.setBorder(new EmptyBorder(5, 0, 5, 0)); - // JLabel comp = new JLabel("

Language Specification
"); - comp.setFont(comp.getFont().deriveFont(Font.BOLD, 14)); - // comp.setVerticalAlignment(SwingConstants.CENTER); - topHeader.add(comp, BorderLayout.CENTER); - - rootPanel = new JPanel(new FlowLayout()); - sortPanel = new JPanel(new FlowLayout()); - - JPanel southTopHeader = new JPanel(new FlowLayout()); - southTopHeader.add(rootPanel); - southTopHeader.add(sortPanel); - - // topHeader.add(rootPanel, BorderLayout.SOUTH); - topHeader.add(southTopHeader, BorderLayout.SOUTH); - - header.add(topHeader, BorderLayout.NORTH); - - joinPointPanel = new JPanel(new BorderLayout()); - joinPoints = new JComboBox<>(); - extendsPanel = new JPanel(); - joinPointPanel.add(joinPoints, BorderLayout.CENTER); - header.add(joinPointPanel); - } - - private void addLists() { - inner = new JPanel(new GridBagLayout()); - add(inner, BorderLayout.CENTER); - - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTH; - c.weightx = 1; - c.weighty = 0; - c.gridx = 0; - c.gridy = 0; - c.fill = GridBagConstraints.BOTH; - - c.gridy++; - addLabel(c, "Attributes"); - - c.gridy++; - attributes = new DefaultListModel<>(); - addList(attributes, new AttributeCellRenderer(), c); - - c.gridy++; - addLabel(c, "Selects"); - - c.gridy++; - selects = new DefaultListModel<>(); - addList(selects, new SelectCellRenderer(), c); - - c.gridy++; - addLabel(c, "Actions"); - - c.gridy++; - actions = new DefaultListModel<>(); - addList(actions, new ActionCellRenderer(), c); - - c.gridy++; - addLabel(c, "Selected by"); - - c.gridy++; - selectedBy = new DefaultListModel<>(); - addList(selectedBy, new SelectedByCellRenderer(), c); - } - - private void addLabel(GridBagConstraints c, String text) { - JLabel comp = new JLabel(text); - comp.setFont(comp.getFont().deriveFont(Font.BOLD, 11)); - comp.setBorder(new EmptyBorder(9, 0, 3, 0)); - inner.add(comp, c); - - // JLabel comp = new JLabel("Language Specification", SwingConstants.CENTER); - // JLabel comp = new JLabel("
Language Specification
"); - // comp.setFont(comp.getFont().deriveFont(Font.BOLD, 13)); - } - - private void addList(ListModel model, ListCellRenderer renderer, GridBagConstraints c) { - JList jList = new JList<>(); - jList.setModel(model); - jList.setCellRenderer(renderer); - jList.setSelectionBackground(LanguageSpecificationSideBar.SELECTION_COLOR); - JScrollPane comp = new JScrollPane(jList); - - c.fill = GridBagConstraints.BOTH; - c.weighty = 1; - inner.add(comp, c); - c.weighty = 0; - } - - private void init() { - initRoot(); - initSort(); - initExtends(); - initJoinPoints(); - joinPoints.setSelectedItem(langSpec.getRoot()); - } - - private void initJoinPoints() { - - joinPoints.addItem(langSpec.getGlobal()); - for (JoinPointClass joinPoint : langSpec.getJoinPoints().values()) { - joinPoints.addItem(joinPoint); - } - joinPoints.addActionListener( - new GenericActionListener(e -> updateJPInfo((JoinPointClass) joinPoints.getSelectedItem()))); - - } - - private void updateJPInfo(JoinPointClass selectedItem) { - // Clear lists - attributes.removeAllElements(); - selects.removeAllElements(); - actions.removeAllElements(); - selectedBy.removeAllElements(); - - // selectedItem.getAttributes().forEach(attributes::addElement); - getAttributes(selectedItem).forEach(attributes::addElement); - getSelects(selectedItem).forEach(selects::addElement); - getActions(selectedItem).forEach(actions::addElement); - langSpec.getSelectedBy(selectedItem).forEach(selectedBy::addElement); - - if (selectedItem.hasExtend()) { - extendsPanel.setVisible(true); - currentExtend = selectedItem.getExtend().get(); - extendsButton.setText(currentExtend.getName()); - } else { - extendsPanel.setVisible(false); - currentExtend = null; - extendsButton.setText("N/A"); - } - revalidate(); - } - - private List getAttributes(JoinPointClass joinPoint) { - - switch (sortingMethod) { - case ALPHABETICALLY: - return getAlphabetical(joinPoint, jp -> jp.getAttributes()); - case HIERARCHICALLY: - List attributes = new ArrayList<>(); - getHierarchical(joinPoint, attributes, jp -> jp.getAttributesSelf(), - jp -> new Attribute(new GenericType(SEPARATOR_TYPE, false), jp.getName())); - return attributes; - default: - throw new NotImplementedException(sortingMethod); - } - } - - private List selects = new ArrayList<>(); - getHierarchical(joinPoint, selects, jp -> jp.getSelectsSelf(), - jp -> new Select(jp, SEPARATOR_TYPE)); - return selects; - default: - throw new NotImplementedException(sortingMethod); - } - - } - - private List getActions(JoinPointClass joinPoint) { - switch (sortingMethod) { - case ALPHABETICALLY: - return getAlphabetical(joinPoint, jp -> jp.getActions()); - case HIERARCHICALLY: - List actions = new ArrayList<>(); - getHierarchical(joinPoint, actions, jp -> jp.getActionsSelf(), - jp -> new Action(new GenericType(SEPARATOR_TYPE, false), jp.getName())); - return actions; - default: - throw new NotImplementedException(sortingMethod); - } - - } - // - // private void getAttributes(JoinPointClass joinPoint, List elements) { - // - // // First element is a separator with the name of the join point - // elements.add(new Attribute(new GenericType(SEPARATOR_TYPE, false), joinPoint.getName())); - // - // // Populate lists - // elements.addAll(joinPoint.getAttributesSelf()); - // - // if (joinPoint.getExtend().isPresent()) { - // getAttributes(joinPoint.getExtend().get(), elements); - // } - // - // } - - private > List getAlphabetical(JoinPointClass joinPoint, - Function> getter) { - - var elements = getter.apply(joinPoint); - Collections.sort(elements); - return elements; - } - - private void getHierarchical(JoinPointClass joinPoint, List elements, - Function> childrenGetter, - Function separatorBuilder) { - - // First element is a separator with the name of the join point - elements.add(separatorBuilder.apply(joinPoint)); - - // Populate lists - elements.addAll(childrenGetter.apply(joinPoint)); - - if (joinPoint.getExtend().isPresent()) { - getHierarchical(joinPoint.getExtend().get(), elements, childrenGetter, separatorBuilder); - } - } - - private void initRoot() { - JLabel jLabel = new JLabel("Root: "); - JoinPointClass root = langSpec.getRoot(); - String name = root.getName(); - if (!langSpec.getRootAlias().isEmpty()) { - name = langSpec.getRootAlias() + "(" + name + ")"; - } - JButton button = new JButton(" " + name + " "); - button.setContentAreaFilled(false); - button.setBorder(BorderFactory.createEtchedBorder()); - button.addActionListener(new GenericActionListener(e -> joinPoints.setSelectedItem(root))); - - rootPanel.add(jLabel); - rootPanel.add(button); - // rootPanel.setPreferredSize(new Dimension(50, 50)); - - } - - private void initSort() { - JLabel jLabel = new JLabel("Sort: "); - - JButton button = new JButton(" " + SpecsStrings.toCamelCase(sortingMethod.name()) + " "); - button.setContentAreaFilled(false); - button.setBorder(BorderFactory.createEtchedBorder()); - button.addActionListener(new GenericActionListener(e -> updateSorting(e, button))); - - // Add to panel - sortPanel.add(jLabel); - sortPanel.add(button); - } - - private void updateSorting(ActionEvent event, JButton button) { - - // Cycle to next option - var nextSorting = SpecsEnums.nextEnum(this.sortingMethod); - - setSortingMethod(nextSorting); - - // Update button - button.setText(" " + SpecsStrings.toCamelCase(nextSorting.name()) + " "); - button.repaint(); - - updateJPInfo((JoinPointClass) joinPoints.getSelectedItem()); - } - - private void initExtends() { - JLabel jLabel = new JLabel("Extends: "); - extendsButton = new JButton("N/A"); - extendsButton.setContentAreaFilled(false); - extendsButton.setBorder(BorderFactory.createEtchedBorder()); - extendsButton.addActionListener(new GenericActionListener(e -> { - if (currentExtend != null) { - joinPoints.setSelectedItem(currentExtend); - } - })); - extendsPanel.add(jLabel); - extendsPanel.add(extendsButton); - joinPointPanel.add(extendsPanel, BorderLayout.EAST); - // rootPanel.setPreferredSize(new Dimension(50, 50)); - - } - - public LanguageSpecification getLangSpec() { - return langSpec; - } - - public EditorPanel getEditor() { - return editor; - } - - static class AttributeCellRenderer extends JLabel implements ListCellRenderer { - - /** - * - */ - private static final long serialVersionUID = 1L; - - public AttributeCellRenderer() { - setVisible(true); - setOpaque(true); - } - - @Override - public Component getListCellRendererComponent(JList list, Attribute value, int index, - boolean isSelected, boolean cellHasFocus) { - Declaration declaration = value.getDeclaration(); - String toHtml = toHtml(declaration); - String text = "" + toHtml; - if (!value.getParameters().isEmpty()) { - text += value.getParameters().stream().map(d -> toHtml(d)).collect(Collectors.joining(", ", "(", ")")); - } - text += ""; - setText(text); - setBackground(isSelected ? list.getSelectionBackground() : list.getBackground()); - // setForeground(isSelected ? list.getSelectionForeground() : list.getForeground()); - setToolTipText(value.getToolTip().orElse(null)); - return this; - } - - } - - static class ActionCellRenderer extends JLabel implements ListCellRenderer { - - /** - * - */ - private static final long serialVersionUID = 1L; - - public ActionCellRenderer() { - setVisible(true); - setOpaque(true); - } - - @Override - public Component getListCellRendererComponent(JList list, Action value, int index, - boolean isSelected, boolean cellHasFocus) { - // String text = "" + value.getName() + ""; - Declaration declaration = value.getDeclaration(); - String toHtml = toHtml(declaration); - String text = "" + toHtml; - if (!declaration.getType().getType().equals(SEPARATOR_TYPE)) { - text += value.getParameters().stream().map(d -> toHtml(d)).collect(Collectors.joining(", ", "(", ")")); - } - text += ""; - setText(text); - setBackground(isSelected ? list.getSelectionBackground() : list.getBackground()); - // setForeground(isSelected ? list.getSelectionForeground() : list.getForeground()); - setToolTipText(value.getToolTip().orElse("Documentation not available")); - return this; - } - - } - - static class SelectCellRenderer extends JLabel implements ListCellRenderer { - // static { - // ToolTipManager.sharedInstance().setInitialDelay(1000); - // } - - /** - * - */ - private static final long serialVersionUID = 1L; - - public SelectedByCellRenderer() { - setVisible(true); - setOpaque(true); - } - - @Override - public Component getListCellRendererComponent(JList list, Select value, int index, - boolean isSelected, boolean cellHasFocus) { - - String text = selectedBytoHtml(value); - setText(text); - setBackground(isSelected ? list.getSelectionBackground() : list.getBackground()); - // setForeground(isSelected ? list.getSelectionForeground() : list.getForeground()); - - setToolTipText(value.getToolTip().orElse(null)); - - return this; - } - - } - - private static String toHtml(Declaration declaration) { - // Special case: declarations that are separators - // - if (declaration.getType().getType().equals(SEPARATOR_TYPE)) { - return getSeparatorHtml(declaration.getName()); - } - // - - String toHtml = "" + declaration.getType() + " " - + declaration.getName(); - return toHtml; - } - - private static String getSeparatorHtml(String name) { - return "-- " + name + "-- "; - } - - private static String selectedBytoHtml(Select select) { - JoinPointClass selector = select.getSelector(); - String alias = select.getAlias().orElse(""); - if (alias.isEmpty()) { - alias = select.getClazz().getName(); - } - String toHtml = "" + selector.getName() + " as " - + alias + ""; - return toHtml; - } - - private static String toHtml(Parameter parameter) { - Declaration declaration = parameter.getDeclaration(); - String defaultValue = parameter.getDefaultValue(); - String toHtml = toHtml(declaration); - if (!defaultValue.isEmpty()) { - toHtml += " = " + defaultValue; - } - return toHtml; - } - - public void resizeForScrollBar() { - // Dimension size = inner.getSize(); - // this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); - // hiddenPanel.setVisible(true); - validate(); - repaint(); - // size.setSize(size.getWidth() - 20, size.getHeight()); - // inner.setSize(size); - // inner.revalidate(); - } -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/OutlinePanel.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/OutlinePanel.java deleted file mode 100644 index 688d866e5..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/OutlinePanel.java +++ /dev/null @@ -1,256 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.components; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Image; -import java.io.IOException; -import java.util.Comparator; -import java.util.List; -import java.util.stream.Collectors; - -import javax.imageio.ImageIO; -import javax.swing.DefaultListModel; -import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.ListCellRenderer; -import javax.swing.ListSelectionModel; -import javax.swing.event.ListSelectionEvent; -import javax.swing.text.BadLocationException; - -import org.dojo.jsl.parser.ast.ASTAspectDef; -import org.dojo.jsl.parser.ast.ASTAssignmentExpression; -import org.dojo.jsl.parser.ast.ASTCodeDef; -import org.dojo.jsl.parser.ast.ASTFunctionDeclaration; -import org.dojo.jsl.parser.ast.ASTFunctionExpression; -import org.dojo.jsl.parser.ast.ASTIdentifier; -import org.dojo.jsl.parser.ast.ASTVariableDeclaration; -import org.dojo.jsl.parser.ast.Node; -import org.fife.ui.rsyntaxtextarea.TextEditorPane; -import org.lara.interpreter.joptions.panels.editor.EditorPanel; - -import pt.up.fe.specs.tools.lara.logging.LaraLog; -import pt.up.fe.specs.util.SpecsCollections; -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.SpecsLogs; - -public class OutlinePanel extends JPanel { - - /** - * - */ - private static final long serialVersionUID = 4026258311800595450L; - - private final EditorPanel editor; - - private DefaultListModel listModel; - private JList list; - private JPanel inner; - - private static final Color SELECTION_COLOR = Color.LIGHT_GRAY; - // private static final int preferedWidth = 350; - - public OutlinePanel(EditorPanel editor) { - super(new BorderLayout()); - - // Dimension preferredSize = getPreferredSize(); - // preferredSize.setSize(preferedWidth, preferredSize.getHeight()); - // setPreferredSize(preferredSize); - - this.editor = editor; - - inner = new JPanel(new BorderLayout()); - add(inner, BorderLayout.CENTER); - - listModel = new DefaultListModel<>(); - - list = new JList<>(listModel); - list.setCellRenderer(new OutlineRenderer()); - list.setSelectionBackground(SELECTION_COLOR); - inner.add(list, BorderLayout.CENTER); - - list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - list.addListSelectionListener(this::selectionHandler); - } - - private void selectionHandler(ListSelectionEvent e) { - - // if (listModel.isEmpty()) { - // return; - // } - OutlineElement element = list.getSelectedValue(); - if (element == null) { - return; - } - int line = element.getLine(); - - try { - TextEditorPane laraTextArea = editor.getTabsContainer().getCurrentTab().getTextArea(); - laraTextArea.setCaretPosition(laraTextArea.getLineStartOffset(line - 1)); - } catch (BadLocationException e1) { - - } - } - - public void setElements(List aspectList, List functionList, - List codedefList, List expressionList) { - - List elements = OutlineElement.buildOutlineElementList(aspectList, functionList, codedefList, - expressionList); - - listModel.removeAllElements(); - - elements.forEach(listModel::addElement); - - revalidate(); - } - - static class OutlineRenderer implements ListCellRenderer { - - private JLabel label; - - public OutlineRenderer() { - label = new JLabel(); - label.setVisible(true); - label.setOpaque(true); - } - - @Override - public Component getListCellRendererComponent(JList list, OutlineElement value, - int index, - boolean isSelected, boolean cellHasFocus) { - - label.setText(value.getHtml()); - label.setIcon(value.getIcon()); - label.setBackground(isSelected ? list.getSelectionBackground() : list.getBackground()); - - return label; - } - - } - - enum OutlineElementType { - ASPECT, - FUNCTION, - CODEDEF - } - - static class OutlineElement { - - private final String name; - private final int line; - private final OutlineElementType type; - - public OutlineElement(String name, int line, OutlineElementType type) { - this.name = name; - this.line = line; - this.type = type; - } - - public int getLine() { - return line; - } - - public String getHtml() { - - String html = ""; - html += name + "   "; - html += "" + line + ""; - html += ""; - - return html; - } - - public Icon getIcon() { - Image img; - try { - switch (type) { - case ASPECT: - img = ImageIO.read(SpecsIo.resourceToStream("larai/resources/img/aspect.png")); - return new ImageIcon(img); - case FUNCTION: - img = ImageIO.read(SpecsIo.resourceToStream("larai/resources/img/function.png")); - return new ImageIcon(img); - case CODEDEF: - img = ImageIO.read(SpecsIo.resourceToStream("larai/resources/img/codedef.png")); - return new ImageIcon(img); - - default: - img = ImageIO.read(SpecsIo.resourceToStream("larai/resources/img/run.gif")); - return new ImageIcon(img); - - } - } catch (IOException e) { - SpecsLogs.warn("Could not load the needed icon resource"); - } - return null; - } - - static List buildOutlineElementList(List aspectList, - List functionList, - List codedefList, List expressionList) { - - List list = SpecsCollections.newArrayList(); - - aspectList.forEach(a -> list.add( - new OutlineElement(a.getName(), a.jjtGetFirstToken().beginLine, OutlineElementType.ASPECT))); - functionList.forEach(a -> list.add( - new OutlineElement(a.getFuncName(), a.jjtGetFirstToken().beginLine, OutlineElementType.FUNCTION))); - codedefList.forEach(a -> list.add( - new OutlineElement(a.getName(), a.jjtGetFirstToken().beginLine, OutlineElementType.CODEDEF))); - - expressionList.stream() - .map(OutlineElement::convert) - .filter(a -> a != null) - .forEach(list::add); - - Comparator alpha = (e1, e2) -> e1.name.toLowerCase().compareTo(e2.name.toLowerCase()); - return list.stream().sorted(alpha).collect(Collectors.toList()); - } - - static OutlineElement convert(ASTFunctionExpression expr) { - - // Optional varDecl = expr.getAncestorOfType(ASTVariableDeclaration.class); - Node parent = expr.jjtGetParent(); - - if (parent instanceof ASTVariableDeclaration) { - - ASTVariableDeclaration varDecl = (ASTVariableDeclaration) parent; - - final ASTIdentifier id = (ASTIdentifier) varDecl.getChildren()[0]; - final String varName = id.getName(); - - return new OutlineElement(varName, varDecl.jjtGetFirstToken().beginLine, OutlineElementType.FUNCTION); - } - if (parent instanceof ASTAssignmentExpression) { - try { - ASTAssignmentExpression assignment = (ASTAssignmentExpression) parent; - String source = assignment.getChild(0).toSource(); - return new OutlineElement(source, expr.jjtGetFirstToken().beginLine, - OutlineElementType.FUNCTION); - } catch (Exception e) { - LaraLog.debug("Could not create outline element for a function expression: " + e.getMessage()); - } - } - - return null; - } - } -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/ReloadPane.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/ReloadPane.java deleted file mode 100644 index 1f4182ac6..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/ReloadPane.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.components; - -import java.awt.BorderLayout; -import java.awt.Font; -import java.awt.Panel; -import java.awt.event.ActionEvent; -import java.util.function.Consumer; - -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; - -import org.lara.interpreter.joptions.panels.editor.tabbed.SourceTextArea; -import org.lara.interpreter.joptions.panels.editor.utils.Colors; - -import pt.up.fe.specs.util.swing.GenericActionListener; - -public class ReloadPane extends Panel { - - /** - * - */ - private static final long serialVersionUID = 1L; - // private final JButton cancelBtn = new JButton("Ignore"); - private final JLabel messageLbl = new JLabel("This file was updated by another program"); - private JButton reload; - private JButton overwrite; - private CloseButton close; - - public ReloadPane(SourceTextArea editorTab) { - super(new BorderLayout()); - setBackground(Colors.BLUE); - - // JLabel label = new JLabel("File content was modified"); - Font currentFont = messageLbl.getFont(); - Font newFont = currentFont.deriveFont(11f).deriveFont(Font.BOLD); - - add(messageLbl, BorderLayout.CENTER); - - JPanel buttonsPanel = new JPanel(); - buttonsPanel.setBackground(Colors.BLUE); - reload = new JButton("Reload"); - - reload.setFont(newFont); - addButtonListener(reload, x -> { - editorTab.reload(); - editorTab.closeReloadPane(); - }); - buttonsPanel.add(reload); - // reload.addActionListener(new GenericActionListener(x -> editorTab.reload())); - overwrite = new JButton("Overwrite"); - addButtonListener(overwrite, x -> { - editorTab.save(); - editorTab.closeReloadPane(); - - }); - overwrite.setFont(newFont); - buttonsPanel.add(overwrite); - close = new CloseButton(x -> { - editorTab.updateLastModified(); - editorTab.closeReloadPane(); - // ativate(false); - }); - close.setFont(newFont); - buttonsPanel.add(close); - add(buttonsPanel, BorderLayout.EAST); - validate(); - // setVisible(true); // true for debugging - } - - public void addButtonListener(JButton button, Consumer consumer) { - button.addActionListener(new GenericActionListener(x -> { - consumer.accept(x); - // ativate(false); - - })); - } - - // public void ativate(boolean b) { - // setVisible(b); - // // get - // EventQueue.invokeLater(new Runnable() { - // @Override - // public void run() { - // repaint(); - // revalidate(); - // } - // }); - // - // // messageLbl.setVisible(b); - // // close.setVisible(b); - // // reload.setVisible(b); - // // overwrite.setVisible(b); - // // // this.repaint(); - // // // this.revalidate(); - // // messageLbl.repaint(); - // // messageLbl.revalidate(); - // // close.repaint(); - // // close.revalidate(); - // // reload.repaint(); - // // reload.revalidate(); - // // overwrite.repaint(); - // // overwrite.revalidate(); - // } - -} \ No newline at end of file diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/SearchPanel.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/SearchPanel.java deleted file mode 100644 index b0c1ed032..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/SearchPanel.java +++ /dev/null @@ -1,144 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.components; - -import java.awt.BorderLayout; -import java.awt.FlowLayout; -import java.awt.event.ActionEvent; - -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; - -import org.fife.ui.rsyntaxtextarea.TextEditorPane; -import org.fife.ui.rtextarea.RTextArea; -import org.fife.ui.rtextarea.SearchContext; -import org.fife.ui.rtextarea.SearchEngine; -import org.lara.interpreter.joptions.panels.editor.EditorPanel; -import org.lara.interpreter.joptions.panels.editor.listeners.ListenerUtils; -import org.lara.interpreter.joptions.panels.editor.listeners.StrokesAndActions; -import org.lara.interpreter.joptions.panels.editor.utils.Colors; - -public class SearchPanel extends JPanel { - - /** - * - */ - private static final long serialVersionUID = 1L; - - private final EditorPanel editorPanel; - private final JTextField searchField; - private final JButton upButton; - private final JButton downButton; - private final JCheckBox matchCaseCB; - private final JCheckBox markAllCB; - private final JCheckBox regexCB; - private final JLabel infoLabel; - private final JButton closeButton; - - public SearchPanel(EditorPanel editorPanel) { - super(new BorderLayout()); - - JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); - panel.setBackground(Colors.BLUE_GREY); - - closeButton = new JButton("Close"); - closeButton.addActionListener(e -> setVisible(false)); - add(panel, BorderLayout.CENTER); - add(closeButton, BorderLayout.EAST); - - this.editorPanel = editorPanel; - searchField = new JTextField(20); - - ListenerUtils.mapAction(searchField, StrokesAndActions.ENTER, "FindNext", x -> search(true)); - ListenerUtils.mapAction(searchField, StrokesAndActions.SHIFT_ENTER, "FindPrevious", x -> search(false)); - - panel.add(searchField); - - upButton = new JButton("\u25B2"); - upButton.setActionCommand("FindPrevious"); - upButton.addActionListener(this::actionPerformed); - panel.add(upButton); - - downButton = new JButton("\u25BC"); - downButton.setActionCommand("FindNext"); - downButton.addActionListener(this::actionPerformed); - panel.add(downButton); - - markAllCB = new JCheckBox("Highlight All"); - panel.add(markAllCB); - matchCaseCB = new JCheckBox("Match Case"); - panel.add(matchCaseCB); - regexCB = new JCheckBox("Regex"); - panel.add(regexCB); - infoLabel = new JLabel(""); - // infoLabel.setBorder(new Border); - panel.add(infoLabel); - - setVisible(false); - } - - public void actionPerformed(ActionEvent e) { - - // "FindNext" => search forward, "FindPrev" => search backward - String command = e.getActionCommand(); - boolean forward = "FindNext".equals(command); - - search(forward); - - } - - private void search(boolean forward) { - // Create an object defining our search parameters. - SearchContext context = new SearchContext(); - String text = searchField.getText(); - // if (text.length() == 0) { - // return; - // } - context.setSearchFor(text); - context.setMatchCase(matchCaseCB.isSelected()); - context.setRegularExpression(regexCB.isSelected()); - context.setSearchForward(forward); - context.setWholeWord(false); - - RTextArea textArea = getTextArea(); - - boolean found = SearchEngine.find(textArea, context).wasFound(); - if (!found) { - - textArea.setCaretPosition(0); - found = SearchEngine.find(textArea, context).wasFound(); - if (found) { - infoLabel.setText("Wrapped Search"); - } else { - infoLabel.setText("Text not found"); - } - return; - - } - infoLabel.setText(""); - } - - private TextEditorPane getTextArea() { - return editorPanel.getTabsContainer().getCurrentTab().getTextArea(); - } - - public void getFocus() { - setVisible(true); - searchField.requestFocus(); - } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/TabbedContextMenu.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/TabbedContextMenu.java deleted file mode 100644 index c8a55883b..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/TabbedContextMenu.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.components; - -import java.awt.event.ActionEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.function.Consumer; - -import javax.swing.JMenuItem; -import javax.swing.JPopupMenu; - -import org.lara.interpreter.joptions.panels.editor.tabbed.TabsContainerPanel; - -import pt.up.fe.specs.util.swing.GenericActionListener; - -public class TabbedContextMenu extends JPopupMenu { - /** - * - */ - private static final long serialVersionUID = 1L; - // JMenuItem close; - // JMenuItem closeAll; - // JMenuItem closeLeft; - // JMenuItem closeRight; - TabsContainerPanel tabbedPane; - - public TabbedContextMenu(TabsContainerPanel tabbedPane) { - this.tabbedPane = tabbedPane; - addItem("Close", x -> tabbedPane.closeCurrent()); - addItem("Close Others", x -> tabbedPane.closeAllButCurrent()); - addItem("Close Tabs to the Left <<", x -> tabbedPane.closeLeft()); - addItem("Close Tabs to the Right >>", x -> tabbedPane.closeRight()); - addSeparator(); - addItem("Close All", x -> tabbedPane.closeAll()); - } - - public void addItem(String name, Consumer consumer) { - JMenuItem item = new JMenuItem(name); - item.addActionListener(new GenericActionListener(consumer)); - add(item); - - } - - // private EditorTab getCurrentTab() { - // return tabbedPane.getCurrentTab(); - // } - - public static MouseAdapter newMouseAdapter(TabsContainerPanel tabbedPane) { - return new MouseAdapter() { - @Override - public void mousePressed(MouseEvent e) { - - if (e.isPopupTrigger()) { - - doPop(e); - } - } - - @Override - public void mouseReleased(MouseEvent e) { - if (e.isPopupTrigger()) { - doPop(e); - } else { - - if (e.getButton() == MouseEvent.BUTTON2) { - - tabbedPane.getCurrentTab().close(); - } - } - } - - private void doPop(MouseEvent e) { - TabbedContextMenu menu = new TabbedContextMenu(tabbedPane); - menu.show(e.getComponent(), e.getX(), e.getY()); - } - }; - } -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/WorkDirNode.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/WorkDirNode.java deleted file mode 100644 index 0c8910668..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/WorkDirNode.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.components; - -import javax.swing.tree.DefaultMutableTreeNode; - -public class WorkDirNode extends DefaultMutableTreeNode { - - /** - * - */ - private static final long serialVersionUID = 1L; - - public WorkDirNode(String text) { - super(text); - } -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/langspecsidebar/LangSpecSorting.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/langspecsidebar/LangSpecSorting.java deleted file mode 100644 index 0173a760e..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/components/langspecsidebar/LangSpecSorting.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright 2021 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.components.langspecsidebar; - -public enum LangSpecSorting { - - ALPHABETICALLY, - HIERARCHICALLY; - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/highlight/EditorConfigurer.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/highlight/EditorConfigurer.java deleted file mode 100644 index e04538ccc..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/highlight/EditorConfigurer.java +++ /dev/null @@ -1,275 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.highlight; - -import java.awt.Color; -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; - -import javax.swing.JMenuItem; -import javax.swing.JPopupMenu; -import javax.swing.text.DefaultEditorKit; - -import org.fife.io.UnicodeWriter; -import org.fife.ui.autocomplete.AutoCompletion; -import org.fife.ui.autocomplete.BasicCompletion; -import org.fife.ui.autocomplete.Completion; -import org.fife.ui.autocomplete.CompletionProvider; -import org.fife.ui.autocomplete.DefaultCompletionProvider; -import org.fife.ui.autocomplete.FunctionCompletion; -import org.fife.ui.autocomplete.ParameterizedCompletion.Parameter; -import org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory; -import org.fife.ui.rsyntaxtextarea.FileLocation; -import org.fife.ui.rsyntaxtextarea.SyntaxConstants; -import org.fife.ui.rsyntaxtextarea.TextEditorPane; -import org.fife.ui.rsyntaxtextarea.Theme; -import org.fife.ui.rsyntaxtextarea.TokenMakerFactory; -import org.fife.ui.rsyntaxtextarea.folding.CurlyFoldParser; -import org.fife.ui.rsyntaxtextarea.folding.FoldParserManager; -import org.lara.interpreter.joptions.panels.editor.TextEditorDemo; -import org.lara.interpreter.joptions.panels.editor.tabbed.SourceTextArea; - -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.SpecsLogs; -import pt.up.fe.specs.util.swing.GenericActionListener; - -public class EditorConfigurer { - - static { - System.setProperty(UnicodeWriter.PROPERTY_WRITE_UTF8_BOM, "false"); - AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance(); - atmf.putMapping(TextEditorDemo.LARA_STYLE_KEY, LaraTokenMaker.class.getCanonicalName()); - FoldParserManager.get().addFoldParserMapping(TextEditorDemo.LARA_STYLE_KEY, new CurlyFoldParser()); - - try { - theme = Theme.load(SpecsIo.resourceToStream("org/fife/ui/rsyntaxtextarea/themes/eclipse.xml")); - - } catch (IOException e) { - SpecsLogs.warn("Could not load selected theme, will use default\n", e); - } - } - - private static Theme theme; - private final Color MARK_ALL_COLOR = Color.LIGHT_GRAY; - - public EditorConfigurer() { - - } - - /** - * Build a text area according to the type of the input file - * - * @param inputFile - * @param sourceTextArea - * @return - */ - public TextEditorPane buildTextArea(File inputFile, boolean isNew, SourceTextArea sourceTextArea) { - TextEditorPane textArea = new TextEditorPane(); - sourceTextArea.setTextArea(textArea); - // textArea.setFont(textArea.getFont().deriveFont(12f)); - if (theme != null) { - theme.apply(textArea); - } - textArea.setMarkAllHighlightColor(MARK_ALL_COLOR); - addPopupOptions(textArea); - - // Add folding - textArea.setCodeFoldingEnabled(true); - textArea.setAntiAliasingEnabled(true); - - loadFile(sourceTextArea, inputFile); - - return textArea; - } - - private static void addPopupOptions(TextEditorPane textArea) { - JPopupMenu popupMenu = textArea.getPopupMenu(); - popupMenu.addSeparator(); - JMenuItem copySyntax = new JMenuItem("Copy with Syntax Higlighting"); - copySyntax.addActionListener(new GenericActionListener(e -> textArea.copyAsRtf())); - popupMenu.add(copySyntax); - } - - public static void setLaraTextArea(SourceTextArea sourceTextArea) { - TextEditorPane textArea = sourceTextArea.getTextArea(); - textArea.setSyntaxEditingStyle(TextEditorDemo.LARA_STYLE_KEY); - - CompletionProvider provider = EditorConfigurer.createCompletionProvider(); - - AutoCompletion ac = new AutoCompletion(provider); - ac.install(textArea); - - textArea.clearParsers(); - EditorParser parser = new EditorParser(); - textArea.addParser(parser); - - // adds a list of aspects to the aspect list pane whenever a parsing is performed - parser.addListener(sourceTextArea::outlineAstListener); - } - - /** - * Create a simple provider that adds some LARA-related completions. - */ - private static CompletionProvider createCompletionProvider() { - - // This provider has no understanding of language semantics. - DefaultCompletionProvider provider = new DefaultCompletionProvider(); - - // EditorConfigurer.addPrintlnCompletion(provider); - List completions = new ArrayList<>(); - completions.add(new BasicCompletion(provider, "aspectdef")); - completions.add(new BasicCompletion(provider, "select")); - completions.add(new BasicCompletion(provider, "apply")); - completions.add(new BasicCompletion(provider, "condition")); - completions.add(new BasicCompletion(provider, "end")); - - for (String method : LaraTokenMaker.predefinedMethods) { - - completions.add(new BasicCompletion(provider, method + "(")); - } - - // Add a couple of "shorthand" completions. These completions don't - // require the input text to be the same thing as the replacement text. - // completions.add(new ShorthandCompletion(provider, "aspect", - // "aspectdef \n\nend", "Simple Aspect structure")); - - // completions.add(new TemplateCompletion(provider, "ff", "aff", "for()")); - // completions.add(new ShorthandCompletion(provider, "aspect", - // "aspectdef \n\nend", "Simple Aspect structure")); - // completions.add(new ShorthandCompletion(provider, "select", - // "select end", "Select structure")); - // completions.add(new ShorthandCompletion(provider, "apply", - // "apply end", "Apply structure")); - // completions.add(new ShorthandCompletion(provider, "condition", - // "condition end", "Condition structure")); - - provider.addCompletions(completions); - - // LanguageAwareCompletionProvider awareProvider = new LanguageAwareCompletionProvider(provider); - // return awareProvider; - return provider; - - } - - static void addPrintlnCompletion(DefaultCompletionProvider provider) { - FunctionCompletion printlnCompletion = new FunctionCompletion(provider, "println", "void"); - List params = new ArrayList<>(); - Parameter messageParam = new Parameter(null, "message", true); - messageParam.setDescription("The message to print"); - params.add(messageParam); - printlnCompletion.setParams(params); - printlnCompletion.setShortDescription("Print a message"); - printlnCompletion.setSummary("Print a message"); - provider.addCompletion(printlnCompletion); - } - - public static boolean loadFile(SourceTextArea sourceTextArea, File inputFile) { - TextEditorPane textArea = sourceTextArea.getTextArea(); - if (inputFile.isDirectory()) { - SpecsLogs.warn( - "Input file cannot be a directory: '" + SpecsIo.getCanonicalPath(inputFile) + "'\n"); - return false; - } - FileLocation location = FileLocation.create(inputFile); - try { - textArea.load(location, null); - textArea.setEncoding(StandardCharsets.UTF_8.name()); - textArea.getDocument().putProperty(DefaultEditorKit.EndOfLineStringProperty, System.lineSeparator()); - - setSyntaxEditingStyle(sourceTextArea, inputFile); - - return true; - } catch (IOException e) { - SpecsLogs.warn("Error message:\n", e); - } - return false; - } - - public static void setSyntaxEditingStyle(SourceTextArea sourceTextArea, File inputFile) { - TextEditorPane textArea = sourceTextArea.getTextArea(); - // System.out.println(textArea.getDocument()); - String extension = SpecsIo.getExtension(inputFile); - if (extension.isEmpty()) { - textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_NONE); - } else if (extension.equals("lara")) { - setLaraTextArea(sourceTextArea); - } else if (extension.equals("js")) { - textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT); - } else if ((extension.equals("h"))) { - textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_C); - } else if ((extension.equals("hpp"))) { - textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_CPLUSPLUS); - } else { - textArea.setSyntaxEditingStyle("text/" + extension); - } - - } - - /* private static void addToolBar(JPanel cp) { - // Create a toolbar with searching options. - JToolBar toolBar = new JToolBar(); - searchField = new JTextField(30); - toolBar.add(searchField); - final JButton nextButton = new JButton("Find Next"); - nextButton.setActionCommand("FindNext"); - nextButton.addActionListener(this); - toolBar.add(nextButton); - searchField.addActionListener(evt -> nextButton.doClick(0)); - - JButton prevButton = new JButton( - "Find Previous"); - prevButton.setActionCommand("FindPrev"); - prevButton.addActionListener(this); - toolBar.add(prevButton); - regexCB = new JCheckBox("Regex"); - toolBar.add(regexCB); - matchCaseCB = new JCheckBox("Match Case"); - toolBar.add(matchCaseCB); - cp.add(toolBar, BorderLayout.SOUTH); - - } - - @Override - public void actionPerformed(ActionEvent e) { - - // "FindNext" => search forward, "FindPrev" => search backward - String command = e.getActionCommand(); - boolean forward = "FindNext".equals(command); - - // Create an object defining our search parameters. - SearchContext context = new SearchContext(); - String text = searchField.getText(); - if (text.length() == 0) { - return; - } - context.setSearchFor(text); - context.setMatchCase(matchCaseCB.isSelected()); - context.setRegularExpression(regexCB.isSelected()); - context.setSearchForward(forward); - context.setWholeWord(false); - - SearchResult find = SearchEngine.find(textArea, context); - boolean found = find.wasFound(); - if (!found) { - JOptionPane.showMessageDialog(this, "Text not found"); - } - - } - * - * - */ -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/highlight/EditorParser.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/highlight/EditorParser.java deleted file mode 100644 index e44763284..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/highlight/EditorParser.java +++ /dev/null @@ -1,172 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.highlight; - -import java.io.BufferedReader; -import java.util.Collections; -import java.util.List; -import java.util.Optional; -import java.util.function.Consumer; -import java.util.stream.Collectors; - -import javax.swing.text.Element; - -import org.dojo.jsl.parser.ast.ASTAspectDef; -import org.dojo.jsl.parser.ast.ASTStart; -import org.dojo.jsl.parser.ast.ParseException; -import org.dojo.jsl.parser.ast.Token; -import org.dojo.jsl.parser.ast.TokenMgrError; -import org.fife.io.DocumentReader; -import org.fife.ui.rsyntaxtextarea.RSyntaxDocument; -import org.fife.ui.rsyntaxtextarea.parser.AbstractParser; -import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; -import org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice; -import org.fife.ui.rsyntaxtextarea.parser.ParseResult; - -import larac.LaraC; -import larac.exceptions.SyntaxException; -import pt.up.fe.specs.util.SpecsCollections; - -public class EditorParser extends AbstractParser { - - private static final int MAX_NUM_TOKENS = 6; - private ASTStart javaCCParser; - private List> listeners; - - public EditorParser() { - listeners = SpecsCollections.newArrayList(); - } - - public Optional getParserResult() { - return Optional.ofNullable(javaCCParser); - } - - public List getAspectList() { - - if (javaCCParser == null) { - return Collections.emptyList(); - } - - return javaCCParser.getDescendantsOfType(ASTAspectDef.class); - } - - /** - * Adds listener to be executed when the code is parsed successfully - */ - public void addListener(Consumer ast) { - listeners.add(ast); - } - - @Override - public ParseResult parse(RSyntaxDocument doc, String style) { - - // lines = new ArrayList<>(); - DefaultParseResult result = new DefaultParseResult(this); - - Element root = doc.getDefaultRootElement(); - result.setParsedLines(0, root.getElementCount() - 1); - - // Only LARA syntax is supported right now - if (doc.getLength() == 0 || !style.equals("text/lara")) { - return result; - } - - try { - DocumentReader docReader = new DocumentReader(doc); - try (BufferedReader br = new BufferedReader(docReader)) { - javaCCParser = LaraC.javaCCParser(br); - - // List descendantsOfType = javaCCParser.getDescendantsOfType(ASTAspectDef.class); - // Handler handler = new Handler(doc); - // CInputSource input = new InputSource(r); - // sp.parse(input, handler); - // r.close(); - } - } catch (SyntaxException e) { - if (e.getExceptions().isEmpty()) { - addException(result, e); - } else { - for (Throwable exception : e.getExceptions()) { - - addException(result, exception); - } - } - - } - // catch (Error e) { - // addException(result, e); - // } - catch (Throwable e) { - - addException(result, e); - } - - if (javaCCParser != null) { - listeners.forEach(l -> l.accept(javaCCParser)); - } - - return result; - } - - // private List lines; - - private void addException(DefaultParseResult result, Throwable exception) { - - if (exception instanceof ParseException) { - ParseException parseException = (ParseException) exception; - Token token = parseException.getNextToken(); - int line = 0; - if (token != null) { - - line = token.beginLine - 1; - } - // if (lines.contains(line)) { - // return; - // } - // int col = token.beginColumn - 1; - // int colEnd = token.endColumn + 1; - // colEnd = colEnd < 1 ? 1 : colEnd; - // String errorMessage = parseException.getErrorMessage(); - // errorMessage = StringUtils.firstCharToUpper(errorMessage); - - String errorMessage = parseException.getErrorMessage(); - if (errorMessage != null) { - errorMessage = errorMessage.substring(0, errorMessage.indexOf(':') + 1); - } - List expectedTokenSet = parseException.expectedTokenSet; - if (expectedTokenSet != null) { - if (expectedTokenSet.size() > MAX_NUM_TOKENS) { - expectedTokenSet = expectedTokenSet.subList(0, MAX_NUM_TOKENS); - } - errorMessage += expectedTokenSet.stream().map(s -> s.replace("\"", "'")) - .collect(Collectors.joining("\n", "\n", "")); - } - result.addNotice(new DefaultParserNotice(this, errorMessage, line - // , col,colEnd - )); - // lines.add(line); - } else if (exception instanceof TokenMgrError) { - - TokenMgrError tokenError = (TokenMgrError) exception; - int line = tokenError.getErrorLine() - 1; - String errorMessage = tokenError.getLexicalError(); - result.addNotice(new DefaultParserNotice(this, errorMessage, line)); - } else { - System.out.println("Unhandled exception type: " + exception); - result.addNotice(new DefaultParserNotice(this, - "Error when parsing: " + exception.getMessage(), 0, -1, -1)); - } - } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/highlight/LaraTokenMaker.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/highlight/LaraTokenMaker.java deleted file mode 100644 index b30271316..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/highlight/LaraTokenMaker.java +++ /dev/null @@ -1,1010 +0,0 @@ -/* - * 10/08/2004 - * - * JavaScriptTokenMaker.java - An object that can take a chunk of text and return a linked list of Tokens - * representing it in the JavaScript programming language. Copyright (C) 2004 Robert Futrell robert_futrell at - * users.sourceforge.net http://fifesoft.com/rsyntaxtextarea - * - * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General - * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -package org.lara.interpreter.joptions.panels.editor.highlight; - -import javax.swing.text.Segment; - -import org.dojo.jsl.parser.ast.LARAEcmaScriptConstants; -import org.fife.ui.rsyntaxtextarea.AbstractTokenMaker; -import org.fife.ui.rsyntaxtextarea.RSyntaxUtilities; -import org.fife.ui.rsyntaxtextarea.Token; -import org.fife.ui.rsyntaxtextarea.TokenMap; -import org.fife.ui.rsyntaxtextarea.TokenTypes; - -/** - * A token maker that turns text into a linked list of Tokens for syntax highlighting in the JavaScript - * programming language. - * - * @author Robert Futrell - * @version 0.1 - */ -public class LaraTokenMaker extends AbstractTokenMaker { - - static final String[] predefinedMethods = { "getRoot", "println", "toType", "dot", "printObject", "readFile", - "fileToJSON", - "read", "load", "writeFile", "JSONtoFile", "isJoinPoint" }; - // ,"errorln", "warnln" - - protected final String operators = "+-*/%!=<>^&|?:~"; - - protected final String separators = "()[]{}"; - - protected final String separators2 = ".,;"; // Characters you don't want syntax highlighted but separate - // identifiers. - - protected final String hexCharacters = "0123456789ABCDEFabcdef"; - - protected final String numberEndChars = "FfLl"; // Characters used to specify literal number types. - - private int currentTokenStart; - private int currentTokenType; - - /** - * Constructor. - */ - public LaraTokenMaker() { - super(); // Initializes tokensToHighlight. - } - - /** - * Checks the token to give it the exact ID it deserves before being passed up to the super method. - * - * @param segment - * Segment to get text from. - * @param start - * Start offset in segment of token. - * @param end - * End offset in segment of token. - * @param tokenType - * The token's type. - * @param startOffset - * The offset in the document at which the token occurs. - */ - @Override - public void addToken(Segment segment, int start, int end, int tokenType, int startOffset) { - - switch (tokenType) { - // Since reserved words, functions, and data types are all passed - // into here as "identifiers," we have to see what the token - // really is... - case TokenTypes.IDENTIFIER: - int value = wordsToHighlight.get(segment, start, end); - if (value != -1) { - tokenType = value; - } - break; - case TokenTypes.WHITESPACE: - case TokenTypes.SEPARATOR: - case TokenTypes.OPERATOR: - case TokenTypes.ERROR_IDENTIFIER: - case TokenTypes.ERROR_NUMBER_FORMAT: - case TokenTypes.ERROR_STRING_DOUBLE: - case TokenTypes.ERROR_CHAR: - case TokenTypes.COMMENT_EOL: - case TokenTypes.COMMENT_MULTILINE: - case TokenTypes.LITERAL_BOOLEAN: - case TokenTypes.LITERAL_NUMBER_DECIMAL_INT: - case TokenTypes.LITERAL_NUMBER_FLOAT: - case TokenTypes.LITERAL_NUMBER_HEXADECIMAL: - case TokenTypes.LITERAL_STRING_DOUBLE_QUOTE: - case TokenTypes.LITERAL_CHAR: - break; - - default: - new Exception("Unknown tokenType: '" + tokenType + "'").printStackTrace(); - tokenType = TokenTypes.IDENTIFIER; - break; - - } - - super.addToken(segment, start, end, tokenType, startOffset); - - } - - /** - * Returns the text to place at the beginning and end of a line to "comment" it in a this programming language. - * - * @return The start and end strings to add to a line to "comment" it out. - */ - @Override - public String[] getLineCommentStartAndEnd(int languageIndex) { - return new String[] { "//", null }; - } - - /** - * Returns the words to highlightfor the JavaScript programming language. - * - * @return A TokenMap containing the words to highlight for the JavaScript programming language. - * @see org.fife.ui.rsyntaxtextarea.AbstractTokenMaker#getWordsToHighlight - */ - @Override - public TokenMap getWordsToHighlight() { - - TokenMap tokenMap = new TokenMap(true);// 52); - - addLaraKeywords(tokenMap); - addJavaScriptKeywords(tokenMap); - - return tokenMap; - - } - - private static void addLaraKeywords(TokenMap tokenMap) { - int reservedWord = TokenTypes.RESERVED_WORD; - for (int i = LARAEcmaScriptConstants.INCLUDE; i < LARAEcmaScriptConstants.TRY; i++) { - String tokenImage = LARAEcmaScriptConstants.tokenImage[i]; - tokenImage = tokenImage.replace("\"", ""); - tokenMap.put(tokenImage, reservedWord); - } - tokenMap.put("null", reservedWord); // "null" is a token that was not present in the range [include,try] - tokenMap.put("instanceof", reservedWord); // "instanceof" is a token that was not present in the range - // [include,try] - addDefaultMethods(tokenMap); - - int dataType = TokenTypes.DATA_TYPE; - tokenMap.put("Joinpoint", dataType); - tokenMap.put("LaraObject", dataType); - } - - private static void addDefaultMethods(TokenMap tokenMap) { - int function = TokenTypes.FUNCTION; - for (String func : predefinedMethods) { - - tokenMap.put(func, function); - } - - } - - private static void addJavaScriptKeywords(TokenMap tokenMap) { - - /* JavaScript Keywords are automatically added by the lara loop*/ - - int literalBoolean = TokenTypes.LITERAL_BOOLEAN; - tokenMap.put("false", literalBoolean); - tokenMap.put("true", literalBoolean); - - int dataType = TokenTypes.DATA_TYPE; - tokenMap.put("boolean", dataType); - tokenMap.put("byte", dataType); - tokenMap.put("char", dataType); - tokenMap.put("double", dataType); - tokenMap.put("float", dataType); - tokenMap.put("int", dataType); - tokenMap.put("long", dataType); - tokenMap.put("short", dataType); - } - - /** - * Returns the first token in the linked list of tokens generated from text. This method must be - * implemented by subclasses so they can correctly implement syntax highlighting. - * - * @param text - * The text from which to get tokens. - * @param initialTokenType - * The token type we should start with. - * @param startOffset - * The offset into the document at which text starts. - * @return The first Token in a linked list representing the syntax highlighted text. - */ - @Override - public Token getTokenList(Segment text, int initialTokenType, - int startOffset) { - - resetTokenList(); - - char[] array = text.array; - int offset = text.offset; - int count = text.count; - int end = offset + count; - - // See, when we find a token, its starting position is always of the - // form: 'startOffset + (currentTokenStart-offset)'; but since - // startOffset and offset are constant, tokens' starting positions - // become: 'newStartOffset+currentTokenStart' for one less subraction - // operation. - int newStartOffset = startOffset - offset; - - currentTokenStart = offset; - currentTokenType = initialTokenType; - boolean backslash = false; - boolean numContainsExponent = false; - boolean numContainsEndCharacter = false; - - for (int i = offset; i < end; i++) { - - char c = array[i]; - - switch (currentTokenType) { - - case TokenTypes.NULL: - - currentTokenStart = i; // Starting a new token here. - - switch (c) { - - case ' ': - case '\t': - currentTokenType = TokenTypes.WHITESPACE; - break; - - case '"': - if (backslash) { // Escaped double quote => call '"' an identifier.. - addToken(text, currentTokenStart, i, TokenTypes.IDENTIFIER, - newStartOffset + currentTokenStart); - backslash = false; - } else { - currentTokenType = TokenTypes.ERROR_STRING_DOUBLE; - } - break; - - case '\'': - if (backslash) { // Escaped single quote => call '\'' an identifier. - addToken(text, currentTokenStart, i, TokenTypes.IDENTIFIER, - newStartOffset + currentTokenStart); - backslash = false; - } else { - currentTokenType = TokenTypes.ERROR_CHAR; - } - break; - - case '\\': - addToken(text, currentTokenStart, i, TokenTypes.IDENTIFIER, - newStartOffset + currentTokenStart); - currentTokenType = TokenTypes.NULL; - backslash = !backslash; - break; - - default: - if (RSyntaxUtilities.isDigit(c)) { - currentTokenType = TokenTypes.LITERAL_NUMBER_DECIMAL_INT; - break; - } else if (isIdentifier(c)) { - currentTokenType = TokenTypes.IDENTIFIER; - break; - } - int indexOf = operators.indexOf(c, 0); - if (indexOf > -1) { - currentTokenStart = i; - currentTokenType = TokenTypes.OPERATOR; - break; - } - indexOf = separators.indexOf(c, 0); - if (indexOf > -1) { - addToken(text, currentTokenStart, i, TokenTypes.SEPARATOR, - newStartOffset + currentTokenStart); - currentTokenType = TokenTypes.NULL; - break; - } - indexOf = separators2.indexOf(c, 0); - if (indexOf > -1) { - addToken(text, currentTokenStart, i, TokenTypes.IDENTIFIER, - newStartOffset + currentTokenStart); - currentTokenType = TokenTypes.NULL; - break; - } - currentTokenType = TokenTypes.ERROR_IDENTIFIER; - break; - - } // End of switch (c). - - break; - - case TokenTypes.WHITESPACE: - - switch (c) { - - case ' ': - case '\t': - break; // Still whitespace. - - case '\\': - addToken(text, currentTokenStart, i - 1, TokenTypes.WHITESPACE, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.IDENTIFIER, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - backslash = true; // Previous char whitespace => this must be first backslash. - break; - - case '"': // Don't need to worry about backslashes as previous char is space. - addToken(text, currentTokenStart, i - 1, TokenTypes.WHITESPACE, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.ERROR_STRING_DOUBLE; - backslash = false; - break; - - case '\'': // Don't need to worry about backslashes as previous char is space. - addToken(text, currentTokenStart, i - 1, TokenTypes.WHITESPACE, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.ERROR_CHAR; - backslash = false; - break; - - default: // Add the whitespace token and start anew. - - addToken(text, currentTokenStart, i - 1, TokenTypes.WHITESPACE, - newStartOffset + currentTokenStart); - currentTokenStart = i; - - if (RSyntaxUtilities.isDigit(c)) { - currentTokenType = TokenTypes.LITERAL_NUMBER_DECIMAL_INT; - break; - } else if (isIdentifier(c)) { // added '$' - currentTokenType = TokenTypes.IDENTIFIER; - break; - } - int indexOf = operators.indexOf(c, 0); - if (indexOf > -1) { - currentTokenStart = i; - currentTokenType = TokenTypes.OPERATOR; - break; - } - indexOf = separators.indexOf(c, 0); - if (indexOf > -1) { - addToken(text, i, i, TokenTypes.SEPARATOR, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - break; - } - indexOf = separators2.indexOf(c, 0); - if (indexOf > -1) { - addToken(text, i, i, TokenTypes.IDENTIFIER, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - break; - } - currentTokenType = TokenTypes.ERROR_IDENTIFIER; - - } // End of switch (c). - - break; - - default: // Should never happen - case TokenTypes.IDENTIFIER: - - switch (c) { - - case ' ': - case '\t': - addToken(text, currentTokenStart, i - 1, TokenTypes.IDENTIFIER, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.WHITESPACE; - break; - - case '"': // Don't need to worry about backslashes as previous char is non-backslash. - addToken(text, currentTokenStart, i - 1, TokenTypes.IDENTIFIER, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.ERROR_STRING_DOUBLE; - backslash = false; - break; - - case '\'': // Don't need to worry about backslashes as previous char is non-backslash. - addToken(text, currentTokenStart, i - 1, TokenTypes.IDENTIFIER, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.ERROR_CHAR; - backslash = false; - break; - - case '\\': - addToken(text, currentTokenStart, i - 1, TokenTypes.IDENTIFIER, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.IDENTIFIER, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - backslash = true; - break; - - default: - if (isIdentifier(c) || RSyntaxUtilities.isDigit(c)) { // added '$' - break; // Still an identifier of some type. - } - int indexOf = operators.indexOf(c); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.IDENTIFIER, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.OPERATOR; - break; - } - indexOf = separators.indexOf(c, 0); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.IDENTIFIER, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.SEPARATOR, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - break; - } - indexOf = separators2.indexOf(c, 0); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.IDENTIFIER, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.IDENTIFIER, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - break; - } - currentTokenType = TokenTypes.ERROR_IDENTIFIER; - - } // End of switch (c). - - break; - - case TokenTypes.LITERAL_NUMBER_DECIMAL_INT: - - // Reset our boolean states if we only have one digit char before - // the current one. - if (currentTokenStart == i - 1) { - numContainsExponent = false; - numContainsEndCharacter = false; - } - - switch (c) { - - case ' ': - case '\t': - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_DECIMAL_INT, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.WHITESPACE; - break; - - case '"': // Don't need to worry about backslashes as previous char is non-backslash. - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_DECIMAL_INT, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.ERROR_STRING_DOUBLE; - backslash = false; - break; - - case '\'': // Don't need to worry about backslashes as previous char is non-backslash. - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_DECIMAL_INT, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.ERROR_CHAR; - backslash = false; - break; - - case '\\': - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_DECIMAL_INT, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.IDENTIFIER, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - backslash = true; - break; - - default: - - if (RSyntaxUtilities.isDigit(c)) { - break; // Still a literal number. - } else if (c == 'e') { // Exponent. - if (numContainsExponent == false) { - numContainsExponent = true; - } else { - currentTokenType = TokenTypes.ERROR_NUMBER_FORMAT; - } - break; - } else if (c == '.') { // Decimal point. - if (numContainsExponent == true) { - currentTokenType = TokenTypes.ERROR_NUMBER_FORMAT; - } else { - currentTokenType = TokenTypes.LITERAL_NUMBER_FLOAT; - } - break; - } - int indexOf = numberEndChars.indexOf(c); - if (indexOf > -1) { // Numbers can end in 'f','F','l','L', etc. - if (numContainsEndCharacter == true) { - currentTokenType = TokenTypes.ERROR_NUMBER_FORMAT; - } else { - numContainsEndCharacter = true; - } - break; - } - indexOf = operators.indexOf(c); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_DECIMAL_INT, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.OPERATOR; - break; - } - indexOf = separators.indexOf(c); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_DECIMAL_INT, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.SEPARATOR, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - break; - } - indexOf = separators2.indexOf(c); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_DECIMAL_INT, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.IDENTIFIER, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - break; - } - - // Otherwise, the token is an error. - currentTokenType = TokenTypes.ERROR_NUMBER_FORMAT; - - } // End of switch (c). - - break; - - case TokenTypes.LITERAL_NUMBER_FLOAT: - - switch (c) { - - case ' ': - case '\t': - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_FLOAT, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.WHITESPACE; - break; - - case '"': // Don't need to worry about backslashes as previous char is non-backslash. - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_FLOAT, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.ERROR_STRING_DOUBLE; - backslash = false; - break; - - case '\'': // Don't need to worry about backslashes as previous char is non-backslash. - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_FLOAT, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.ERROR_CHAR; - backslash = false; - break; - - case '\\': - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_FLOAT, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.IDENTIFIER, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - backslash = true; - break; - - default: - - if (RSyntaxUtilities.isDigit(c)) { - break; // Still a literal number. - } else if (c == 'e') { // Exponent. - if (numContainsExponent == false) { - numContainsExponent = true; - } else { - currentTokenType = TokenTypes.ERROR_NUMBER_FORMAT; - } - break; - } else if (c == '.') { // Second decimal point; must catch now because it's a "separator" below. - currentTokenType = TokenTypes.ERROR_NUMBER_FORMAT; - break; - } - int indexOf = numberEndChars.indexOf(c); - if (indexOf > -1) { // Numbers can end in 'f','F','l','L', etc. - if (numContainsEndCharacter == true) { - currentTokenType = TokenTypes.ERROR_NUMBER_FORMAT; - } else { - numContainsEndCharacter = true; - } - break; - } - indexOf = operators.indexOf(c); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_FLOAT, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.OPERATOR; - break; - } - indexOf = separators.indexOf(c); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_FLOAT, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.SEPARATOR, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - break; - } - indexOf = separators2.indexOf(c); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_FLOAT, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.IDENTIFIER, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - break; - } - - // Otherwise, the token is an error. - currentTokenType = TokenTypes.ERROR_NUMBER_FORMAT; - - } // End of switch (c). - - break; - - case TokenTypes.LITERAL_NUMBER_HEXADECIMAL: - - switch (c) { - - case ' ': - case '\t': - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_HEXADECIMAL, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.WHITESPACE; - break; - - case '"': // Don't need to worry about backslashes as previous char is non-backslash. - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_HEXADECIMAL, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.ERROR_STRING_DOUBLE; - backslash = false; - break; - - case '\'': // Don't need to worry about backslashes as previous char is non-backslash. - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_HEXADECIMAL, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.ERROR_CHAR; - backslash = false; - break; - - case '\\': - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_HEXADECIMAL, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.IDENTIFIER, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - backslash = true; - break; - - default: - - if (c == 'e') { // Exponent. - if (numContainsExponent == false) { - numContainsExponent = true; - } else { - currentTokenType = TokenTypes.ERROR_NUMBER_FORMAT; - } - break; - } - int indexOf = hexCharacters.indexOf(c); - if (indexOf > -1) { - break; // Still a hexadecimal number. - } - indexOf = numberEndChars.indexOf(c); - if (indexOf > -1) { // Numbers can end in 'f','F','l','L', etc. - if (numContainsEndCharacter == true) { - currentTokenType = TokenTypes.ERROR_NUMBER_FORMAT; - } else { - numContainsEndCharacter = true; - } - break; - } - indexOf = operators.indexOf(c); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_HEXADECIMAL, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.OPERATOR; - break; - } - indexOf = separators.indexOf(c); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_HEXADECIMAL, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.SEPARATOR, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - break; - } - indexOf = separators2.indexOf(c); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.LITERAL_NUMBER_HEXADECIMAL, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.IDENTIFIER, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - break; - } - - // Otherwise, the token is an error. - currentTokenType = TokenTypes.ERROR_NUMBER_FORMAT; - - } // End of switch (c). - - break; - - case TokenTypes.COMMENT_MULTILINE: - - // Find either end of MLC or end of the current line. - while (i < end - 1) { - if (array[i] == '*' && array[i + 1] == '/') { - addToken(text, currentTokenStart, i + 1, TokenTypes.COMMENT_MULTILINE, - newStartOffset + currentTokenStart); - i = i + 1; - currentTokenType = TokenTypes.NULL; - backslash = false; // Backslashes can't accumulate before and after a comment... - break; - } - i++; - } - - break; - - case TokenTypes.COMMENT_EOL: - i = end - 1; - addToken(text, currentTokenStart, i, TokenTypes.COMMENT_EOL, - newStartOffset + currentTokenStart); - // We need to set token type to null so at the bottom we don't add one more token. - currentTokenType = TokenTypes.NULL; - break; - - // We need this state because comments always start with '/', which is an operator. - // Note that when we enter this state, the PREVIOUS character was an operator. - case TokenTypes.OPERATOR: - - if (array[i - 1] == '/') { // Possibility of comments. - - if (c == '*') { - currentTokenType = TokenTypes.COMMENT_MULTILINE; - break; - } - - else if (c == '/') { - currentTokenType = TokenTypes.COMMENT_EOL; - i = end - 1; // Since we know the rest of the line is in this token. - } - - else { - // We MUST add the token at the previous char now; if we don't and let - // operators accumulate before we print them, we will mess up syntax - // highlighting if we get an end-of-line comment. - addToken(text, currentTokenStart, i - 1, TokenTypes.OPERATOR, - newStartOffset + currentTokenStart); - currentTokenType = TokenTypes.NULL; - i = i - 1; - } - - } - - else { - - addToken(text, currentTokenStart, i - 1, TokenTypes.OPERATOR, - newStartOffset + currentTokenStart); - - // Hack to keep code size down... - i--; - currentTokenType = TokenTypes.NULL; - - } - - break; - - case TokenTypes.ERROR_IDENTIFIER: - - switch (c) { - - case ' ': - case '\t': - addToken(text, currentTokenStart, i - 1, TokenTypes.ERROR_IDENTIFIER, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.WHITESPACE; - break; - - case '"': // Don't need to worry about backslashes as previous char is non-backslash. - addToken(text, currentTokenStart, i - 1, TokenTypes.ERROR_IDENTIFIER, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.ERROR_STRING_DOUBLE; - backslash = false; - break; - - case '\'': // Don't need to worry about backslashes as previous char is non-backslash. - addToken(text, currentTokenStart, i - 1, TokenTypes.ERROR_IDENTIFIER, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.ERROR_CHAR; - backslash = false; - break; - - case ';': - addToken(text, currentTokenStart, i - 1, TokenTypes.ERROR_IDENTIFIER, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.IDENTIFIER, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - break; - - case '\\': - addToken(text, currentTokenStart, i - 1, TokenTypes.ERROR_IDENTIFIER, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.IDENTIFIER, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - backslash = true; // Must be first backslash in a row since previous character is identifier char. - break; - - default: - int indexOf = operators.indexOf(c); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.ERROR_IDENTIFIER, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.OPERATOR; - } - indexOf = separators.indexOf(c); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.ERROR_IDENTIFIER, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.SEPARATOR, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - } - indexOf = separators2.indexOf(c); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.ERROR_IDENTIFIER, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.IDENTIFIER, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - } - - } // End of switch (c). - - break; - - case TokenTypes.ERROR_NUMBER_FORMAT: - - switch (c) { - - case ' ': - case '\t': - addToken(text, currentTokenStart, i - 1, TokenTypes.ERROR_NUMBER_FORMAT, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.WHITESPACE; - break; - - case '"': // Don't need to worry about backslashes as previous char is non-backslash. - addToken(text, currentTokenStart, i - 1, TokenTypes.ERROR_NUMBER_FORMAT, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.ERROR_STRING_DOUBLE; - backslash = false; - break; - - case '\'': // Don't need to worry about backslashes as previous char is non-backslash. - addToken(text, currentTokenStart, i - 1, TokenTypes.ERROR_NUMBER_FORMAT, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.ERROR_CHAR; - backslash = false; - break; - - case ';': - addToken(text, currentTokenStart, i - 1, TokenTypes.ERROR_NUMBER_FORMAT, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.IDENTIFIER, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - break; - - case '\\': - addToken(text, currentTokenStart, i - 1, TokenTypes.ERROR_NUMBER_FORMAT, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.IDENTIFIER, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - backslash = true; // Must be first backslash in a row since previous char is a number char. - break; - - default: - - // Could be going into hexadecimal. - int indexOf = hexCharacters.indexOf(c); - if (indexOf > -1 - && (i - currentTokenStart == 2 && array[i - 1] == 'x' && array[i - 2] == '0')) { - currentTokenType = TokenTypes.LITERAL_NUMBER_HEXADECIMAL; - break; - } - - indexOf = operators.indexOf(c); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.ERROR_NUMBER_FORMAT, - newStartOffset + currentTokenStart); - currentTokenStart = i; - currentTokenType = TokenTypes.OPERATOR; - } - indexOf = separators.indexOf(c); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.ERROR_NUMBER_FORMAT, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.SEPARATOR, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - } - indexOf = separators2.indexOf(c); - if (indexOf > -1) { - addToken(text, currentTokenStart, i - 1, TokenTypes.ERROR_NUMBER_FORMAT, - newStartOffset + currentTokenStart); - addToken(text, i, i, TokenTypes.IDENTIFIER, newStartOffset + i); - currentTokenType = TokenTypes.NULL; - } - - } // End of switch (c). - - break; - - case TokenTypes.ERROR_CHAR: - - if (c == '\\') { - backslash = !backslash; // Okay because if we got in here, backslash was initially false. - } else { - - if (c == '\'' && !backslash) { - addToken(text, currentTokenStart, i, TokenTypes.LITERAL_CHAR, - newStartOffset + currentTokenStart); - currentTokenType = TokenTypes.NULL; - // backslash is definitely false when we leave. - } - - backslash = false; // Need to set backslash to false here as a character was typed. - - } - // Otherwise, we're still an unclosed char... - - break; - - case TokenTypes.ERROR_STRING_DOUBLE: - - if (c == '\\') { - backslash = !backslash; // Okay because if we got in here, backslash was initially false. - } else { - if (c == '"' && !backslash) { - addToken(text, currentTokenStart, i, TokenTypes.LITERAL_STRING_DOUBLE_QUOTE, - newStartOffset + currentTokenStart); - currentTokenType = TokenTypes.NULL; - // backslash is definitely false when we leave. - } - - backslash = false; // Need to set backslash to false here as a character was typed. - - } - // Otherwise, we're still an unclosed string... - - break; - - } // End of switch (currentTokenType). - - } // End of for (int i=offset; i listener; - - public DocumentChangedListener(Consumer listener) { - this.listener = listener; - } - - @Override - public void changedUpdate(DocumentEvent e) { - listener.accept(e); - } - - @Override - public void insertUpdate(DocumentEvent e) { - } - - @Override - public void removeUpdate(DocumentEvent e) { - } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/EditorListener.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/EditorListener.java deleted file mode 100644 index ea2084bdc..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/EditorListener.java +++ /dev/null @@ -1,159 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.listeners; - -import java.util.Timer; -import java.util.function.Supplier; - -import javax.swing.JComponent; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; - -import org.fife.ui.rsyntaxtextarea.RSyntaxTextAreaEditorKit; -import org.fife.ui.rsyntaxtextarea.TextEditorPane; -import org.lara.interpreter.joptions.panels.editor.tabbed.SourceTextArea; -import org.lara.interpreter.joptions.panels.editor.tabbed.TabsContainerPanel; - -import pt.up.fe.specs.util.utilities.SpecsTimerTask; - -public class EditorListener { - - private static final long FOLD_REPARSING_DELAY_MS = 1500; - - private final SourceTextArea tab; - private Timer parseTimer; - - public static EditorListener newInstance(SourceTextArea laraTab) { - return new EditorListener(laraTab); - } - - public EditorListener(SourceTextArea laraTab) { - tab = laraTab; - parseTimer = new Timer(); - TabsContainerPanel tabParent = tab.getTabbedParent(); - mapActions(laraTab.getTextArea(), () -> laraTab, tabParent); - - TextEditorPane textArea = tab.getTextArea(); - - textArea.getDocument().addDocumentListener(new ChangeListener()); - // textArea.setTransferHandler(new FileTransferHandler(tabParent::open)); - } - - /** - * Maps common actions to the given component - * - * @param component - * the component in which we are going to add the action - * @param laraTab - * the target lara tab in which we are going to work - * @param tabbedPane - * the pane we are working with - */ - static void mapActions(JComponent component, Supplier laraTab, - TabsContainerPanel tabbedPane) { - - ListenerUtils.mapKeyStroke(component, StrokesAndActions.CTRL_SHIFT_C, - RSyntaxTextAreaEditorKit.rstaToggleCommentAction); - - // These are being used by the menus so are simply duplicated! - // ListenerUtils.mapAction(component, StrokesAndActions.CTRL_S_STROKE, StrokesAndActions.SAVE_ACTION, - // x -> laraTab.get().save()); - // ListenerUtils.mapAction(component, StrokesAndActions.CTRL_SHIFT_S_STROKE, - // StrokesAndActions.SAVE_AS_ACTION, - // x -> tabbedPane.saveAll()); - - // ListenerUtils.mapAction(component, StrokesAndActions.CTRL_O_STROKE, StrokesAndActions.OPEN_ACTION, - // x -> laraTab.get().open()); - // ListenerUtils.mapAction(component, StrokesAndActions.CTRL_W_STROKE, StrokesAndActions.CLOSE_ACTION, - // x -> laraTab.get().close()); - - // ListenerUtils.mapAction(component, StrokesAndActions.F5_STROKE, StrokesAndActions.REFRESH, - // x -> laraTab.get().refresh()); - /** - * Actions that are related to the tabbed pane - */ - // ListenerUtils.mapAction(component, StrokesAndActions.CTRL_N_STROKE, StrokesAndActions.NEW_TAB_ACTION, - // x -> tabbedPane.addTab()); - // ListenerUtils.mapAction(component, StrokesAndActions.CTRL_SHIFT_N_STROKE, - // StrokesAndActions.NEW_TAB_OPEN_ACTION, - // openInNewTab(tabbedPane)); - - ListenerUtils.removeTraversalKeys(component); - - ListenerUtils.mapAction(component, StrokesAndActions.CTRL_SHIFT_TAB, StrokesAndActions.PREVIOUS_ACTION, - x -> tabbedPane.navigatePrevious()); - ListenerUtils.mapAction(component, StrokesAndActions.CTRL_TAB, StrokesAndActions.NEXT_ACTION, - x -> tabbedPane.navigateNext()); - } - - // public static Consumer openInNewTab(TabsContainerPanel tabbedPane) { - // return x -> { - // SourceEditorTab newTab = tabbedPane.addTab(); - // boolean wasOpenned = newTab.open(); - // if (!wasOpenned) { - // newTab.getTabbedParent().closeTab(newTab); - // } - // }; - // } - - public class ChangeListener implements DocumentListener { - - @Override - public void changedUpdate(DocumentEvent e) { - - if (!tab.getOriginalText().equals(tab.getTextArea().getText())) { - // when the text area changes, set timer to reparse the folds - // var start = System.nanoTime(); - parseTimer.cancel(); - parseTimer = new Timer(); - parseTimer.schedule(new SpecsTimerTask(() -> tab.getTextArea().getFoldManager().reparse()), - FOLD_REPARSING_DELAY_MS); - // System.out.println(SpecsStrings.takeTime("TASK", TimeUnit.NANOSECONDS, start)); - - if (!tab.isChanged()) { - tab.getTabbedParent().setChanged(tab); - tab.setChanged(true); - } - } else { - if (tab.isChanged()) { - tab.getTabbedParent().setTabTitle(tab); - tab.setChanged(false); - } - } - } - - @Override - public void insertUpdate(DocumentEvent e) { - - } - - @Override - public void removeUpdate(DocumentEvent e) { - - } - - } - - /** - * Perform a given action - * - * @author Tiago - * - * - * interface ActionPerformer { void perform(ActionEvent e); - * - * default Action toAction() { return new GenericAction(this::perform); } } - */ - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/FileTransferHandler.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/FileTransferHandler.java deleted file mode 100644 index b39be04c8..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/FileTransferHandler.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.listeners; - -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.Transferable; -import java.io.File; -import java.util.List; -import java.util.function.Consumer; - -import javax.swing.TransferHandler; - -public class FileTransferHandler extends TransferHandler { - - /** - * - */ - private static final long serialVersionUID = 1L; - - private final Consumer handler; - - public FileTransferHandler(Consumer handler) { - super(); - this.handler = handler; - } - - @Override - public boolean canImport(TransferHandler.TransferSupport info) { - // we only import FileList - if (!info.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { - return false; - } - return true; - } - - @Override - public boolean importData(TransferHandler.TransferSupport info) { - if (!info.isDrop()) { - return false; - } - - // Check for FileList flavor - if (!info.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { - displayDropLocation("The editor doesn't accept a drop of this type."); - return false; - } - - // Get the fileList that is being dropped. - Transferable t = info.getTransferable(); - - try { - @SuppressWarnings("unchecked") - List data = (List) t.getTransferData(DataFlavor.javaFileListFlavor); - for (File file : data) { - - handler.accept(file); - } - return true; - } catch (Exception e) { - displayDropLocation("Problem when importing files: " + e.getMessage()); - } - return false; - - } - - private static void displayDropLocation(String string) { - System.out.println(string); - } -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/FileTreeCellRenderer.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/FileTreeCellRenderer.java deleted file mode 100644 index e80181acf..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/FileTreeCellRenderer.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.listeners; - -import java.awt.Component; -import java.io.File; - -import javax.swing.JLabel; -import javax.swing.JTree; -import javax.swing.UIManager; -import javax.swing.filechooser.FileSystemView; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeCellRenderer; - -import org.lara.interpreter.joptions.panels.editor.components.Explorer; -import org.lara.interpreter.joptions.panels.editor.components.FileNode; -import org.lara.interpreter.joptions.panels.editor.components.WorkDirNode; - -/** A TreeCellRenderer for a File. */ -public class FileTreeCellRenderer extends DefaultTreeCellRenderer { - - /** - * - */ - private final Explorer fileTreeCellRenderer; - - /** - * - */ - private static final long serialVersionUID = 1L; - - private final JLabel label; - - public FileTreeCellRenderer(Explorer explorer) { - fileTreeCellRenderer = explorer; - label = new JLabel(); - label.setOpaque(true); - } - - @Override - public Component getTreeCellRendererComponent( - JTree tree, - Object value, - boolean selected, - boolean expanded, - boolean leaf, - int row, - boolean hasFocus) { - - DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; - FileSystemView fileSystemView = fileTreeCellRenderer.getFileSystemView(); - if (node instanceof FileNode) { - - FileNode fileNode = (FileNode) node; - File file = fileNode.getFile(); - String comment = fileNode.getComment(); - // File file = (File) node.getUserObject(); - label.setIcon(fileSystemView.getSystemIcon(file)); - String systemDisplayName = fileSystemView.getSystemDisplayName(file); - if (comment != null && !comment.isEmpty()) { - systemDisplayName = "" + systemDisplayName + " " + comment - + ""; - } - label.setText(systemDisplayName); - label.setToolTipText(file.getPath()); - } else if (node instanceof WorkDirNode) { - - label.setText(node.getUserObject().toString()); - label.setIcon(fileSystemView.getSystemIcon(new File("."))); - } else { - - label.setText(node.getUserObject().toString()); - label.setIcon(UIManager.getIcon("FileView.fileIcon")); - } - if (selected) { // && !file.isDirectory()) { - label.setBackground(backgroundSelectionColor); - label.setForeground(textSelectionColor); - } else { - label.setForeground(textNonSelectionColor); - - label.setBackground(backgroundNonSelectionColor); - } - - return label; - } -} \ No newline at end of file diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/FileWorkers.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/FileWorkers.java deleted file mode 100644 index 3fe8190b8..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/FileWorkers.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.listeners; - -public class FileWorkers { - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/FocusGainedListener.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/FocusGainedListener.java deleted file mode 100644 index def1d81bd..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/FocusGainedListener.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.listeners; - -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.util.function.Consumer; - -public class FocusGainedListener implements FocusListener { - - private final Consumer gainFocusListener; - - public FocusGainedListener(Consumer gainFocusListener) { - super(); - this.gainFocusListener = gainFocusListener; - } - - @Override - public void focusGained(FocusEvent e) { - gainFocusListener.accept(e); - } - - @Override - public void focusLost(FocusEvent e) { - - } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/FocusLostListener.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/FocusLostListener.java deleted file mode 100644 index 859bb8932..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/FocusLostListener.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.listeners; - -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.util.function.Consumer; - -public class FocusLostListener implements FocusListener { - - private final Consumer lostFocusListener; - - public FocusLostListener(Consumer lostFocusListener) { - super(); - this.lostFocusListener = lostFocusListener; - } - - @Override - public void focusGained(FocusEvent e) { - } - - @Override - public void focusLost(FocusEvent e) { - - lostFocusListener.accept(e); - } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/GenericKeyListener.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/GenericKeyListener.java deleted file mode 100644 index d8d4ad2ee..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/GenericKeyListener.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.listeners; - -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.util.function.Consumer; - -public class GenericKeyListener implements KeyListener { - - private Consumer onType; - private Consumer onPress; - private Consumer onRelease; - - public GenericKeyListener() { - onType = onPress = onRelease = empty(); - } - - public GenericKeyListener onType(Consumer listener) { - onType = listener; - return this; - } - - public GenericKeyListener onPressed(Consumer listener) { - onPress = listener; - return this; - } - - public GenericKeyListener onRelease(Consumer listener) { - onRelease = listener; - return this; - } - - @Override - public void keyPressed(KeyEvent e) { - onPress.accept(e); - } - - @Override - public void keyReleased(KeyEvent e) { - onRelease.accept(e); - } - - @Override - public void keyTyped(KeyEvent e) { - onType.accept(e); - } - - private static Consumer empty() { - return e -> { - }; - } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/ListenerUtils.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/ListenerUtils.java deleted file mode 100644 index 53152f516..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/ListenerUtils.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.listeners; - -import java.awt.AWTKeyStroke; -import java.awt.KeyboardFocusManager; -import java.awt.event.ActionEvent; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Consumer; - -import javax.swing.ActionMap; -import javax.swing.InputMap; -import javax.swing.JComponent; -import javax.swing.KeyStroke; - -import pt.up.fe.specs.util.swing.GenericActionListener; - -public class ListenerUtils { - - // tab.getTextArea() - /** - * Maps a keystroke to a new action in the given component - * - * @param component - * @param stroke - * @param actionName - * @param performer - */ - public static void mapAction(JComponent component, KeyStroke stroke, String actionName, - Consumer performer) { - InputMap im = component.getInputMap(); - ActionMap am = component.getActionMap(); - - im.put(stroke, actionName); - am.put(actionName, GenericActionListener.newInstance(performer)); - } - - /** - * Map a keystroke to an action - * - * @param component - * @param stroke - * @param actionName - */ - public static void mapKeyStroke(JComponent component, KeyStroke stroke, String actionName) { - InputMap im = component.getInputMap(); - im.put(stroke, actionName); - } - - /** - * need to remove these strokes when we want to use CTRL+[SHIFT+]TAB - * - * @param component - */ - static void removeTraversalKeys(JComponent component) { - Set forwardKeys = new HashSet<>( - component.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS)); - forwardKeys.remove(StrokesAndActions.CTRL_TAB); - component.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forwardKeys); - Set backwardKeys = new HashSet<>( - component.getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS)); - backwardKeys.remove(StrokesAndActions.CTRL_SHIFT_TAB); - component.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, backwardKeys); - } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/StrokesAndActions.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/StrokesAndActions.java deleted file mode 100644 index 1ed3b1bc1..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/StrokesAndActions.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.listeners; - -import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; - -import javax.swing.KeyStroke; - -public interface StrokesAndActions { - - // Utilities - - final int CTRL = InputEvent.CTRL_MASK; - // final int CTRL = InputEvent.CTRL_DOWN_MASK; - final int SHIFT = InputEvent.SHIFT_MASK; - // final int SHIFT = InputEvent.SHIFT_DOWN_MASK; - final int CTRL_SHIFT = StrokesAndActions.CTRL | StrokesAndActions.SHIFT; - - // Actions key - // public final String NEW_TAB_ACTION = "new_tab"; - // public final String NEW_TAB_OPEN_ACTION = "new_tab_and_open"; - // public final String SAVE_ACTION = "save_tab"; - // public final String SAVE_AS_ACTION = "save_as_tab"; - // public final String SAVE_ALL_ACTION = "save_all_tab"; - // public final String OPEN_ACTION = "open_tab"; - // public final String CLOSE_ACTION = "close_tab"; - // public final String CLOSE_ALL_ACTION = "close_all_tab"; - // public final String REFRESH = "refreshTab"; - public final String PREVIOUS_ACTION = "navigatePrevious"; - public final String NEXT_ACTION = "navigateNext"; - - // KeyStrokes - public final KeyStroke F5 = KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0); - public final KeyStroke F11 = KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0); - public final KeyStroke ENTER = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0); - public final KeyStroke CTRL_F = KeyStroke.getKeyStroke(KeyEvent.VK_F, StrokesAndActions.CTRL); - public final KeyStroke CTRL_N = KeyStroke.getKeyStroke(KeyEvent.VK_N, StrokesAndActions.CTRL); - public final KeyStroke CTRL_M = KeyStroke.getKeyStroke(KeyEvent.VK_M, StrokesAndActions.CTRL); - public final KeyStroke CTRL_O = KeyStroke.getKeyStroke(KeyEvent.VK_O, StrokesAndActions.CTRL); - public final KeyStroke CTRL_S = KeyStroke.getKeyStroke(KeyEvent.VK_S, StrokesAndActions.CTRL); - public final KeyStroke CTRL_T = KeyStroke.getKeyStroke(KeyEvent.VK_T, StrokesAndActions.CTRL); - public final KeyStroke CTRL_W = KeyStroke.getKeyStroke(KeyEvent.VK_W, StrokesAndActions.CTRL); - public final KeyStroke CTRL_F11 = KeyStroke.getKeyStroke(KeyEvent.VK_F11, StrokesAndActions.CTRL); - - public final KeyStroke SHIFT_ENTER = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, StrokesAndActions.SHIFT); - public final KeyStroke CTRL_TAB = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, StrokesAndActions.CTRL); - public final KeyStroke CTRL_SHIFT_TAB = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, StrokesAndActions.CTRL_SHIFT); - public final KeyStroke CTRL_SHIFT_B = KeyStroke.getKeyStroke(KeyEvent.VK_B, StrokesAndActions.CTRL_SHIFT); - public final KeyStroke CTRL_SHIFT_C = KeyStroke.getKeyStroke(KeyEvent.VK_C, StrokesAndActions.CTRL_SHIFT); - public final KeyStroke CTRL_SHIFT_M = KeyStroke.getKeyStroke(KeyEvent.VK_M, StrokesAndActions.CTRL_SHIFT); - public final KeyStroke CTRL_SHIFT_N = KeyStroke.getKeyStroke(KeyEvent.VK_N, StrokesAndActions.CTRL_SHIFT); - public final KeyStroke CTRL_SHIFT_O = KeyStroke.getKeyStroke(KeyEvent.VK_O, StrokesAndActions.CTRL_SHIFT); - public final KeyStroke CTRL_SHIFT_S = KeyStroke.getKeyStroke(KeyEvent.VK_S, StrokesAndActions.CTRL_SHIFT); - public final KeyStroke CTRL_SHIFT_W = KeyStroke.getKeyStroke(KeyEvent.VK_W, StrokesAndActions.CTRL_SHIFT); - - public static String prettyString(KeyStroke stroke) { - // System.out.println("before " + stroke); - String string = stroke.toString().replace("pressed ", ""); - string = string.replace("ctrl", "Ctrl"); - string = string.replace("shift", "Shift"); - string = string.replace(" ", "+"); - // System.out.println("after " + string); - return string; - } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/TabbedListener.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/TabbedListener.java deleted file mode 100644 index 618a9c712..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/TabbedListener.java +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.listeners; - -import javax.swing.JTabbedPane; -import javax.swing.event.ChangeEvent; - -import org.lara.interpreter.joptions.panels.editor.components.TabbedContextMenu; -import org.lara.interpreter.joptions.panels.editor.tabbed.SourceTextArea; -import org.lara.interpreter.joptions.panels.editor.tabbed.TabsContainerPanel; - -public class TabbedListener { - - private final TabsContainerPanel tabbedLaraFiles; - - public TabbedListener(TabsContainerPanel tabsContainer) { - tabbedLaraFiles = tabsContainer; - // Register a change listener - tabsContainer.getTabbedPane().addChangeListener(this::changeTabAction); - - tabsContainer.getTabbedPane() - .addFocusListener(new FocusGainedListener(e -> tabsContainer.getCurrentTab().requestFocus())); - tabsContainer.getTabbedPane().addMouseListener(TabbedContextMenu.newMouseAdapter(tabsContainer)); - - mapActions(tabsContainer); - } - - /* - private EditorTab getCurrentTab() { - return tabbedLaraFiles.getCurrentTab(); - } - */ - private void changeTabAction(ChangeEvent evt) { - JTabbedPane pane = (JTabbedPane) evt.getSource(); - // Get selected tab - int sel = pane.getSelectedIndex(); - if (sel < 0) { - return; - } - SourceTextArea nextTab = (SourceTextArea) pane.getComponentAt(sel); - - tabbedLaraFiles.moveTab(nextTab); - } - - public TabsContainerPanel getTabbedLaraFiles() { - return tabbedLaraFiles; - } - - public static TabbedListener newInstance(TabsContainerPanel tabbedLaraFiles) { - return new TabbedListener(tabbedLaraFiles); - - } - - private void mapActions(TabsContainerPanel tabbedLaraFiles) { - // TODO add right click option to remove: all, all but this, all to the left and all to the right - - /* - * These are no longer needed as the focus are always given to the current text area - mapAction(StrokesAndActions.CTRL_S_STROKE, StrokesAndActions.SAVE_ACTION, - x -> getCurrentTab().save()); - mapAction(StrokesAndActions.CTRL_SHIFT_A_STROKE, StrokesAndActions.SAVE_AS_ACTION, - x -> getCurrentTab().saveAs()); - mapAction(StrokesAndActions.CTRL_O_STROKE, StrokesAndActions.OPEN_ACTION, - x -> getCurrentTab().open()); - - mapAction(StrokesAndActions.CTRL_N_STROKE, StrokesAndActions.NEW_TAB_ACTION, x -> tabbedLaraFiles.addTab()); - mapAction(StrokesAndActions.CTRL_SHIFT_N_STROKE, StrokesAndActions.NEW_TAB_OPEN_ACTION, - EditorListener.newTabAndOpen(tabbedLaraFiles)); - - mapAction(StrokesAndActions.CTRL_W_STROKE, StrokesAndActions.CLOSE_ACTION, - x -> getCurrentTab().close()); - - EditorListener.removeTraversalKeys(tabbedLaraFiles); - - mapAction(StrokesAndActions.CTRL_SHIFT_TAB_STROKE, StrokesAndActions.PREVIOUS_ACTION, - x -> tabbedLaraFiles.navigatePrevious()); - mapAction(StrokesAndActions.CTRL_TAB_STROKE, StrokesAndActions.NEXT_ACTION, - x -> tabbedLaraFiles.navigateNext()); - */ - - } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/WindowsFocusGainedListener.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/WindowsFocusGainedListener.java deleted file mode 100644 index 3d662d4e2..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/listeners/WindowsFocusGainedListener.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.listeners; - -import java.awt.event.WindowEvent; -import java.awt.event.WindowFocusListener; -import java.util.function.Consumer; - -public class WindowsFocusGainedListener implements WindowFocusListener { - - private final Consumer listener; - - public WindowsFocusGainedListener(Consumer listener) { - this.listener = listener; - } - - @Override - public void windowGainedFocus(WindowEvent e) { - listener.accept(e); - } - - @Override - public void windowLostFocus(WindowEvent e) { - - } -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/tabbed/MainLaraTab.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/tabbed/MainLaraTab.java deleted file mode 100644 index c8ebaf177..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/tabbed/MainLaraTab.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.tabbed; - -import java.io.File; -import java.util.ArrayList; - -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.filechooser.FileFilter; -import javax.swing.filechooser.FileNameExtensionFilter; - -import org.lara.interpreter.joptions.panels.editor.highlight.EditorConfigurer; -import org.lara.interpreter.joptions.panels.editor.utils.Factory; - -public class MainLaraTab extends SourceTextArea { - - /** - * - */ - private static final long serialVersionUID = 1L; - - public MainLaraTab(TabsContainerPanel parent) { - super(parent); - } - - public MainLaraTab(File file, TabsContainerPanel parent) { - super(file, parent); - } - - public boolean open() { - - FileFilter filter = new FileNameExtensionFilter("Lara files (*.lara)", "lara"); - ArrayList filters = new ArrayList<>(); - filters.add(filter); - - // File lastOpenedFolder = getTabbedParent().getLastOpenedFolder(); - // Open dialog in the same place as the current main lara file - JFileChooser fc = Factory.newFileChooser(filters, getLaraFile()); - - int returnVal = fc.showOpenDialog(this); - - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - load(file); - getTabbedParent().setLastOpenedFolder(file.getParentFile()); - return true; - } - return false; - - } - - @Override - public boolean saveAs() { - - FileFilter fileFilter = new FileNameExtensionFilter("Lara files (*.lara)", "lara"); - JFileChooser fc = Factory.newFileChooser("Save as...", "Save", fileFilter, - getTabbedParent().getLastOpenedFolder()); - fc.setApproveButtonMnemonic('s'); - - int returnVal = fc.showOpenDialog(this); - if (returnVal != JFileChooser.APPROVE_OPTION) { - return false; - } - File file = fc.getSelectedFile(); - return saveAs(file); - - } - - @Override - public boolean close() { - JOptionPane.showMessageDialog(this, "The main aspect file cannot be closed!"); - return false; - } - - // - // public boolean forceCloseRequest() { - // - // return super.close(); - // } - - public void requestSave() { - // TODO Auto-generated method stub - - } -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/tabbed/SourceTextArea.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/tabbed/SourceTextArea.java deleted file mode 100644 index 91e5b0cc2..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/tabbed/SourceTextArea.java +++ /dev/null @@ -1,600 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.tabbed; - -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.List; -import java.util.function.Consumer; - -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.UIManager; -import javax.swing.text.BadLocationException; -import javax.swing.text.Caret; -import javax.swing.text.Document; -import javax.swing.text.Element; - -import org.dojo.jsl.parser.ast.ASTAspectDef; -import org.dojo.jsl.parser.ast.ASTCodeDef; -import org.dojo.jsl.parser.ast.ASTFunctionDeclaration; -import org.dojo.jsl.parser.ast.ASTFunctionExpression; -import org.dojo.jsl.parser.ast.ASTStart; -import org.fife.ui.rsyntaxtextarea.ErrorStrip; -import org.fife.ui.rsyntaxtextarea.FileLocation; -import org.fife.ui.rsyntaxtextarea.RSyntaxDocument; -import org.fife.ui.rsyntaxtextarea.TextEditorPane; -import org.fife.ui.rtextarea.RTextScrollPane; -import org.lara.interpreter.joptions.panels.editor.EditorPanel; -import org.lara.interpreter.joptions.panels.editor.components.DontAskMeAgainPanel; -import org.lara.interpreter.joptions.panels.editor.components.FileNotExistPane; -import org.lara.interpreter.joptions.panels.editor.components.ReloadPane; -import org.lara.interpreter.joptions.panels.editor.highlight.EditorConfigurer; -import org.lara.interpreter.joptions.panels.editor.listeners.EditorListener; -import org.lara.interpreter.joptions.panels.editor.listeners.FocusGainedListener; -import org.lara.interpreter.joptions.panels.editor.utils.Factory; - -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.SpecsLogs; - -public class SourceTextArea extends JPanel { - - /** - * - */ - private static final int NO_VALUE = -10; - private static final long serialVersionUID = 1L; - private TextEditorPane textArea; - private File sourceFile; - private long lastModified; - private String originalText; - private final TabsContainerPanel tabsContainer; - private final EditorConfigurer editorConfigurer; - private boolean changed; - private boolean isNew; - private final ReloadPane reloadPane; - private final FileNotExistPane fileNotExistsPane; - Consumer saveAskSaveMethod; - private boolean asked; - - public SourceTextArea(TabsContainerPanel parent) { - this(Factory.newFile(parent), parent, true); - } - - public SourceTextArea(File file, TabsContainerPanel parent) { - this(file, parent, false); - - } - - private SourceTextArea(File file, TabsContainerPanel parent, boolean isNew) { - super(new BorderLayout()); - this.isNew = isNew; - changed = false; - tabsContainer = parent; - sourceFile = file; - saveAskSaveMethod = getEditorPanel().getSettings()::saveAskSave; - updateLastModified(); - editorConfigurer = new EditorConfigurer(); - textArea = editorConfigurer.buildTextArea(file, isNew, this); - - EditorListener.newInstance(this); - - RTextScrollPane pane = Factory.standardScrollPane(textArea); - - ErrorStrip es = new ErrorStrip(textArea); - JPanel temp = new JPanel(new BorderLayout()); - temp.add(pane); - temp.add(es, BorderLayout.LINE_END); - add(temp, BorderLayout.CENTER); - reloadPane = new ReloadPane(this); - fileNotExistsPane = new FileNotExistPane(this); - // add(reloadPane, BorderLayout.NORTH); - originalText = textArea.getText(); - addFocusListener(new FocusGainedListener(e -> { - - enterTab(); - })); - - // - // System.out.println(Arrays.asList(textArea.getInputMap().allKeys()).stream() - // .map(k -> k.toString() + "->" + textArea.getInputMap().get(k)) - // .collect(Collectors.joining("\n"))); - - // textArea.getInputMap().put(StrokesAndActions.CTRL_SHIFT_C, RSyntaxTextAreaEditorKit.rstaToggleCommentAction); - } - - private EditorPanel getEditorPanel() { - return tabsContainer.getEditor().getEditorPanel(); - } - - public TextEditorPane getTextArea() { - return textArea; - } - - /** - * Save the content of the textArea in a file. - *

- * Before saving verifies if the content is the same as the old content of the file - * - * @return - */ - public boolean save() { - - if (!(getLaraFile().exists())) { - int result = askToSaveIfNonExistant(); - switch (result) { - case JOptionPane.CANCEL_OPTION: - case JOptionPane.CLOSED_OPTION: - return false; - case JOptionPane.NO_OPTION: - return true; - default: - break; - } - } - if (isNew) { - return saveAs(); - } - - textArea.setEncoding(StandardCharsets.UTF_8.name()); - return forceSave(); - - } - - /** - * Save the content of the textArea in a file, regardless the old content. - * - * @param savingText - * @return - */ - private boolean forceSave() { - - try { - textArea.save(); - updateLastModified(); - setChanged(false); - setAsked(false); - updateOldText(); - closeReloadPane(); - return true; - } catch (IOException e) { - SpecsLogs.warn("Error message:\n", e); - JOptionPane.showMessageDialog(this, e.getMessage(), "Save Exception", JOptionPane.ERROR_MESSAGE); - } - return false; - } - - private void updateOldText() { - originalText = textArea.getText(); - setTabText(); - } - - public boolean saveAs() { - - JFileChooser fc = Factory.newFileChooser("Save as...", "Save", getTabbedParent().getLastOpenedFolder()); - fc.setApproveButtonMnemonic('s'); - - int returnVal = fc.showOpenDialog(this); - if (returnVal != JFileChooser.APPROVE_OPTION) { - return false; - } - - File file = fc.getSelectedFile(); - return saveAs(file); - } - - protected boolean saveAs(File file) { - try { - textArea.setEncoding(StandardCharsets.UTF_8.name()); - - textArea.saveAs(FileLocation.create(file)); - isNew = false; - setSourceFile(file); - updateOldText(); - EditorConfigurer.setSyntaxEditingStyle(this, file); - getTabbedParent().setLastOpenedFolder(file.getParentFile()); - tabsContainer.updateOpenedFiles(); - return true; - } catch (IOException e) { - SpecsLogs.warn("Error message:\n", e); - } - return false; - } - - public String getTabName() { - return sourceFile.getName(); - } - - public void exitTab() { - - } - - public void enterTab() { - textArea.requestFocus(); - refresh(); - parse(); - } - - /** - * - */ - private void parse() { - if (getTextArea().getParserCount() > 0) { - getTextArea().forceReparsing(0); - } - } - - public File getLaraFile() { - return sourceFile; - } - - public void setSourceFile(File sourceFile) { - this.sourceFile = sourceFile; - updateLastModified(); - setTabText(); - tabsContainer.setTabToolTipText(this, SpecsIo.getCanonicalPath(sourceFile)); - } - - /* - public boolean open() { - - JFileChooser fc = Factory.newFileChooser(getTabbedParent().getLastOpennedFolder()); - - int returnVal = fc.showOpenDialog(this); - - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - int tabIndex = tabsContainer.getTabIndex(file); - - if (tabIndex > -1) {// If the file already exists - // change the focus to the corresponding tab - tabsContainer.getTabbedPane().setSelectedIndex(tabIndex); - } else { - - load(file); - getTabbedParent().setLastOpennedFolder(file.getParentFile()); - } - return true; - } - return false; - - } - */ - public void refresh() { - - if (isNew || asked) { - return; - } - // System.out.println("refresh?" + lastModified + " vs " + sourceFile.lastModified()); - // if local timestamp is different from the file timestamp - if (!getLaraFile().exists()) { - openFileNotExistsPane(); - return; - } - if (lastModified != sourceFile.lastModified()) { - // System.out.println("update!"); - openReloadPane(); - } - - } - - public void openReloadPane() { - add(reloadPane, BorderLayout.NORTH); - revalidate(); - repaint(); - // reloadPane.ativate(true); - // revalidate(); //looks like it is this parent's that has to be revalidated! - // getParent(). - // validate(); - } - - public void openFileNotExistsPane() { - add(fileNotExistsPane, BorderLayout.NORTH); - revalidate(); - repaint(); - // reloadPane.ativate(true); - // revalidate(); //looks like it is this parent's that has to be revalidated! - // getParent(). - // validate(); - } - - public void closeReloadPane() { - remove(reloadPane); - remove(fileNotExistsPane); - revalidate(); - repaint(); - // reloadPane.ativate(false); - // getParent(). - // validate(); - } - - public int askToSaveIfNonExistant() { - int choice = JOptionPane.showConfirmDialog(this, - sourceFile.getAbsolutePath() - + "\n\nThis file does not exist or was removed. Do you want to create?", - // + "\nTimeStamps: editor=" + lastModified + ", file=" + sourceFile.lastModified() - "File does not exist", - JOptionPane.YES_NO_OPTION); - return choice; - } - - /** - * Reload the texarea with the file content - */ - public void reload() { - try { - int lastCaretPosition = textArea.getCaretPosition(); - setChanged(true); - textArea.reload(); - setChanged(false); - if (lastCaretPosition < textArea.getText().length()) { - textArea.setCaretPosition(lastCaretPosition); - } - originalText = textArea.getText(); - updateLastModified(); - // tabbedParent.setTabTitle(this); - } catch (IOException e) { - SpecsLogs.warn("Could not reload file:\n", e); - } - } - - // private void showTestDialog() { - // new ReloadDialog(textArea); - // } - - protected void load(File file) { - boolean loaded = EditorConfigurer.loadFile(this, file); - - if (loaded) { - setSourceFile(file); - isNew = false; - updateOldText(); - updateLastModified(); - closeReloadPane(); - setChanged(false); - } - } - - private void setTabText() { - // if (changed) { - // - // } else { - tabsContainer.setTabTitle(this); - // } - } - - /** - * Closes this document. If the files is 'dirty', then asks the user if he wants to save. - * - * @return false if during save request the user cancels the process; true otherwise - */ - public boolean close() { - - boolean closeTab = saveBeforeClose(); - - if (closeTab) { - tabsContainer.closeTab(this); - } - return closeTab; - } - - public String getOriginalText() { - return originalText; - } - - public void setOriginalText(String originalText) { - this.originalText = originalText; - } - - public TabsContainerPanel getTabbedParent() { - return tabsContainer; - } - - @Override - public String toString() { - return "Lara Tab with file: " + sourceFile.getName(); - } - - // boolean correctName = true; - - public long getLastModified() { - return lastModified; - } - - public void setLastModified(long lastModified) { - this.lastModified = lastModified; - } - - public void updateLastModified() { - setLastModified(sourceFile.lastModified()); - } - - public boolean isChanged() { - return changed; - } - - public void setChanged(boolean changed) { - this.changed = changed; - } - - public boolean isNew() { - return isNew; - } - - public boolean saveBeforeClose() { - - if (!getLaraFile().exists() || isNew) { - return save(); - } - - if (!originalText.equals(textArea.getText())) { - if (!tabsContainer.getCurrentTab().equals(this)) { - // System.out.println("Requesting focus!"); - tabsContainer.selectTab(this); - // textArea.requestFocus(); - } - - int choice = JOptionPane.showConfirmDialog(this, "Save file " + sourceFile.getName() + "?", "Save", - JOptionPane.YES_NO_CANCEL_OPTION); - switch (choice) { - case JOptionPane.CANCEL_OPTION: - return false; - case JOptionPane.NO_OPTION: - return true; - case JOptionPane.YES_OPTION: - return save(); - default: - break; - } - } - return true; - } - - // RSTA.ToggleCommentAction - public void commentSelection(ActionEvent event) { - - if ((!textArea.isEditable()) || (!textArea.isEnabled())) { - UIManager.getLookAndFeel().provideErrorFeedback(textArea); - return; - } - - RSyntaxDocument localRSyntaxDocument = (RSyntaxDocument) textArea.getDocument(); - String[] arrayOfString = localRSyntaxDocument.getLineCommentStartAndEnd(0); - if (arrayOfString == null) { - UIManager.getLookAndFeel().provideErrorFeedback(textArea); - return; - } - Element localElement1 = localRSyntaxDocument.getDefaultRootElement(); - Caret localCaret = textArea.getCaret(); - int i = localCaret.getDot(); - int j = localCaret.getMark(); - int k = localElement1.getElementIndex(i); - int m = localElement1.getElementIndex(j); - int n = Math.min(k, m); - int i1 = Math.max(k, m); - if (n != i1) { - Element localElement2 = localElement1.getElement(i1); - if (Math.max(i, j) == localElement2.getStartOffset()) { - i1--; - } - } - textArea.beginAtomicEdit(); - try { - boolean bool = getDoAdd(localRSyntaxDocument, localElement1, n, i1, arrayOfString); - for (k = n; k <= i1; k++) { - Element localElement3 = localElement1.getElement(k); - handleToggleComment(localElement3, localRSyntaxDocument, arrayOfString, bool); - } - } catch (BadLocationException localBadLocationException) { - localBadLocationException.printStackTrace(); - UIManager.getLookAndFeel().provideErrorFeedback(textArea); - } finally { - textArea.endAtomicEdit(); - } - } - - private static boolean getDoAdd(Document paramDocument, Element paramElement, int paramInt1, int paramInt2, - String[] paramArrayOfString) - throws BadLocationException { - boolean bool = false; - for (int i = paramInt1; i <= paramInt2; i++) { - Element localElement = paramElement.getElement(i); - int j = localElement.getStartOffset(); - String str = paramDocument.getText(j, localElement.getEndOffset() - j - 1); - if ((!str.startsWith(paramArrayOfString[0])) - || ((paramArrayOfString[1] != null) && (!str.endsWith(paramArrayOfString[1])))) { - bool = true; - break; - } - } - return bool; - } - - private static void handleToggleComment(Element paramElement, Document paramDocument, String[] paramArrayOfString, - boolean paramBoolean) - throws BadLocationException { - int i = paramElement.getStartOffset(); - int j = paramElement.getEndOffset() - 1; - if (paramBoolean) { - paramDocument.insertString(i, paramArrayOfString[0], null); - if (paramArrayOfString[1] != null) { - paramDocument.insertString(j + paramArrayOfString[0].length(), paramArrayOfString[1], null); - } - } else { - paramDocument.remove(i, paramArrayOfString[0].length()); - if (paramArrayOfString[1] != null) { - int k = paramArrayOfString[1].length(); - paramDocument.remove(j - paramArrayOfString[0].length() - k, k); - } - } - } - - /** - * If the file is "dirty", ask user if he wants to save - */ - public boolean askSave() { - if (!originalText.equals(textArea.getText())) { - if (!tabsContainer.getCurrentTab().equals(this)) { - // System.out.println("Requesting focus!"); - tabsContainer.selectTab(this); - // textArea.requestFocus(); - } - - // int choice = JOptionPane.showConfirmDialog(this, "Save file " + sourceFile.getName() + "?", "Save", - // JOptionPane.YES_NO_CANCEL_OPTION); - - int choice = getEditorPanel().getSettings().loadAskSave(NO_VALUE); - if (choice == NO_VALUE) { - choice = DontAskMeAgainPanel.showConfirmDialog(this, "Save file " + sourceFile.getName() + "?", - "Save", JOptionPane.YES_NO_CANCEL_OPTION, saveAskSaveMethod); - } - switch (choice) { - case JOptionPane.CANCEL_OPTION: - return false; - case JOptionPane.NO_OPTION: - return true; - case JOptionPane.YES_OPTION: - return save(); - default: - break; - } - } - return true; - } - - public void setAsked(boolean b) { - asked = true; - } - - /** - * - */ - public void outlineAstListener(ASTStart ast) { - - List aspects = ast.getDescendantsOfType(ASTAspectDef.class); - List functions = ast.getDescendantsOfType(ASTFunctionDeclaration.class); - List codedefs = ast.getDescendantsOfType(ASTCodeDef.class); - List expressions = ast.getDescendantsOfType(ASTFunctionExpression.class); - - getEditorPanel().getOutline().setElements(aspects, functions, codedefs, expressions); - } - - public void setTextArea(TextEditorPane textArea2) { - textArea = textArea2; - } -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/tabbed/TabsContainerPanel.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/tabbed/TabsContainerPanel.java deleted file mode 100644 index cf3ef28d4..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/tabbed/TabsContainerPanel.java +++ /dev/null @@ -1,529 +0,0 @@ -/* - * Copyright 2010 SPeCS Research Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.tabbed; - -import java.awt.Font; -import java.awt.GridLayout; -import java.awt.event.KeyEvent; -import java.io.File; - -import javax.swing.JFileChooser; -import javax.swing.JPanel; -import javax.swing.JTabbedPane; - -import org.lara.interpreter.joptions.panels.editor.components.Explorer; -import org.lara.interpreter.joptions.panels.editor.listeners.FileTransferHandler; -import org.lara.interpreter.joptions.panels.editor.listeners.TabbedListener; -import org.lara.interpreter.joptions.panels.editor.utils.Factory; - -import pt.up.fe.specs.util.SpecsIo; - -/** - * This source files panel contains a tabbed pane that will contain the editor tabs. The main tab, which is the main - * aspect file, cannot be closed. - * - * @author Tiago - */ -public class TabsContainerPanel extends JPanel { - - private static final long serialVersionUID = 1L; - - // private final List tabs; - private SourceTextArea currentTab; - private final MainLaraTab mainTab; - private File lastOpenedFolder; - private final JTabbedPane tabbedPane; - private Explorer explorer; - - public TabsContainerPanel(Explorer explorer) { - super(new GridLayout(1, 1)); - setExplorer(explorer); - - // tabs = new ArrayList<>(); - lastOpenedFolder = new File("."); - tabbedPane = new JTabbedPane(); - // tabbedPane.addChangeListener(e -> System.out.println("Tab: " + e.getSource())); - // tabbedPane.setBackground(Colors.BLUE_GREY); - - mainTab = new MainLaraTab(this); - addMainTab(mainTab); - - // ButtonTabComponent tabComp = (ButtonTabComponent) tabbedPane.getTabComponentAt(0); - // tabComp.remove(1); // remove button! - setCurrentTab(mainTab); - - TabbedListener.newInstance(this); - // Set program panel as currentTab - - // currentTab = mainTab; - // currentTab.enterTab(); - - // Add the tabbed pane to this panel. - add(tabbedPane); - - // tabbedPane.setSelectedIndex(0); - - // The following line enables to use scrolling tabs. - tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); - tabbedPane.setTransferHandler(new FileTransferHandler(this::open)); - } - - public void loadMainAspectFile(File aspectFile) { - mainTab.load(aspectFile); - lastOpenedFolder = aspectFile.getParentFile(); - explorer.setMainWorkspace(aspectFile); - removeDuplicatedLaraFiles(); - } - - private void removeDuplicatedLaraFiles() { - - File laraFile = mainTab.getLaraFile(); - int index = 1; - while (index < tabbedPane.getTabCount()) { - - SourceTextArea editorTab = getTab(index); - - File laraFile2 = editorTab.getLaraFile(); - if (laraFile2.equals(laraFile)) { - editorTab.close(); - } - index++; - } - tabbedPane.setSelectedIndex(0); - } - - /** - * Create a new tab with an empty file with the default name - */ - public SourceTextArea addTab() { - SourceTextArea newTab = new SourceTextArea(this); // unnamed file - addTab(newTab); - return newTab; - } - - public SourceTextArea addTab(File file) { - SourceTextArea newTab = new SourceTextArea(file, this); // unnamed file - addTab(newTab); - return newTab; - } - - // /** - // * Create a new tab with the given file - // * - // * @param file - // * @return - // */ - // private EditorTab addTab(File file) { - // EditorTab newTab = new EditorTab(file, this); - // addTab(newTab); - // return newTab; - // } - - /** - * Adds a tab to the tabbed pane - * - * @param tab - * @return - */ - private int addTab(SourceTextArea tab) { - int baseMnemonic = KeyEvent.VK_1; - // RTextScrollPane sp = new RTextScrollPane(tab); - tabbedPane.addTab(tab.getTabName(), tab); - int currentIndex = getTabIndex(tab); - tabbedPane.setMnemonicAt(currentIndex, baseMnemonic + currentIndex); - tabbedPane.setSelectedIndex(currentIndex); - // tabbedPane.setTitleAt(currentIndex, "TEST"); - - // Component comp = tabbedPane.getTabComponentAt(currentIndex); - // System.out.println(comp); - // tabbedPane.setTabComponentAt(currentIndex, new ButtonTabComponent(tab)); - updateOpenedFiles(); - return currentIndex; - } - - public int addMainTab(SourceTextArea tab) { - int mnemonic = KeyEvent.VK_1; - // RTextScrollPane sp = new RTextScrollPane(tab); - tabbedPane.addTab(tab.getTabName(), tab); - tabbedPane.setMnemonicAt(0, mnemonic); - tabbedPane.setSelectedIndex(0); - // tabbedPane.setTitleAt(currentIndex, "TEST"); - - // Component comp = tabbedPane.getTabComponentAt(currentIndex); - // System.out.println(comp); - // tabbedPane.setTabComponentAt(currentIndex, new ButtonTabComponent(tab)); - // updateOpenedFiles(); - return 0; - } - - public void setTabTitle(SourceTextArea tab) { - setTabTitle(getTabIndex(tab), tab.getTabName()); - } - - public void setChanged(SourceTextArea tab) { - setTabTitle(getTabIndex(tab), "*" + tab.getTabName()); - } - - private void setTabTitle(int tabIndex, String tabName) { - tabbedPane.setTitleAt(tabIndex, tabName); - // ButtonTabComponent tabTitle = (ButtonTabComponent) tabbedPane.getTabComponentAt(tabIndex); - // tabTitle.setTitle(tabName); - } - - public void closeTab(SourceTextArea tab) { - - int pos = getTabIndex(tab); - closeAndRemoveTab(pos); - if (!currentTab.equals(tab) && pos >= tabbedPane.getTabCount()) { - tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1); - } - updateMnemonics(); - } - - private void closeAndRemoveTab(int pos) { - tabbedPane.removeTabAt(pos); - updateOpenedFiles(); - } - - public void updateOpenedFiles() { - int tabCount = tabbedPane.getTabCount(); - String openedFiles = ""; - if (tabCount > 1) { - SourceTextArea editorTab = getTab(1); - openedFiles += editorTab.getLaraFile(); - for (int i = 2; i < tabCount; i++) { - editorTab = getTab(i); - openedFiles += SpecsIo.getUniversalPathSeparator() + editorTab.getLaraFile(); - } - } - getEditor().getEditorPanel().updateOpenedFiles(openedFiles); - } - - public SourceTextArea getCurrentTab() { - return currentTab; - } - - public void setCurrentTab(SourceTextArea currentTab) { - this.currentTab = currentTab; - } - - public JTabbedPane getTabbedPane() { - return tabbedPane; - } - - public void navigatePrevious() { - int tabCount = tabbedPane.getTabCount(); - if (tabCount == 1) { - return; - } - int index = getTabIndex(currentTab); - if (index == 0) { // If is the first, then go to the last - tabbedPane.setSelectedIndex(tabCount - 1); - } else { - tabbedPane.setSelectedIndex(index - 1); - } - } - - public void navigateNext() { - int tabCount = tabbedPane.getTabCount(); - if (tabCount == 1) { - return; - } - int index = getTabIndex(currentTab); - if (index == tabbedPane.getTabCount() - 1) { // If is the last, then go to the first - tabbedPane.setSelectedIndex(0); - } else { - tabbedPane.setSelectedIndex(index + 1); - } - } - - /** - * Close current tab - */ - public void closeCurrent() { - currentTab.close(); - } - - /** - * Close all tabs to the left and right of the current tab (except for the main tab) - */ - public void closeAllButCurrent() { - closeLeft(); - closeRight(); - } - - /** - * Close all tabs except main tab - */ - public boolean closeAll() { - tabbedPane.setSelectedIndex(0); - return closeRight(); - } - - public boolean closeLeft() { - int refIndex = getTabIndex(currentTab); - if (refIndex <= 1) { // is the main tab or the one next to the main tab////////currentTab.equals(mainTab) - return true; - } - int removingIndex = 1; // Start after the main tab - while (removingIndex < refIndex) { - SourceTextArea editorTab = getTab(removingIndex); - boolean closed = editorTab.close(); - if (!closed) { // i.e., the save request was made but user cancel closing this file - // removingIndex++; // jump to next closing file - return false; - } - // else { - // refIndex--; // update reference index - // } - } - return true; - // tabbedPane.removeTabAt(tabbedPane.getTabCount() - 1); - // } - } - - public boolean closeRight() { - int index = getTabIndex(currentTab); - - int removingIndex = index + 1; - while (removingIndex < tabbedPane.getTabCount()) { // Think better! - - SourceTextArea editorTab = getTab(removingIndex); - boolean closed = editorTab.close(); - if (!closed) { // i.e., the save request was made but user cancel closing this file - // removingIndex++; - return false; - } - } - return true; - } - - /** - * Get a tab based on the given file - * - * @param f - * @return - */ - public SourceTextArea getTab(File f) { - - int tabPos = getTabIndex(f); - return tabPos > -1 ? getTab(tabPos) : null; - } - - /** - * Get a tab by its index - * - * @param i - * @return - */ - private SourceTextArea getTab(int i) { - return (SourceTextArea) tabbedPane.getComponentAt(i); - - } - - /** - * Get tab index based on a file - * - * @param f - * @return - */ - public int getTabIndex(File f) { - String absolutePath = f.getAbsolutePath(); - - for (int i = 0; i < tabbedPane.getTabCount(); i++) { - // System.out.println(tabbedPane.getComponent(i)); - SourceTextArea tab = getTab(i); - if (tab.getTextArea().getFileFullPath().equals(absolutePath)) { - - return i; - } - } - return -1; - } - - /** - * Get tab index based on a EditorTab instance - * - * @param tab - * @return - */ - private int getTabIndex(SourceTextArea tab) { - return tabbedPane.indexOfComponent(tab); - } - - private void updateMnemonics() { - for (int i = 0; i < tabbedPane.getTabCount() && i < 10; i++) { - tabbedPane.setMnemonicAt(i, KeyEvent.VK_1 + i); - } - } - - public MainLaraTab getMainTab() { - return mainTab; - } - - public boolean saveAll() { - boolean cancelled = false; - for (int i = 0; i < tabbedPane.getTabCount(); i++) { - - SourceTextArea editorTab = getTab(i); - boolean approved = editorTab.save(); - if (!approved) { - cancelled = true; - } - } - return !cancelled; - } - - public boolean saveAllForClose() { - boolean cancelled = false; - for (int i = 0; i < tabbedPane.getTabCount(); i++) { - - SourceTextArea editorTab = getTab(i); - - boolean approved = editorTab.save(); - if (!approved) { - cancelled = true; - } - } - return !cancelled; - } - - public boolean askSave() { - - for (int i = 0; i < tabbedPane.getTabCount(); i++) { - - SourceTextArea editorTab = getTab(i); - boolean success = editorTab.askSave(); - if (!success) { - return false; - } - } - return true; - } - - public boolean saveBeforeClose() { - - for (int i = 0; i < tabbedPane.getTabCount(); i++) { - SourceTextArea editorTab = getTab(i); - boolean cancelled = !editorTab.saveBeforeClose(); - if (cancelled) { - return false; - } - } - return true; - } - - public File getLastOpenedFolder() { - return lastOpenedFolder; - } - - public void setLastOpenedFolder(File lastOpenedFolder) { - this.lastOpenedFolder = lastOpenedFolder; - } - - public void setTabToolTipText(SourceTextArea tab, String text) { - - // ButtonTabComponent tabTitle = (ButtonTabComponent) tabbedPane.getTabComponentAt(getTabIndex(tab)); - tabbedPane.setToolTipTextAt(getTabIndex(tab), text); - // tabTitle.setToolTipText(text); - } - - public void moveTab(SourceTextArea nextTab) { - // Exit current tab - SourceTextArea curTab = getCurrentTab(); - - // If already in the tab don't do anything - if (curTab.equals(nextTab)) { - return; - } - - curTab.exitTab(); - // Update current tab - // currentTab = tabs.get(sel); - curTab = nextTab; - setCurrentTab(curTab); - // Enter current tab - curTab.enterTab(); - } - - public void open() { - File refFile = getCurrentTab().getLaraFile(); - if (!refFile.exists()) { - refFile = lastOpenedFolder; - } - JFileChooser fc = Factory.newFileChooser(refFile); - - int returnVal = fc.showOpenDialog(this); - - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - open(file); - } - } - - public void open(File file) { - int tabIndex = getTabIndex(file); - - if (tabIndex > -1) {// If the file already exists - // change the focus to the corresponding tab - tabbedPane.setSelectedIndex(tabIndex); - } else { - addTab(file); - // tab.load(file); - setLastOpenedFolder(file.getParentFile()); - } - } - - public void openMain() { - tabbedPane.setSelectedIndex(0); - boolean open = mainTab.open(); - if (open) { - File laraFile = mainTab.getLaraFile(); - explorer.setMainWorkspace(laraFile); - removeDuplicatedLaraFiles(); - } - } - - public void selectTab(SourceTextArea sourceTextArea) { - int index = getTabIndex(sourceTextArea); - tabbedPane.setSelectedIndex(index); - } - - public Explorer getEditor() { - return explorer; - } - - public void setExplorer(Explorer explorer) { - this.explorer = explorer; - } - - /** - * TODO: update new tabs - * - * @param font - */ - public void setTabsFont(Float size) { - - // mainTab.getTextArea().setFont(mainTab.getTextArea().getFont().deriveFont(size)); - for (int i = 0; i < tabbedPane.getTabCount(); i++) { - SourceTextArea editorTab = getTab(i); - Font deriveFont = editorTab.getTextArea().getFont().deriveFont(size); - editorTab.getTextArea().setFont(deriveFont); - - // editorTab.revalidate(); - // editorTab.repaint(); - } - } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/ApplicationWorker.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/ApplicationWorker.java deleted file mode 100644 index fff0f72ba..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/ApplicationWorker.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright 2010 SPeCS Research Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.utils; - -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; - -import org.suikasoft.jOptions.Interfaces.DataStore; - -import pt.up.fe.specs.util.SpecsLogs; -import pt.up.fe.specs.util.SpecsSwing; - -/** - * Launches a Task in a different thread. - * - * TODO: Extract Runnable ApplicationRunner from this class. - * - * @param T - * the type of argument the task receives. Old version used {@link DataStore} - * @author Joao Bispo - */ -public abstract class ApplicationWorker { - - private ExecutorService workerExecutor; - - public ApplicationWorker() { - - workerExecutor = null; - } - - /** - * Executes the application in another thread. - * - * @param options - */ - public void execute(T options) { - - // Run - ExecutorService monitor = Executors.newSingleThreadExecutor(); - monitor.submit(() -> runner(options)); - - } - - /** - * To be run on Monitor thread, so the Gui is not waiting for the result of task. - * - * @param options - */ - private void runner(T setup) { - // event before task - start(); - - // Create task - Callable task = getTask(setup); - - // Submit task - workerExecutor = Executors.newSingleThreadExecutor(); - Future future = workerExecutor.submit(task); - - // Check if task finishes - Integer result = null; - try { - result = future.get(); - } catch (InterruptedException ex) { - Thread.currentThread().interrupt(); // ignore/reset - } catch (ExecutionException ex) { - if (!workerExecutor.isShutdown()) { - showExceptionMessage(ex); - } - } - - if (result == null) { - SpecsLogs.msgInfo("Application execution could not proceed."); - } else if (result.compareTo(0) != 0) { - SpecsLogs.msgInfo("*Application Stopped*"); - SpecsLogs.msgLib("Worker return value: " + result); - } - - // event after task - end(); - } - - /** - * Runt the start event - */ - private void start() { - SpecsSwing.runOnSwing(new Runnable() { - - @Override - public void run() { - onStart(); - } - }); - - } - - /** - * Run the "end" event - */ - private void end() { - SpecsSwing.runOnSwing(new Runnable() { - - @Override - public void run() { - onEnd(); - } - }); - - } - - /** - * Builds a task out of the application - * - * @return - */ - protected abstract Callable getTask(T setup); - - /** - * Event that executes before the task starts - */ - protected abstract void onStart(); - - /** - * Event that executes after the task starts, even if it failed to execute - */ - protected abstract void onEnd(); - - public void shutdown() { - if (workerExecutor == null) { - SpecsLogs.getLogger().warning("Application is not running."); - return; - } - - workerExecutor.shutdownNow(); - } - - private static void showExceptionMessage(ExecutionException ex) { - String prefix = " happened while executing the application"; - - Throwable ourCause = ex.getCause(); - - if (ourCause == null) { - SpecsLogs.warn("\nAn Exception" + prefix + ", but could not get cause."); - } else { - - SpecsLogs.msgInfo(""); - SpecsLogs.warn(ourCause.toString(), ourCause); - } - } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/Colors.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/Colors.java deleted file mode 100644 index 264bacdd6..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/Colors.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.utils; - -import java.awt.Color; - -public interface Colors { - - Color BLUE = new Color(208, 223, 239); - Color BLUE_GREY = new Color(232, 236, 248); - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/EditorKeys.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/EditorKeys.java deleted file mode 100644 index 2b55c0e91..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/EditorKeys.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.utils; - -import org.suikasoft.jOptions.Datakey.DataKey; -import org.suikasoft.jOptions.Datakey.KeyFactory; - -public interface EditorKeys { - - DataKey isOutputShown = KeyFactory.bool("show_editor_output"); - DataKey splitSize = KeyFactory.object("editor_split_size", Double.class); - DataKey isBarShown = KeyFactory.bool("show_editor_lsbar"); -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/Factory.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/Factory.java deleted file mode 100644 index eebc2915a..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/Factory.java +++ /dev/null @@ -1,133 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.utils; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.swing.JFileChooser; -import javax.swing.ScrollPaneConstants; -import javax.swing.filechooser.FileFilter; - -import org.fife.ui.rsyntaxtextarea.TextEditorPane; -import org.fife.ui.rtextarea.RTextScrollPane; -import org.lara.interpreter.joptions.panels.editor.tabbed.TabsContainerPanel; - -public class Factory { - - public static JFileChooser newFileChooser(File currentDir) { - return new JFileChooser(currentDir); - } - - /** - * Create a file chooser using a list of filters; - * - * @param filters - * @return - */ - public static JFileChooser newFileChooser(Collection filters, File currentDir) { - return newFileChooser(null, JFileChooser.FILES_ONLY, null, filters, currentDir); - - } - - public static JFileChooser newFileChooser(String title, String confirmText, File currentDir) { - return newFileChooser(title, confirmText, Collections.emptyList(), currentDir); - } - - public static JFileChooser newFileChooser(String title, String confirmText, FileFilter filter, File currentDir) { - List coll = new ArrayList<>(); - coll.add(filter); - return newFileChooser(title, confirmText, coll, currentDir); - } - - /** - * Create a file chooser using a list of filters; - * - * @param filters - * @param currentDir - * @return - */ - public static JFileChooser newFileChooser(String title, String confirmText, Collection filters, - File currentDir) { - return newFileChooser(title, JFileChooser.FILES_ONLY, confirmText, filters, currentDir); - - } - - /** - * Create new file chooser with the given information - * - * @param title - * @param selectMode - * @param confirmText - * @param filters - * @return - */ - public static JFileChooser newFileChooser(String title, int selectMode, String confirmText, - Collection filters, File currentDir) { - JFileChooser fc = newFileChooser(currentDir); - fc.setFileSelectionMode(selectMode); - if (title != null) { - fc.setDialogTitle(title); - } - if (confirmText != null) { - fc.setApproveButtonText(confirmText); - } - - if (!filters.isEmpty()) { - for (FileFilter fileFilter : filters) { - - fc.addChoosableFileFilter(fileFilter); - } - fc.setFileFilter(filters.iterator().next()); - } - - return fc; - } - - private static final String DEFAULT_FILE_NAME = "new "; - private static int UID = 1; - - public static File newFile(TabsContainerPanel tabbedLaraFiles) { - int uid = Factory.UID; - - do { - File f = new File(Factory.DEFAULT_FILE_NAME + (uid++)); - if (!f.exists()) { - int tabIndex = tabbedLaraFiles.getTabIndex(f); - if (tabIndex == -1) { - return f; - } - } - - } while (true); - } - - /** - * Build a standard scroll pane for the given text area that shows the vertical/horizontal scroll bar when needed - * - * @param textArea - * @return - */ - public static RTextScrollPane standardScrollPane(TextEditorPane textArea) { - RTextScrollPane pane = new RTextScrollPane(textArea); - pane.setWheelScrollingEnabled(true); - - pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); - pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); - return pane; - } -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/LaraWorker.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/LaraWorker.java deleted file mode 100644 index 8209637a3..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/LaraWorker.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.utils; - -import java.io.File; -import java.util.Optional; -import java.util.concurrent.Callable; - -import javax.swing.SwingUtilities; - -import org.lara.interpreter.joptions.config.interpreter.LaraiKeys; -import org.lara.interpreter.joptions.keys.OptionalFile; -import org.lara.interpreter.joptions.panels.editor.EditorPanel; -import org.suikasoft.jOptions.Interfaces.DataStore; -import org.suikasoft.jOptions.gui.panels.app.ProgramPanel; -import org.suikasoft.jOptions.gui.panels.app.TabbedPane; - -public class LaraWorker extends ApplicationWorker { - - private final EditorPanel editor; - private Optional toOpen; - - public LaraWorker(EditorPanel editor) { - this.editor = editor; - toOpen = Optional.empty(); - } - - @Override - protected Callable getTask(DataStore setup) { - TabbedPane tabbedPane = (TabbedPane) SwingUtilities.getAncestorOfClass(TabbedPane.class, editor); - ProgramPanel program = SearchUtils.findFirstComponentOfType(tabbedPane, ProgramPanel.class); - // program.execute(); - - Callable callable = () -> { - return executeLARA(setup, program); - }; - return callable; - } - - private int executeLARA(DataStore setup, ProgramPanel program) { - int execute = program.getApplication().getKernel().execute(setup); - if (execute == 0) { - - Optional metrics = setup.getTry(LaraiKeys.METRICS_FILE); - if (metrics.isPresent()) { - OptionalFile optionalFile = metrics.get(); - if (optionalFile.isUsed()) { - toOpen = Optional.of(optionalFile.getFile()); - } - } - } - return execute; - } - - @Override - protected void onStart() { - editor.setStopButton(); - } - - @Override - protected void onEnd() { - if (toOpen.isPresent()) { - editor.getTabsContainer().open(toOpen.get()); - toOpen = Optional.empty(); - } - editor.setPlayButton(); - editor.getTabsContainer().getCurrentTab().refresh(); - } - -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/SearchUtils.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/SearchUtils.java deleted file mode 100644 index b88396b4b..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/SearchUtils.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.utils; - -import java.awt.Component; -import java.awt.Container; - -public class SearchUtils { - public static C findFirstComponentOfType(Component comp, Class cClass) { - if (cClass.isInstance(comp)) { - return cClass.cast(comp); - } - - if (comp instanceof Container) { - Container container = (Container) comp; - for (int i = 0; i < container.getComponentCount(); i++) { - C comp2 = findFirstComponentOfType(container.getComponent(i), cClass); - if (comp2 != null) { - return comp2; - } - } - } - return null; - } -} diff --git a/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/SettingsManager.java b/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/SettingsManager.java deleted file mode 100644 index a885c2d50..000000000 --- a/LARAI/src/org/lara/interpreter/joptions/panels/editor/utils/SettingsManager.java +++ /dev/null @@ -1,179 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.joptions.panels.editor.utils; - -import java.util.prefs.Preferences; - -import org.lara.interpreter.joptions.panels.editor.EditorPanel; - -public class SettingsManager { - - private static final String EDITOR_FONT_SIZE_PREFIX = "editor_font_size_"; - private static final String CONSOLE_FONT_SIZE_PREFIX = "console_font_size_"; - private static final String CONSOLE_SPLIT_FACTOR_PREFIX = "split_factor_"; - private static final String EXPLORER_SPLIT_FACTOR_PREFIX = "explorer_factor_"; - private static final String ASK_SAVE_PREFIX = "ask_save_"; - private static final String SHOW_CONSOLE_PREFIX = "show_console_"; - private static final String SHOW_LANG_SPEC_PREFIX = "show_lang_spec_"; - private static final String OPENED_FILES_PREFIX = "opened_files_"; - private static final String EXPLORER_OUTLINE_SPLIT_FACTOR_PREFIX = "explorer_outline_split_"; - - public Preferences prefs; - private String keySufix; - // public static final String FILE_SEPARATOR = File.pathSeparator; - - public SettingsManager(EditorPanel panel, String keySufix) { - this.keySufix = keySufix; - prefs = Preferences.userRoot(); - } - - /** - * Remove preferences from system - */ - protected void removePreferences() { - - prefs.remove(getConsoleSplitFactorSetting()); - prefs.remove(getShowConsoleSetting()); - prefs.remove(getShowLangSpecSetting()); - prefs.remove(getAskSaveSetting()); - } - - ////////////////////////////////////////////////// - /////////////// Load/Save Preferences //////////// - ////////////////////////////////////////////////// - - public void saveConsoleSplitFactor(double value) { - prefs.putDouble(getConsoleSplitFactorSetting(), value); - } - - public double loadConsoleSplitFactor(double defaultVale) { - return prefs.getDouble(getConsoleSplitFactorSetting(), defaultVale); - } - - public void saveExplorerSplitFactor(double value) { - prefs.putDouble(getExplorerSplitFactorSetting(), value); - } - - public double loadExplorerSplitFactor(double defaultVale) { - return prefs.getDouble(getExplorerSplitFactorSetting(), defaultVale); - } - - public void saveExplorerOutlineSplitFactor(double value) { - prefs.putDouble(getExplorerOutlineSplitSetting(), value); - } - - public double loadExplorerOutlineSplitFactor(double defaultVale) { - return prefs.getDouble(getExplorerOutlineSplitSetting(), defaultVale); - } - - public void saveShowConsole(boolean value) { - prefs.putBoolean(getShowConsoleSetting(), value); - } - - public boolean loadShowConsole(boolean defaultVale) { - return prefs.getBoolean(getShowConsoleSetting(), defaultVale); - } - - public void saveShowLangSpec(boolean value) { - prefs.putBoolean(getShowLangSpecSetting(), value); - } - - public boolean loadShowLangSpec(boolean defaultVale) { - return prefs.getBoolean(getShowLangSpecSetting(), defaultVale); - } - - public void saveAskSave(int value) { - prefs.putInt(getAskSaveSetting(), value); - } - - public int loadAskSave(int defaultVale) { - return prefs.getInt(getAskSaveSetting(), defaultVale); - } - - public void saveOpenedFiles(String filesList) { - // LaraLog.debug("SAVING OPENED FILES: " + filesList + "!"); - prefs.put(getOpenedFilesSetting(), filesList); - } - - public String loadOpenedFiles() { - String fileList = prefs.get(getOpenedFilesSetting(), ""); - // LaraLog.debug("LOADING OPENED FILES: " + fileList + "!"); - return fileList; - } - - public void saveEditorFontSize(float fontSize) { - // LaraLog.debug("SAVING Editor Font: " + fontSize + "!"); - - prefs.putFloat(getEditorFontSizeSetting(), fontSize); - } - - public float loadEditorFontSize(float defaultVale) { - - float float1 = prefs.getFloat(getEditorFontSizeSetting(), defaultVale); - // LaraLog.debug("LOADING Editor Font: " + float1 + "!"); - return float1; - } - - public void saveConsoleFontSize(float fontSize) { - prefs.putFloat(getConsoleFontSizeSetting(), fontSize); - } - - public float loadConsoleFontSize(float defaultVale) { - return prefs.getFloat(getConsoleFontSizeSetting(), defaultVale); - } - - ///////////////////////////////////////////////// - /////////////// Get Preferences Keys //////////// - ///////////////////////////////////////////////// - private String getAskSaveSetting() { - return ASK_SAVE_PREFIX + getKeySufix(); - } - - private String getConsoleSplitFactorSetting() { - return CONSOLE_SPLIT_FACTOR_PREFIX + getKeySufix(); - } - - private String getExplorerSplitFactorSetting() { - return EXPLORER_SPLIT_FACTOR_PREFIX + getKeySufix(); - } - - private String getShowConsoleSetting() { - return SHOW_CONSOLE_PREFIX + getKeySufix(); - } - - private String getShowLangSpecSetting() { - return SHOW_LANG_SPEC_PREFIX + getKeySufix(); - } - - private String getOpenedFilesSetting() { - return OPENED_FILES_PREFIX + getKeySufix(); - } - - private String getEditorFontSizeSetting() { - return EDITOR_FONT_SIZE_PREFIX + getKeySufix(); - } - - private String getConsoleFontSizeSetting() { - return CONSOLE_FONT_SIZE_PREFIX + getKeySufix(); - } - - private String getExplorerOutlineSplitSetting() { - return EXPLORER_OUTLINE_SPLIT_FACTOR_PREFIX + getKeySufix(); - } - - private String getKeySufix() { - return keySufix; - } - -} diff --git a/LARAI/src/org/lara/interpreter/tester/WeaverTester.java b/LARAI/src/org/lara/interpreter/tester/WeaverTester.java deleted file mode 100644 index 90458a705..000000000 --- a/LARAI/src/org/lara/interpreter/tester/WeaverTester.java +++ /dev/null @@ -1,271 +0,0 @@ -/** - * Copyright 2016 SPeCS. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.tester; - -import larai.LaraI; -import org.lara.interpreter.joptions.config.interpreter.LaraiKeys; -import org.lara.interpreter.joptions.config.interpreter.VerboseLevel; -import org.lara.interpreter.joptions.keys.FileList; -import org.lara.interpreter.joptions.keys.OptionalFile; -import org.lara.interpreter.weaver.interf.WeaverEngine; -import org.suikasoft.jOptions.Datakey.DataKey; -import org.suikasoft.jOptions.Interfaces.DataStore; -import pt.up.fe.specs.util.SpecsCollections; -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.SpecsLogs; -import pt.up.fe.specs.util.SpecsStrings; -import pt.up.fe.specs.util.providers.ResourceProvider; - -import java.io.File; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.*; - -public abstract class WeaverTester> { - - private static final boolean DEBUG = false; - - private static final String WORK_FOLDER = "java_weaver_output"; - private static final String WEAVED_FOLDER = "src-weaved"; - - private final Class weaverEngineClass; - - private final String basePackage; - /* - private final String compilerFlags; - - private boolean checkWeavedCodeSyntax; - */ - private String srcPackage; - private String resultPackage; - private boolean keepWeavedFiles; - - private final DataStore customData; - - public WeaverTester(Class weaverEngineClass, String basePackage) { - this.weaverEngineClass = weaverEngineClass; - - // public JavaWeaverTester(String basePackage, Standard standard, String compilerFlags) { - this.basePackage = basePackage; - /* - this.standard = standard; - this.compilerFlags = compilerFlags; - this.checkWeavedCodeSyntax = true; - */ - srcPackage = null; - resultPackage = null; - keepWeavedFiles = false; - - customData = DataStore.newInstance(weaverEngineClass.getSimpleName() + " Test Extra Data"); - - } - - @SuppressWarnings("unchecked") - public K set(DataKey key, ED value) { - customData.set(key, value); - return (K) this; - } - - protected DataStore getCustomData() { - return customData; - } - - @SuppressWarnings("unchecked") - public K setKeepWeavedFiles(boolean keepWeavedFiles) { - this.keepWeavedFiles = keepWeavedFiles; - - return (K) this; - } - - /** - * @param checkWeavedCodeSyntax - * @return the previous value - */ - /* - public JavaWeaverTester setCheckWeavedCodeSyntax(boolean checkWeavedCodeSyntax) { - this.checkWeavedCodeSyntax = checkWeavedCodeSyntax; - - return this; - } - */ - - // public JavaWeaverTester(String basePackage, Standard standard) { - // this(basePackage, standard, ""); - // } - @SuppressWarnings("unchecked") - public K setResultPackage(String resultPackage) { - this.resultPackage = sanitizePackage(resultPackage); - - return (K) this; - } - - @SuppressWarnings("unchecked") - public K setSrcPackage(String srcPackage) { - this.srcPackage = sanitizePackage(srcPackage); - - return (K) this; - } - - private String sanitizePackage(String packageName) { - String sanitizedPackage = packageName; - if (!sanitizedPackage.endsWith("/")) { - sanitizedPackage += "/"; - } - - return sanitizedPackage; - } - - private ResourceProvider buildCodeResource(String codeResourceName) { - StringBuilder builder = new StringBuilder(); - - builder.append(basePackage); - if (srcPackage != null) { - builder.append(srcPackage); - } - - builder.append(codeResourceName); - - return () -> builder.toString(); - } - - public void test(String laraResource, String... codeResource) { - test(laraResource, Arrays.asList(codeResource)); - } - - public void test(String laraResource, List codeResources) { - SpecsLogs.msgInfo("\n---- Testing '" + laraResource + "' ----\n"); - List codes = SpecsCollections.map(codeResources, this::buildCodeResource); - - File log = runWeaver(() -> basePackage + laraResource, codes); - String logContents = SpecsIo.read(log); - - StringBuilder expectedResourceBuilder = new StringBuilder(); - expectedResourceBuilder.append(basePackage); - if (resultPackage != null) { - expectedResourceBuilder.append(resultPackage); - } - expectedResourceBuilder.append(laraResource).append(".txt"); - - String expectedResource = expectedResourceBuilder.toString(); - - if (!SpecsIo.hasResource(expectedResource)) { - fail("Could not find resource '" + expectedResource - + "', skipping verification. Actual output:\n" + logContents); - } - - assertEquals(normalize(SpecsIo.getResource(expectedResource)), normalize(logContents)); - - } - - /** - * Normalizes endlines - * - * @param resource - * @return - */ - private static String normalize(String string) { - return SpecsStrings.normalizeFileContents(string, true); - } - - private static String resourceNameMapper(String resourceName) { - if (resourceName.endsWith(".test")) { - return resourceName.substring(0, resourceName.length() - ".test".length()); - } - - return resourceName; - } - - private File runWeaver(ResourceProvider lara, List code) { - // Prepare folder - File workFolder = SpecsIo.mkdir(WORK_FOLDER); - SpecsIo.deleteFolderContents(workFolder); - - File outputFolder = null; - if (keepWeavedFiles) { - outputFolder = SpecsIo.mkdir(WEAVED_FOLDER); - } else { - outputFolder = SpecsIo.mkdir(workFolder, WEAVED_FOLDER); - } - - // Prepare files - code.forEach(resource -> resource.write(workFolder, true, WeaverTester::resourceNameMapper)); - File laraFile = lara.write(workFolder); - - DataStore data = DataStore.newInstance(weaverEngineClass.getSimpleName() + " Test"); - - // Set LaraI configurations - data.add(LaraiKeys.LARA_FILE, laraFile); - data.add(LaraiKeys.OUTPUT_FOLDER, outputFolder); - data.add(LaraiKeys.WORKSPACE_FOLDER, FileList.newInstance(workFolder)); - data.add(LaraiKeys.VERBOSE, VerboseLevel.warnings); - data.add(LaraiKeys.LOG_JS_OUTPUT, Boolean.TRUE); - data.add(LaraiKeys.LOG_FILE, OptionalFile.newInstance(getWeaverLog().getAbsolutePath())); - - data.addAll(customData); - - T weaver; - try { - weaver = weaverEngineClass.newInstance(); - } catch (Exception e) { - throw new RuntimeException("Could not instantiate weaver with class '" + weaverEngineClass + "'", e); - } - - try { - boolean result = LaraI.exec(data, weaver); - // Check weaver executed correctly - assertTrue(result); - } catch (Exception e) { - throw new RuntimeException("Problems during weaving", e); - } - - /* - if (!keepWeavedFiles) { - // File weavedFolder = new File(WEAVED_FOLDER); - SpecsIo.deleteFolderContents(outputFolder); - - // Recreate dummy - SpecsIo.write(new File(outputFolder, "dummy"), ""); - } - */ - - return getWeaverLog(); - } - - public static File getWorkFolder() { - return new File(WORK_FOLDER); - } - - public static File getWeaverLog() { - return new File(WORK_FOLDER, "test.log"); - } - - public static void clean() { - if (DEBUG) { - return; - } - - // Delete CWeaver folder - File workFolder = WeaverTester.getWorkFolder(); - if (workFolder.isDirectory()) { - SpecsIo.deleteFolderContents(workFolder, true); - SpecsIo.delete(workFolder); - } - - // Delete weaver files - // ClangAstParser.getTempFiles().stream() - // .forEach(filename -> new File(filename).delete()); - } - -} diff --git a/LARAI/src/org/lara/interpreter/utils/Coordinates.java b/LARAI/src/org/lara/interpreter/utils/Coordinates.java deleted file mode 100644 index becf96b80..000000000 --- a/LARAI/src/org/lara/interpreter/utils/Coordinates.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Copyright 2015 SPeCS Research Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.utils; - -import java.util.Arrays; - -import tdrc.utils.StringUtils; - -public class Coordinates { - - private String fileName; - private int lineBegin; - private int lineEnd; - private int columnBegin; - private int columnEnd; - private boolean wellParsed; - - public Coordinates(String coord) { - String[] splitted = coord.split(":"); - // Will consider that last 4 positions are the coordenates and all - // previous positions are related to the name - // since the file path may contain, for instance, "C:\" - if (splitted.length < 5) { - wellParsed = false; - fileName = coord; - lineBegin = 0; - lineEnd = 0; - columnBegin = 0; - columnEnd = 0; - return; - } - int endPosition = splitted.length - 1; - columnEnd = Integer.parseInt(splitted[endPosition]); - endPosition--; - lineEnd = Integer.parseInt(splitted[endPosition]); - endPosition--; - columnBegin = Integer.parseInt(splitted[endPosition]); - endPosition--; - lineBegin = Integer.parseInt(splitted[endPosition]); - endPosition--; - String[] onlyTheName = Arrays.copyOf(splitted, splitted.length - 4); - fileName = StringUtils.join(Arrays.asList(onlyTheName), ":"); - wellParsed = true; - - } - - public String getFileName() { - return fileName; - } - - public void setFileName(String fileName) { - this.fileName = fileName; - } - - public int getLineBegin() { - return lineBegin; - } - - public void setLineBegin(int lineBegin) { - this.lineBegin = lineBegin; - } - - public int getLineEnd() { - return lineEnd; - } - - public void setLineEnd(int lineEnd) { - this.lineEnd = lineEnd; - } - - public int getColumnBegin() { - return columnBegin; - } - - public void setColumnBegin(int columnBegin) { - this.columnBegin = columnBegin; - } - - public int getColumnEnd() { - return columnEnd; - } - - public void setColumnEnd(int columnEnd) { - this.columnEnd = columnEnd; - } - - public boolean isWellParsed() { - return wellParsed; - } - - public void setWellParsed(boolean wellParsed) { - this.wellParsed = wellParsed; - } - - public String fileAndLineString() { - return fileName + ", line " + lineBegin; - } -} diff --git a/LARAI/src/org/lara/interpreter/utils/DefMap.java b/LARAI/src/org/lara/interpreter/utils/DefMap.java deleted file mode 100644 index f22a0b120..000000000 --- a/LARAI/src/org/lara/interpreter/utils/DefMap.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.utils; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.function.BiConsumer; - -import org.suikasoft.jOptions.Datakey.DataKey; -import org.suikasoft.jOptions.Datakey.KeyFactory; - -import com.google.common.base.Preconditions; - -/** - * Class to help the implementation of the 'def' action. - * - * @author JoaoBispo - * - */ -public class DefMap { - - // private final Map, BiConsumer> defMap; - private final Class joinpointClass; - private final Map> consumers; - private final Map> keys; - - public DefMap(Class joinpointClass) { - this.joinpointClass = joinpointClass; - this.consumers = new HashMap<>(); - keys = new HashMap<>(); - } - - public Set keys() { - return keys.keySet(); - } - - public void addBool(String attribute, BiConsumer def) { - add(KeyFactory.bool(attribute), def); - } - - public void addInteger(String attribute, BiConsumer def) { - // We are not using DataStores, default value should not be relevant - add(KeyFactory.integer(attribute, 0), def); - } - - public void add(DataKey attribute, BiConsumer def) { - consumers.put(attribute.getName(), def); - keys.put(attribute.getName(), attribute); - } - - public boolean hasAttribute(String attribute) { - return consumers.get(attribute) != null; - } - - public void apply(String attribute, Object joinpoint, Object value) { - BiConsumer rawConsumer = consumers.get(attribute); - if (rawConsumer == null) { - throw new RuntimeException("Could not find attribute '" + attribute + "':" + consumers); - } - - // Check that we are on the correct joinpoint - Preconditions.checkArgument(joinpointClass.isInstance(joinpoint), - "Expected to be called with a joinpoint of type '" + joinpointClass.getSimpleName() - + "' instead received a " + joinpoint.getClass().getSimpleName()); - - // All elements on the map are guaranteed to be BiConsumer - @SuppressWarnings("unchecked") - BiConsumer consumer = (BiConsumer) rawConsumer; - DataKey key = keys.get(attribute); - - Object parsedValue = parseValue(key, value); - - consumer.accept(joinpoint, parsedValue); - } - - private Object parseValue(DataKey key, Object value) { - Class valueClass = key.getValueClass(); - - // Check if object is an instance of the required class - if (valueClass.isInstance(value)) { - return value; - } - - // If value is a String, decode it - if (value instanceof String) { - return key.getDecoder().get().decode((String) value); - } - - throw new RuntimeException( - "Attribute expects a value of type '" + valueClass.getSimpleName() + "', got a '" - + value.getClass().getSimpleName() + "'"); - } -} diff --git a/LARAI/src/org/lara/interpreter/utils/ExceptionUtils.java b/LARAI/src/org/lara/interpreter/utils/ExceptionUtils.java deleted file mode 100644 index cac1ecd9d..000000000 --- a/LARAI/src/org/lara/interpreter/utils/ExceptionUtils.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Copyright 2015 SPeCS Research Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.utils; - -import org.lara.interpreter.exception.ApplyException; -import org.lara.interpreter.exception.AspectDefException; -import org.lara.interpreter.exception.UserException; -import org.lara.interpreter.weaver.interf.JoinPoint; -import org.lara.interpreter.weaver.interf.WeaverEngine; - -import pt.up.fe.specs.tools.lara.exception.BaseException; -import pt.up.fe.specs.util.SpecsLogs; - -public class ExceptionUtils { - - public static void throwApplyException(Object original, String applyLabel, - String selectLabel, int currentLine) throws Throwable { - - Throwable e = getException(original); - - var applyException = new ApplyException(applyLabel, selectLabel, new JoinPoint[0], e); - - // Graal is removing the cause chain when this exception is thrown, printing it here - SpecsLogs.warn("Apply exception:", applyException); - - throw applyException; - } - - private static Throwable getException(Object original) { - - // var scriptEngine = (GraalvmJsEngine) WeaverEngine.getThreadLocalWeaver().getScriptEngine(); - - // System.out.println("ARRAY: " + scriptEngine.asValue(original).hasArrayElements()); - // System.out.println("MEMBER: " + scriptEngine.asValue(original).getMemberKeys()); - // System.out.println("CLASS: " + scriptEngine.asValue(original).getClass()); - - // Check if throwable - if (original instanceof Throwable) { - return (Throwable) original; - } - - // Check if it is a JsEngine error - var jsEngineException = WeaverEngine.getThreadLocalWeaver().getScriptEngine() - .getException(original) - .orElse(null); - - if (jsEngineException != null) { - return jsEngineException; - } - - // If no option is available than it is treated as a string (using toString); - SpecsLogs.info("Could not decode exception with class '" + original.getClass() + "', returning .toString()"); - - return new RuntimeException(original.toString()); - } - - public static void throwAspectException(Object original, String aspectName, String aspectCoords, - int lineMapping) { // Map lineMapping) { - // System.out.println("ORIGINAL: " + original); - // System.out.println("ASPECT NAME: " + aspectName); - // System.out.println("ASPECT COORDS: " + aspectCoords); - // System.out.println("LINE MAPPING: " + lineMapping); - - var exception = processAspectException(original, aspectName, aspectCoords, lineMapping); - - // Graal is removing the cause chain when this exception is thrown, printing it here - // SpecsLogs.warn("Original exception:", (Throwable) original); - // SpecsLogs.warn("Aspect exception:", exception); - - throw exception; - } - - public static RuntimeException processAspectException(Object original, String aspectName, - String aspectCoords, int lineMapping) { // Map lineMapping) { - - Throwable javaScriptException; - - if (original instanceof BaseException) { - return processAspectException((BaseException) original, aspectName, aspectCoords, -1, - lineMapping); - } - - javaScriptException = getException(original); - AspectDefException exception = new AspectDefException(aspectName, aspectCoords, -1, -1, javaScriptException); - - return exception;// new WrappedException(exception); - } - - private static RuntimeException processAspectException(BaseException exception, String aspectName, - String aspectCoords, int jsLine, - int lineMapping) { // Map lineMapping) { - - int line; - if (exception instanceof UserException) { - line = -1; // Will already be showned in its message - - } else { - line = getLARALine(lineMapping, jsLine); - } - - return new AspectDefException(aspectName, aspectCoords, line, jsLine, exception); - - } - - private static int getLARALine(int lineMapping, int jsLine) { // Map - // lineMapping, - // int - // jsLine) { - int laraLine = lineMapping > -1 ? lineMapping : -1; - // int laraLine = -1; - // if (jsLine > -1 && lineMapping.containsKey(jsLine)) { // > jsLine && - // jsLine > -1 - // laraLine = lineMapping.get(jsLine); - // } - // System.out.println("JSLINE: " + jsLine); - return laraLine; - } -} diff --git a/LARAI/src/org/lara/interpreter/utils/JsGear.java b/LARAI/src/org/lara/interpreter/utils/JsGear.java deleted file mode 100644 index 78e4c4d9e..000000000 --- a/LARAI/src/org/lara/interpreter/utils/JsGear.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright 2022 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.utils; - -import org.lara.interpreter.weaver.interf.AGear; -import org.lara.interpreter.weaver.interf.WeaverEngine; -import org.lara.interpreter.weaver.interf.events.data.ActionEvent; - -public class JsGear extends AGear { - - private Object jsOnAction; - - public JsGear() { - this.jsOnAction = null; - } - - /** - * - * @param jsOnAction - * @return true if the given object is a function and could be set, false otherwise - */ - public boolean setJsOnAction(Object jsOnAction) { - var engine = WeaverEngine.getThreadLocalWeaver().getScriptEngine(); - - if (!engine.isFunction(jsOnAction)) { - return false; - } - - this.jsOnAction = jsOnAction; - return true; - } - - @Override - public void onAction(ActionEvent data) { - if (jsOnAction == null) { - super.onAction(data); - return; - } - - var engine = WeaverEngine.getThreadLocalWeaver().getScriptEngine(); - engine.call(jsOnAction, data); - } -} diff --git a/LARAI/src/org/lara/interpreter/utils/LaraIUtils.java b/LARAI/src/org/lara/interpreter/utils/LaraIUtils.java index d1da88115..ea2da6227 100644 --- a/LARAI/src/org/lara/interpreter/utils/LaraIUtils.java +++ b/LARAI/src/org/lara/interpreter/utils/LaraIUtils.java @@ -12,175 +12,22 @@ */ package org.lara.interpreter.utils; -import larai.LaraI; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Options; -import org.apache.commons.lang3.StringEscapeUtils; import org.lara.interpreter.cli.CLIOption; import org.lara.interpreter.cli.OptionsParser; -import org.lara.interpreter.joptions.config.interpreter.LaraiKeys; -import org.lara.interpreter.weaver.interf.WeaverEngine; -import org.lara.language.specification.dsl.LanguageSpecification; -import org.suikasoft.jOptions.Interfaces.DataStore; -import pt.up.fe.specs.lara.aspectir.Base; -import pt.up.fe.specs.lara.langspec.LangSpecsXmlParser; -import pt.up.fe.specs.lara.loc.LaraLoc; -import pt.up.fe.specs.lara.loc.LaraStats; -import pt.up.fe.specs.util.SpecsIo; +import larai.LaraI; import pt.up.fe.specs.util.SpecsSystem; import pt.up.fe.specs.util.utilities.JarPath; -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import static org.lara.interpreter.weaver.defaultweaver.specification.DefaultWeaverResource.*; - public class LaraIUtils { - public final static String SPACE = "\t"; - - public static enum Statements { - VARDECL, - FNDECL, - GFNDECL, - EXPR, - BLOCK, - IF, - LOOP, - CONTINUE, - BREAK, - RETURN, - YIELD, - YIELD_STAR, - WITH, - SWITCH, - THROW, - TRY, - EXIT, - SELECT, - APPLY, - SCRIPTIMPORT, - JSIMPORT, - LARAIMPORT; - } - - public static String getSpace(int depth) { - if (depth <= 0) { - return ""; - } - return String.format(String.format("%%0%dd", depth), 0).replace("0", LaraIUtils.SPACE); - } - - public static enum Operators { - UNION_JOIN("+"), - NATURAL_JOIN("::"), - BITAND_JOIN("&"), - ADD("+"), - SUB("-"), - MULT("*"), - DIV("/"), - MOD("%"), - SHL( - "<<"), - SHR(">>"), - USHR(">>>"), - OR("||"), - AND("&&"), - LT("<"), - LTE("<="), - GT(">"), - GTE(">="), - INSTANCEOF( - "instanceof"), - IN("in"), - EQ("=="), - NEQ("!="), - SEQ("==="), - NSEQ("!=="), - MATCH("~="), - BITAND("&"), - BITXOR("^"), - BITOR("|"), - COMMA(","), - POS("+"), - NEG("-"), - NOT("!"), - INV("~"), - INCP( - "++"), - DECP("--"), - ASSIGN("="), - ASSIGN_ADD("+="), - ASSIGN_SUB("-="), - ASSIGN_MULT( - "*="), - ASSIGN_DIV("/="), - ASSIGN_MOD("%="), - ASSIGN_SHL( - "<<="), - ASSIGN_SHR(">>="), - ASSIGN_USHR(">>>="), - ASSIGN_BITAND( - "&="), - ASSIGN_BITXOR("^="), - ASSIGN_BITOR("|="), - TYPEOF( - "typeof "), - DELETE("delete "), - VOID("void "); - - private String op; - - Operators(String op) { - setOp(op); - } - - public void setOp(String op) { - this.op = op; - } - - public String getOp() { - return op; - } - - public static String getOpString(String operEnum) { - return valueOf(operEnum.toUpperCase()).op; - } - - public static Operators getOpTag(String text) { - if (text != null) { - for (final Operators b : Operators.values()) { - if (text.equalsIgnoreCase(b.op)) { - return b; - } - } - } - return null; - } - - public static boolean contains(String text) { - if (text != null) { - for (final Operators b : Operators.values()) { - if (text.equalsIgnoreCase(b.op)) { - return true; - } - } - } - return false; - } - } - public static boolean printHelp(CommandLine cmd, Options options) { if (cmd.hasOption(CLIOption.help.shortOption())) { System.out.println(OptionsParser.getHelp(options)); return true; } if (cmd.hasOption(CLIOption.version.shortOption())) { - System.out.println(LaraI.LARAI_VERSION_TEXT); - var implVersion = SpecsSystem.getBuildNumber(); if (implVersion == null) { implVersion = ""; @@ -206,44 +53,4 @@ private static class JarPathHolder { public static String getJarFoldername() { return JarPathHolder.instance; } - - /** - * Creates the default language specification - * - * @return - */ - public static LanguageSpecification createDefaultLanguageSpecification() { - // TODO: Why validate is false? - return LangSpecsXmlParser.parse(JOINPOINTS, ARTIFACTS, ACTIONS, false); - } - - public static void appendComment(Base base, final StringBuilder ret) { - String comment = base.comment; - if (comment != null && !comment.isEmpty()) { - String unescapeJava = StringEscapeUtils.unescapeHtml4(comment.toString()); - ret.append(unescapeJava); - } - } - - public static Map getLaraLoc(WeaverEngine engine, DataStore args) { - // Collect LARA files and folders - List laraFiles = getLaraFiles(args); - return new LaraLoc(engine).getStats(laraFiles); - } - - /** - * Returns all the LARA files defined as inputs in the arguments. - * - * @param args - * @return - */ - public static List getLaraFiles(DataStore args) { - // Collect LARA files and folders - List laraPaths = new ArrayList<>(); - laraPaths.add(args.get(LaraiKeys.LARA_FILE)); - args.get(LaraiKeys.INCLUDES_FOLDER).forEach(path -> laraPaths.add(path)); - - return SpecsIo.getFiles(laraPaths, true, Arrays.asList("lara")); - } - } diff --git a/LARAI/src/org/lara/interpreter/utils/ManGen.java b/LARAI/src/org/lara/interpreter/utils/ManGen.java deleted file mode 100644 index 5bf5fbfa5..000000000 --- a/LARAI/src/org/lara/interpreter/utils/ManGen.java +++ /dev/null @@ -1,367 +0,0 @@ -/** - * Copyright 2019 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.utils; - -import java.io.File; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.apache.commons.cli.Option; -import org.apache.commons.cli.Options; -import org.lara.interpreter.cli.OptionsParser; -import org.lara.interpreter.weaver.interf.WeaverEngine; - -import pt.up.fe.specs.util.SpecsIo; - -public class ManGen { - - private static final String QUOTE = "\""; - private static final String SPACE = " "; - private static final String NL = "\n"; // Linux only? - private static final String SLASH = "\\"; - private static final String MAN_SECTION = "1"; - - private String name; - private String shortDesc; - private String version; - private String header; - private WeaverEngine engine; - private String longDesc; - private List synopses; - - public ManGen(String name) { - - this.name = name; - this.shortDesc = ""; - this.version = ""; - this.header = ""; - this.engine = null; - this.synopses = new ArrayList(); - } - - public String generate() { - - StringBuilder builder = new StringBuilder(); - - builder.append(getHeaderSection()); - builder.append(getNameSection()); - builder.append(getSynopsisSection()); - builder.append(getDescriptionSection()); - builder.append(getOptionsSection()); - - return builder.toString(); - } - - private String getOptionsSection() { - - StringBuilder builder = new StringBuilder(section("OPTIONS")); - - Collection

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.interpreter.utils; - -import org.lara.interpreter.weaver.interf.JoinPoint; -import org.lara.language.specification.dsl.*; -import pt.up.fe.specs.jsengine.JsEngine; - -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -public class WeaverSpecification { - private final LanguageSpecification ls; - private final JsEngine engine; - - public static WeaverSpecification newInstance(LanguageSpecification ls, JsEngine engine) { - return new WeaverSpecification(ls, engine); - } - - private WeaverSpecification(LanguageSpecification ls, JsEngine engine) { - this.ls = ls; - this.engine = engine; - } - - public String getRoot() { - String ret = ls.getRoot().getName(); - String rootAlias = ls.getRootAlias(); - if (!rootAlias.isEmpty()) { - ret = rootAlias + " (of type " + ret + ")"; - } - return ret; - } - - public boolean isJoinPoint(Object obj) { - return obj instanceof JoinPoint; - } - - public boolean isJoinPoint(Object obj, String type) { - return isJoinPoint(obj) && ((JoinPoint) obj).instanceOf(type); - } - - public Object getJoinpoints() { - - List joinPoints = ls.getJoinPoints().values().stream() - .map(JoinPointClass::getName) - .collect(Collectors.toList()); - joinPoints.add(JoinPointClass.getGlobalName()); - return engine.toNativeArray(joinPoints); - } - - public Object attributesOf(String joinPoint) { - return attributesOf(joinPoint, true); - } - - public Object selectsOf(String joinPointName) { - return selectsOf(joinPointName, true); - } - - public Object actionsOf(String joinPointName) { - return actionsOf(joinPointName, true); - } - - public Object attributesOf(String joinPointName, boolean allInformation) { - - JoinPointClass joinPoint = getJoinPoint(joinPointName); - if (joinPoint == null) { - warnMissingJoinPointType(joinPointName, "attributes"); - return engine.newNativeArray(); - } - Collection attributes; - if (allInformation) { - attributes = joinPoint.getAttributes(); - } else { - attributes = joinPoint.getAttributesSelf(); - } - List attributeStrings = attributes.stream() - .map(Attribute::toString) - .collect(Collectors.toList()); - return engine.toNativeArray(attributeStrings); - } - - private static void warnMissingJoinPointType(String joinPointName, String collectionType) { - System.out.println( - "[Warning] The join point '" + joinPointName - + "' does not exist in the language specification. Returning an empty array of " - + collectionType); - } - - public Object selectsOf(String joinPointName, boolean allInformation) { - - JoinPointClass joinPoint = getJoinPoint(joinPointName); - if (joinPoint == null) { - warnMissingJoinPointType(joinPointName, "selects"); - return engine.newNativeArray(); - } - Collection selects; private List actions; // TODO: There is attribute and action overloading, fix this private final Lazy> attributeMap; private final Lazy> actionsMap; - private final Lazy> selectsMap; public JoinPointClass(String name) { this(name, null, null); @@ -46,45 +49,23 @@ public JoinPointClass(String name, JoinPointClass extend, String defaultAttribut setExtend(extend); setDefaultAttribute(defaultAttribute); attributes = new ArrayList<>(); - selects = new ArrayList<>(); actions = new ArrayList<>(); - attributeMap = Lazy.newInstance(() -> buildMultiMap(getAttributes(), attr -> attr.getName())); - actionsMap = Lazy.newInstance(() -> buildMultiMap(getActions(), action -> action.getName())); - // availableSelects = Lazy.newInstance(this::buildAvailableSelects); - selectsMap = Lazy.newInstance(() -> buildMap(getSelects(), select -> select.getSelectName())); + attributeMap = Lazy.newInstance(() -> buildMultiMap(getAttributesSelf(), Attribute::getName)); + actionsMap = Lazy.newInstance(() -> buildMultiMap(getActionsSelf(), Action::getName)); } - /** - * @return set with what can be selected in this join point - */ - // private Set buildAvailableSelects() { - // Set availableSelects = new LinkedHashSet<>(); - // - // for (var select : selects) { - // // Alias has priority over class - // var alias = select.getAlias(); - // if (!alias.isEmpty()) { - // availableSelects.add(alias); - // } else { - // availableSelects.add(select.getClazz().getName()); - // } - // } - // - // return availableSelects; - // } - private MultiMap buildMultiMap(List nodes, Function keyMapper) { - MultiMap map = new MultiMap<>(); - - for (var node : nodes) { - map.put(keyMapper.apply(node), node); - } + public String getName() { + return name; + } - return map; + public void setName(String name) { + IdentifierValidator.requireValid(name, "join point name"); + this.name = name; } - private Map buildMap(List nodes, Function keyMapper) { - Map map = new LinkedHashMap<>(); + private MultiMap buildMultiMap(List nodes, Function keyMapper) { + MultiMap map = new MultiMap<>(); for (var node : nodes) { map.put(keyMapper.apply(node), node); @@ -93,88 +74,30 @@ private Map buildMap(List nodes, Function getAttribute(String name) { - List attribute = new ArrayList<>(); - - // getAttribute(name, attribute); - getElement(name, key -> attributeMap.get().get(key), attribute); - - return attribute; - } - - // private void getAttribute(String name, List attribute) { - // // If no extends, directly add corresponding attribute and return - // if (!hasExtend()) { - // attribute.addAll(attributeMap.get().get(name)); - // return; - // } - // - // // Extends other join point, first add attributes from super, and then self - // extend.get().getAttribute(name, attribute); - // - // attribute.addAll(attributeMap.get().get(name)); - // } - - public boolean hasAttribute(String name) { - // If attribute present, return immediately - if (attributeMap.get().containsKey(name)) { - return true; - } - - // If extends join point, find in super - return extend.get().hasAttribute(name); - } - - public List getAttributeSelf(String name) { - return attributeMap.get().get(name); - } - - public boolean hasAttributeSelf(String name) { - return attributeMap.get().containsKey(name); - } - - /** - * @param name - * @return the actions corresponding to the given name, or empty list if none exists. - */ - public List getActionSelf(String name) { - return actionsMap.get().get(name); - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; + public boolean hasExtend() { + return extend.isPresent(); } /** - * Which join point class this join point extends. All join points extends 'joinpoint', except for joinpoint itself. - *

- * TODO: Should return empty if extends 'joinpoint'? + * Which join point class this join point extends. All join points extends + * 'joinpoint', except for joinpoint itself. * - * @return + * @return the join point class it extends, or Optional.empty() if does not + * extend anything. */ public Optional getExtend() { return extend; } /** - * @return the join point class it explicitly extends, or Optional.empty() if does not extend a class or extends 'joinpoint' + * @return the join point class it explicitly extends, or Optional.empty() if + * does not extend a class or extends 'joinpoint' */ public Optional getExtendExplicit() { return getExtend().filter(jp -> !jp.getName().equals(getGlobalName())); } public void setExtend(JoinPointClass extend) { - //SpecsCheck.checkArgument(extend != null && (!extend.getName().equals(getName())), () -> "Cannot extend itself: " + getName()); - if (extend == null) { this.extend = Optional.empty(); } else { @@ -190,10 +113,6 @@ public void setDefaultAttribute(String defaultAttribute) { } } - // public Optional getDirectDefaultAttribute() { - // return defaultAttribute; - // } - public Optional getDefaultAttribute() { // If present return if (defaultAttribute.isPresent()) { @@ -201,122 +120,88 @@ public Optional getDefaultAttribute() { } // Check if super has default attribute - return getExtend().map(superJp -> superJp.getDefaultAttribute()).orElse(Optional.empty()); + return getExtend().flatMap(JoinPointClass::getDefaultAttribute); } public void add(Attribute attribute) { attributes.add(attribute); } - public void addAttribute(IType type, String name, Parameter... parameters) { - attributes.add(new Attribute(type, name, Arrays.asList(parameters))); - } - - public void add(Select select) { - selects.add(select); - } - public void add(Action action) { - // action.addJoinPoint(this); actions.add(action); - // action.setJoinPoint(this); + } + + public void addAttribute(IType type, String name, Parameter... parameters) { + attributes.add(new Attribute(type, name, Arrays.asList(parameters))); } public void addAction(IType returnType, String name, Parameter... parameters) { actions.add(new Action(returnType, name, Arrays.asList(parameters))); } - public void setActions(List actions) { - // Unset previous actions - // this.actions.stream().forEach(action -> action.removeJoinPoint(this)); - // this.actions.stream().forEach(action -> action.setJoinPoint(null)); + public void setAttributes(List attributes) { + this.attributes = attributes; + } - // Set new actions + public void setActions(List actions) { this.actions = actions; - // this.actions.stream().forEach(action -> action.addJoinPoint(this)); - // this.actions.stream().forEach(action -> action.setJoinPoint(this)); } public List getAttributesSelf() { - return attributes; + return Collections.unmodifiableList(attributes); } - public void setAttributes(List attributes) { - this.attributes = attributes; - } - - public List selects) { - this.selects = selects; - if (selects != null && !selects.isEmpty()) { - selects.forEach(s -> s.setSelector(this)); - } + public List getActionSelf(String name) { + return actionsMap.get().get(name); } - public List getActionsSelf() { - return Collections.unmodifiableList(actions); + public boolean hasAttributeSelf(String name) { + return attributeMap.get().containsKey(name); } - /** - * Get all selects for this join point - * - * @return - */ - public List selects = new ArrayList<>(); - selects.addAll(this.selects); - if (extend.isPresent()) { - selects.addAll(extend.get().getSelects()); - } - - return selects; + public boolean hasActionSelf(String name) { + return actionsMap.get().containsKey(name); } - /** - * @param joinPointName - * @return the select with the given name - */ - public Optional getSelectedBy(JoinPointClass jp) { - List { - - private JoinPointClass clazz; - private String alias; - private JoinPointClass selector; - - public Select(JoinPointClass clazz) { - this(clazz, null); - } - - public Select(JoinPointClass clazz, String alias) { - this.setClazz(clazz); - this.setAlias(alias); - } - - public JoinPointClass getClazz() { - return clazz; - } - - public void setClazz(JoinPointClass clazz) { - this.clazz = clazz; - } - - public Optional getAlias() { - return Optional.ofNullable(alias); - } - - public void setAlias(String alias) { - if (alias != null && alias.isBlank()) { - this.alias = null; - } else { - this.alias = alias; - } - } - - @Override - public String toString() { - return clazz.getName() + getAlias().map(alias -> " as " + alias).orElse(""); - //return clazz.getName() + (!alias.isEmpty() ? " as " + alias : ""); - } - - public JoinPointClass getSelector() { - return selector; - } - - public void setSelector(JoinPointClass selector) { - this.selector = selector; - } - - @Override - public int compareTo(Select o) { - return getClazz().compareTo(o.getClazz()); - } - - /** - * @return the alias of this select, or the class name if no alias is defined - */ - public String getSelectName() { - return getAlias().orElse(clazz.getName()); - /* - if (!alias.isEmpty()) { - return alias; - } - - return clazz.getName(); - */ - } -} diff --git a/LanguageSpecification/src/org/lara/language/specification/dsl/types/ArrayType.java b/LanguageSpecification/src/org/lara/language/specification/dsl/types/ArrayType.java index 8d3929e5b..eda10850f 100644 --- a/LanguageSpecification/src/org/lara/language/specification/dsl/types/ArrayType.java +++ b/LanguageSpecification/src/org/lara/language/specification/dsl/types/ArrayType.java @@ -13,8 +13,6 @@ package org.lara.language.specification.dsl.types; -import tdrc.utils.StringUtils; - public class ArrayType implements IType { IType baseType; @@ -34,8 +32,8 @@ public static ArrayType of(IType baseType) { } @Override - public String getType() { - return baseType.getType() + StringUtils.repeat("[]", dimension); + public String type() { + return baseType.type() + "[]".repeat(dimension); } @Override @@ -61,7 +59,7 @@ public void setDimension(int dimension) { @Override public String toString() { - return getType(); + return type(); } } diff --git a/LanguageSpecification/src/org/lara/language/specification/dsl/types/EnumDef.java b/LanguageSpecification/src/org/lara/language/specification/dsl/types/EnumDef.java index fb172646a..bccb685c4 100644 --- a/LanguageSpecification/src/org/lara/language/specification/dsl/types/EnumDef.java +++ b/LanguageSpecification/src/org/lara/language/specification/dsl/types/EnumDef.java @@ -14,6 +14,7 @@ package org.lara.language.specification.dsl.types; import org.lara.language.specification.dsl.BaseNode; +import org.lara.language.specification.dsl.IdentifierValidator; import java.util.ArrayList; import java.util.List; @@ -29,7 +30,7 @@ public EnumDef(String name) { } public EnumDef(String name, List values) { - this.name = name; + setName(name); this.setValues(values); } @@ -38,6 +39,7 @@ public String getName() { } public void setName(String name) { + IdentifierValidator.requireValid(name, "enum name"); this.name = name; } @@ -46,7 +48,7 @@ public void add(String value, String string) { } @Override - public String getType() { + public String type() { return getName(); } diff --git a/LanguageSpecification/src/org/lara/language/specification/dsl/types/EnumValue.java b/LanguageSpecification/src/org/lara/language/specification/dsl/types/EnumValue.java index b458b1d0e..843a9c330 100644 --- a/LanguageSpecification/src/org/lara/language/specification/dsl/types/EnumValue.java +++ b/LanguageSpecification/src/org/lara/language/specification/dsl/types/EnumValue.java @@ -13,6 +13,8 @@ package org.lara.language.specification.dsl.types; +import org.lara.language.specification.dsl.IdentifierValidator; + public class EnumValue implements Comparable { private String value; @@ -32,6 +34,7 @@ public String getValue() { } public void setValue(String value) { + IdentifierValidator.requireValid(value, "enum value"); this.value = value; } diff --git a/LanguageSpecification/src/org/lara/language/specification/dsl/types/GenericType.java b/LanguageSpecification/src/org/lara/language/specification/dsl/types/GenericType.java index 09225e4c1..590fce58c 100644 --- a/LanguageSpecification/src/org/lara/language/specification/dsl/types/GenericType.java +++ b/LanguageSpecification/src/org/lara/language/specification/dsl/types/GenericType.java @@ -13,24 +13,11 @@ package org.lara.language.specification.dsl.types; -public class GenericType implements IType { - - private final String type; - private final boolean isArray; - - public GenericType(String type, boolean isArray) { - this.type = type; - this.isArray = isArray; - } - - @Override - public String getType() { - return type; - } +public record GenericType(String type, boolean isArray) implements IType { @Override - public boolean isArray() { - return isArray; + public String toString() { + return type != null ? type : "null"; } } diff --git a/LanguageSpecification/src/org/lara/language/specification/dsl/types/IType.java b/LanguageSpecification/src/org/lara/language/specification/dsl/types/IType.java index 4553af2d2..6eaa0e14c 100644 --- a/LanguageSpecification/src/org/lara/language/specification/dsl/types/IType.java +++ b/LanguageSpecification/src/org/lara/language/specification/dsl/types/IType.java @@ -15,10 +15,10 @@ public interface IType { - public String getType(); + public String type(); default public boolean isArray() { - return false; + return false; } @Override diff --git a/LanguageSpecification/src/org/lara/language/specification/dsl/types/JPType.java b/LanguageSpecification/src/org/lara/language/specification/dsl/types/JPType.java index 8a1731c5d..93deeefa6 100644 --- a/LanguageSpecification/src/org/lara/language/specification/dsl/types/JPType.java +++ b/LanguageSpecification/src/org/lara/language/specification/dsl/types/JPType.java @@ -28,7 +28,7 @@ public static JPType of(JoinPointClass jointPoint) { } @Override - public String getType() { + public String type() { return joinPoint.getName(); } @@ -42,7 +42,7 @@ public void setJointPoint(JoinPointClass jointPoint) { @Override public String toString() { - return getType(); + return type(); } } diff --git a/LanguageSpecification/src/org/lara/language/specification/dsl/types/LiteralEnum.java b/LanguageSpecification/src/org/lara/language/specification/dsl/types/LiteralEnum.java index fa4fedf49..1039b9d90 100644 --- a/LanguageSpecification/src/org/lara/language/specification/dsl/types/LiteralEnum.java +++ b/LanguageSpecification/src/org/lara/language/specification/dsl/types/LiteralEnum.java @@ -71,16 +71,12 @@ public void setValues(List values) { } @Override - public String getType() { + public String type() { return toString(); } @Override public String toString() { return values.stream().collect(Collectors.joining("| ", "[", "]")); - //return values.stream().collect(Collectors.joining(",", "{", "}")); - - // To keep compatibility with previous code, since it is dependent on this format - //return values.stream().collect(Collectors.joining("\",\"", "{\"", "\"}")); } } diff --git a/LanguageSpecification/src/org/lara/language/specification/dsl/types/Primitive.java b/LanguageSpecification/src/org/lara/language/specification/dsl/types/Primitive.java index fd7eacbe6..4239f4e6f 100644 --- a/LanguageSpecification/src/org/lara/language/specification/dsl/types/Primitive.java +++ b/LanguageSpecification/src/org/lara/language/specification/dsl/types/Primitive.java @@ -33,33 +33,33 @@ public enum Primitive implements IType { public static Primitive get(String name) { - for (final Primitive primitive : values()) { + for (final Primitive primitive : values()) { - if (primitive.name().toLowerCase().equals(name)) { - return primitive; - } - } - throw new RuntimeException("The type '" + name + "' is not a primitive."); + if (primitive.name().toLowerCase().equals(name)) { + return primitive; + } + } + throw new RuntimeException("The type '" + name + "' is not a primitive."); } public static boolean contains(String name) { - for (final Primitive primitive : values()) { + for (final Primitive primitive : values()) { - if (primitive.name().toLowerCase().equals(name)) { - return true; - } - } - return false; + if (primitive.name().toLowerCase().equals(name)) { + return true; + } + } + return false; } @Override - public String getType() { - return name().toLowerCase(); + public String type() { + return name().toLowerCase(); } @Override public String toString() { - return getType(); + return type(); } } diff --git a/LanguageSpecification/src/org/lara/language/specification/dsl/types/PrimitiveClasses.java b/LanguageSpecification/src/org/lara/language/specification/dsl/types/PrimitiveClasses.java index 73b1124bd..66f25797b 100644 --- a/LanguageSpecification/src/org/lara/language/specification/dsl/types/PrimitiveClasses.java +++ b/LanguageSpecification/src/org/lara/language/specification/dsl/types/PrimitiveClasses.java @@ -39,8 +39,6 @@ public enum PrimitiveClasses implements IType { public static PrimitiveClasses get(String name) { name = name.toUpperCase(); for (final PrimitiveClasses primitive : values()) { - - // String primName = StringUtils.firstCharToUpper(primitive.name()); if (primitive.name().equals(name)) { return primitive; } @@ -51,8 +49,6 @@ public static PrimitiveClasses get(String name) { public static boolean contains(String name) { name = name.toUpperCase(); for (final PrimitiveClasses primitive : values()) { - - // String primName = StringUtils.firstCharToUpper(primitive.name()); if (primitive.name().equals(name)) { return true; } @@ -61,7 +57,7 @@ public static boolean contains(String name) { } @Override - public String getType() { + public String type() { if (this == JOINPOINT_INTERFACE) { return "JoinpointInterface"; } @@ -70,7 +66,6 @@ public String getType() { @Override public String toString() { - // TODO Auto-generated method stub - return getType(); + return type(); } } diff --git a/LanguageSpecification/src/org/lara/language/specification/dsl/types/TypeDef.java b/LanguageSpecification/src/org/lara/language/specification/dsl/types/TypeDef.java index 6a07503fa..880b94fe8 100644 --- a/LanguageSpecification/src/org/lara/language/specification/dsl/types/TypeDef.java +++ b/LanguageSpecification/src/org/lara/language/specification/dsl/types/TypeDef.java @@ -19,6 +19,7 @@ import org.lara.language.specification.dsl.Attribute; import org.lara.language.specification.dsl.BaseNode; +import org.lara.language.specification.dsl.IdentifierValidator; public class TypeDef extends BaseNode implements IType { @@ -30,7 +31,7 @@ public TypeDef(String name) { } public TypeDef(String name, List fields) { - this.name = name; + setName(name); this.fields = fields; } @@ -39,6 +40,7 @@ public String getName() { } public void setName(String name) { + IdentifierValidator.requireValid(name, "typedef name"); this.name = name; } @@ -55,7 +57,7 @@ public void setFields(List fields) { } @Override - public String getType() { + public String type() { return getName(); } diff --git a/LanguageSpecification/src/org/lara/language/specification/exception/LanguageSpecificationException.java b/LanguageSpecification/src/org/lara/language/specification/exception/LanguageSpecificationException.java index 75fc455c6..a6940cc9f 100644 --- a/LanguageSpecification/src/org/lara/language/specification/exception/LanguageSpecificationException.java +++ b/LanguageSpecification/src/org/lara/language/specification/exception/LanguageSpecificationException.java @@ -15,34 +15,39 @@ import pt.up.fe.specs.tools.lara.exception.BaseException; +import java.io.Serial; + public class LanguageSpecificationException extends BaseException { private static final String DEFAULT_TEXT = "while building language specification"; - /** - * - */ + @Serial private static final long serialVersionUID = 1L; - private String message; - public LanguageSpecificationException(Throwable e) { - super(e); + public LanguageSpecificationException(String message) { + super(message); } public LanguageSpecificationException(String message, Throwable e) { - super(e); - this.message = message; + super(message, e); + } + + public LanguageSpecificationException(Throwable e) { + super(e); } @Override protected String generateMessage() { - - return "Exception on "; + return "Exception on " + this.generateSimpleMessage(); } @Override protected String generateSimpleMessage() { - // TODO Auto-generated method stub - return this.message != null ? this.message : LanguageSpecificationException.DEFAULT_TEXT; + String message = this.getDetailMessage(); + if (message != null && !message.isBlank()) { + return message; + } + + return DEFAULT_TEXT; } } diff --git a/LanguageSpecification/src/org/lara/language/specification/exception/SchemaValidationException.java b/LanguageSpecification/src/org/lara/language/specification/exception/SchemaValidationException.java deleted file mode 100644 index 8e7357c9b..000000000 --- a/LanguageSpecification/src/org/lara/language/specification/exception/SchemaValidationException.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright 2013 SPeCS Research Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.language.specification.exception; - -public class SchemaValidationException extends RuntimeException { - - public SchemaValidationException(String errorMsg) { - super(errorMsg); - } - - /** - * - */ - private static final long serialVersionUID = -8105032078507198496L; - -} diff --git a/LanguageSpecification/src/org/lara/language/specification/graph/JPEdgeInfo.java b/LanguageSpecification/src/org/lara/language/specification/graph/JPEdgeInfo.java deleted file mode 100644 index 2c3ff2061..000000000 --- a/LanguageSpecification/src/org/lara/language/specification/graph/JPEdgeInfo.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Copyright 2015 SPeCS Research Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.language.specification.graph; - -public class JPEdgeInfo { - - private boolean extend; - private String sourceId; - private String targetId; - private String label; - - private JPEdgeInfo(String sourceId, String targetId) { - this.sourceId = sourceId; - this.targetId = targetId; - extend = false; - } - - public static JPEdgeInfo newSelects(String alias, String sourceId, String targetId) { - final JPEdgeInfo jpEdgeInfo = new JPEdgeInfo(sourceId, targetId); - jpEdgeInfo.label = alias; - return jpEdgeInfo; - } - - public static JPEdgeInfo newExtends(String sourceId, String targetId) { - final JPEdgeInfo info = new JPEdgeInfo(sourceId, targetId); - info.extend = true; - return info; - } - - /** - * @return the sourceId - */ - public String getSourceId() { - return sourceId; - } - - /** - * @return the targetId - */ - public String getTargetId() { - return targetId; - } - - /** - * @param sourceId - * the sourceId to set - */ - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - /** - * @param targetId - * the targetId to set - */ - public void setTargetId(String targetId) { - this.targetId = targetId; - } - - public String getLabel() { - return label; - } - - public boolean hasLabel() { - return label != null && !label.isEmpty(); - } - - public boolean isExtend() { - return extend; - } - - @Override - public String toString() { - // if (extend) { - // return "[arrowhead=\"empty\",style=\"dashed\",label=\"extend\"]"; - // } - // String string = "["; - // if (hasLabel()) { - // - // string += "label=\"" + label + "\","; - // } - // string += "concentrate=true]"; - - if (hasLabel()) { - return label; - } - if (extend) { - return "extends"; - } - return ""; - } -} diff --git a/LanguageSpecification/src/org/lara/language/specification/graph/JPMGraph.java b/LanguageSpecification/src/org/lara/language/specification/graph/JPMGraph.java deleted file mode 100644 index 964525fd1..000000000 --- a/LanguageSpecification/src/org/lara/language/specification/graph/JPMGraph.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Copyright 2015 SPeCS Research Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.language.specification.graph; - -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import pt.up.fe.specs.util.graphs.Graph; - -/** - * Create a join point model graph Representation - * - * @author Tiago - * - */ -public class JPMGraph extends Graph { - - private String name; - - /** - * Create a join point model graph Representation - * - * @param graphName - * the name of the graph - */ - public JPMGraph(String graphName) { - name = graphName; - } - - private JPMGraph(List nodeList, Map graphNodes) { - super(nodeList, graphNodes); - } - - @Override - public JPMGraph getUnmodifiableGraph() { - return new JPMGraph(Collections.unmodifiableList(getNodeList()), Collections.unmodifiableMap(getGraphNodes())); - } - - @Override - protected JoinPointNode newNode(String operationId, JPNodeInfo nodeInfo) { - return new JoinPointNode(operationId, nodeInfo); - } - - /** - * Add a new node with default {@link JPNodeInfo}. - * - * @param sourceId - * @param targetId - */ - public JoinPointNode addNode(String operationId) { - return addNode(operationId, new JPNodeInfo(operationId)); - } - - /** - * Add a new select between a source join point and a target join point. - * - * @param alias - * @param sourceId - * @param targetId - */ - public void addSelect(String label, String sourceId, String targetId) { - addConnection(sourceId, targetId, JPEdgeInfo.newSelects(label, sourceId, targetId)); - } - - /** - * Add a new select between a source join point and a target join point. - * - * @param sourceId - * @param targetId - */ - public void addSelect(String sourceId, String targetId) { - addConnection(sourceId, targetId, JPEdgeInfo.newSelects(null, sourceId, targetId)); - } - - /** - * Add a new extend between a source join point and a target join point. - * - * @param sourceId - * @param targetId - */ - public void addExtend(String sourceId, String targetId) { - addConnection(sourceId, targetId, JPEdgeInfo.newExtends(sourceId, targetId)); - } - - /** - * Convert this graph into the graphviz 'DSL' format - * - * @return a string representing the graph in the graphviz form - */ - public String toGraphviz() { - final String lineSeparator = System.lineSeparator(); - final StringBuilder graphStr = new StringBuilder("digraph "); - graphStr.append(name); - graphStr.append("{"); - graphStr.append(lineSeparator); - - for (final JoinPointNode joinPointNode : getNodeList()) { - final String thisNode = joinPointNode.getId(); - - joinPointNode.getChildren().forEach(node -> { - final String targetId = node.getId(); - final String edgeStr = "\t" + thisNode + "->" + targetId; - joinPointNode.getEdges(targetId).forEach(edge -> { - graphStr.append(edgeStr); - graphStr.append(edge.toString()); - graphStr.append(";\n"); - }); - }); - - } - graphStr.append("}"); - return graphStr.toString(); - } -} diff --git a/LanguageSpecification/src/org/lara/language/specification/graph/JPNodeInfo.java b/LanguageSpecification/src/org/lara/language/specification/graph/JPNodeInfo.java deleted file mode 100644 index 926c4e6fb..000000000 --- a/LanguageSpecification/src/org/lara/language/specification/graph/JPNodeInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright 2015 SPeCS Research Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.language.specification.graph; - -public class JPNodeInfo { - - // Just some changes, let's see if this changes the hash of the file and - // there is not a collision again - // Some kind of collision is happening when pulling from master (f6427c4) to - // pass-system-2 (9370d65) - // Git tries to merge this file with file NodeTransformRule - - private final String label; - - public JPNodeInfo(String label) { - this.label = label; - } - - @Override - public String toString() { - // return "[label=\"" + label + "\"]"; - return label; - } -} diff --git a/LanguageSpecification/src/org/lara/language/specification/graph/JoinPointNode.java b/LanguageSpecification/src/org/lara/language/specification/graph/JoinPointNode.java deleted file mode 100644 index 95aa5d733..000000000 --- a/LanguageSpecification/src/org/lara/language/specification/graph/JoinPointNode.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright 2015 SPeCS Research Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.language.specification.graph; - -import java.util.ArrayList; -import java.util.List; - -import pt.up.fe.specs.util.graphs.GraphNode; - -public class JoinPointNode extends GraphNode { - - public JoinPointNode(String id, JPNodeInfo nodeInfo) { - super(id, nodeInfo); - } - - @Override - protected JoinPointNode getThis() { - return this; - } - - /** - * Return a list of {@link JPEdgeInfo} connecting to a target Node. - * - * @param targetId - * the target node - * @return a list of {@link JPEdgeInfo} - */ - public List getEdges(String targetId) { - - final List edges = new ArrayList<>(); - for (final JPEdgeInfo jpEdgeInfo : getChildrenConnections()) { - - if (jpEdgeInfo.getTargetId().equals(targetId)) { - edges.add(jpEdgeInfo); - } - } - return edges; - } - /* - * @Override public void addChild(JoinPointNode childNode, JPEdgeInfo - * connectionInfo) { - * - * if (!getChildren().contains(childNode)) getChildren().add(childNode); - * getChildrenConnections().add(connectionInfo); - * - * // Add parent to child if (!childNode.parents.contains(getThis())) - * childNode.parents.add(getThis()); - * childNode.parentConnections.add(connectionInfo); } - */ -} diff --git a/LanguageSpecification/src/org/lara/language/specification/graph/TestGraph.java b/LanguageSpecification/src/org/lara/language/specification/graph/TestGraph.java deleted file mode 100644 index 1668995aa..000000000 --- a/LanguageSpecification/src/org/lara/language/specification/graph/TestGraph.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright 2015 SPeCS Research Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.language.specification.graph; - -import java.io.File; - -import pt.up.fe.specs.util.SpecsIo; - -public class TestGraph { - public static void main(String[] args) { - final JPMGraph graph = new JPMGraph("TestWeaver"); - graph.addNode("file"); - graph.addNode("function"); - graph.addNode("body"); - graph.addNode("loop"); - graph.addNode("stmt"); - graph.addNode("expr"); - graph.addNode("binExpr"); - graph.addNode("arrayAcc"); - graph.addSelect(null, "file", "function"); - graph.addSelect(null, "function", "body"); - graph.addSelect(null, "body", "loop"); - graph.addSelect(null, "loop", "body"); - graph.addSelect("firstStmt", "body", "stmt"); - graph.addSelect(null, "body", "stmt"); - graph.addSelect(null, "body", "expr"); - graph.addSelect(null, "body", "arrayAcc"); - graph.addSelect(null, "body", "binExpr"); - graph.addExtend("binExpr", "expr"); - graph.addExtend("arrayAcc", "expr"); - // graph.addSelect(null,"expr", "arrayAcc"); - // System.out.println(graph); - final String graphviz = graph.toGraphviz(); - System.out.println(graphviz); - SpecsIo.write(new File("test.dot"), graphviz); - } -} diff --git a/LanguageSpecification/src/org/lara/language/specification/resources/LanguageSpecificationResources.java b/LanguageSpecification/src/org/lara/language/specification/resources/LanguageSpecificationResources.java deleted file mode 100644 index 2ef40ac18..000000000 --- a/LanguageSpecification/src/org/lara/language/specification/resources/LanguageSpecificationResources.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright 2013 SPeCS Research Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package org.lara.language.specification.resources; - -import pt.up.fe.specs.util.providers.ResourceProvider; - -public enum LanguageSpecificationResources implements ResourceProvider { - ActionModelSchema("actionModel.xsd"), ArtifactsModelSchema("artifacts.xsd"), JoinPointModelSchema( - "joinPointModel.xsd"),; - - private final String resource; - - private static final String basePackage = "schemas/"; - - /** - * @param resource - */ - private LanguageSpecificationResources(String resource) { - this.resource = LanguageSpecificationResources.basePackage + resource; - } - - /* - * (non-Javadoc) - * - * @see - * pt.up.fe.specs.util.Interfaces.ResourceProvider#getResource() - */ - @Override - public String getResource() { - return resource; - } -} diff --git a/LanguageSpecification/src/pt/up/fe/specs/lara/langspec/LangSpecsXmlParser.java b/LanguageSpecification/src/pt/up/fe/specs/lara/langspec/LangSpecsXmlParser.java index 2d221c055..f82d812b0 100644 --- a/LanguageSpecification/src/pt/up/fe/specs/lara/langspec/LangSpecsXmlParser.java +++ b/LanguageSpecification/src/pt/up/fe/specs/lara/langspec/LangSpecsXmlParser.java @@ -13,11 +13,25 @@ package pt.up.fe.specs.lara.langspec; -import org.lara.language.specification.dsl.*; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +import org.lara.language.specification.dsl.Action; +import org.lara.language.specification.dsl.Attribute; +import org.lara.language.specification.dsl.JoinPointClass; +import org.lara.language.specification.dsl.LanguageSpecification; +import org.lara.language.specification.dsl.Parameter; import org.lara.language.specification.dsl.types.EnumDef; import org.lara.language.specification.dsl.types.EnumValue; import org.lara.language.specification.dsl.types.IType; import org.lara.language.specification.dsl.types.TypeDef; +import org.lara.language.specification.exception.LanguageSpecificationException; + import pt.up.fe.specs.util.SpecsIo; import pt.up.fe.specs.util.SpecsLogs; import pt.up.fe.specs.util.collections.MultiMap; @@ -25,30 +39,23 @@ import pt.up.fe.specs.util.xml.XmlDocument; import pt.up.fe.specs.util.xml.XmlElement; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.function.Consumer; -import java.util.stream.Collectors; - public class LangSpecsXmlParser { public static LanguageSpecification parse(InputStream joinPointModel, InputStream attributeModel, - InputStream actionModel) { + InputStream actionModel) { return parse(joinPointModel, attributeModel, actionModel, true); } public static LanguageSpecification parse(ResourceProvider joinPointModel, ResourceProvider attributeModel, - ResourceProvider actionModel, boolean validate) { + ResourceProvider actionModel, boolean validate) { return parse(SpecsIo.resourceToStream(joinPointModel), SpecsIo.resourceToStream(attributeModel), SpecsIo.resourceToStream(actionModel), validate); } public static LanguageSpecification parse(InputStream joinPointModel, InputStream attributeModel, - InputStream actionModel, boolean validate) { + InputStream actionModel, boolean validate) { var jpSchema = validate ? SchemaResource.JOIN_POINT_SCHEMA.toStream() : null; var attrSchema = validate ? SchemaResource.ATTRIBUTE_SCHEMA.toStream() : null; @@ -71,6 +78,16 @@ public static LanguageSpecification parse(InputStream joinPointModel, InputStrea langSpecV2.add(typeDef); } + for (var type : attributeModelNode.getElementsByName("enum")) { + var enumDef = new EnumDef(type.getAttribute("name")); + langSpecV2.add(enumDef); + + setOptional(type.getAttribute("tooltip"), enumDef::setToolTip); + + List valuesList = toEnumValues(type.getElementsByName("value"), langSpecV2); + enumDef.setValues(valuesList); + } + for (var type : attributeModelNode.getElementsByName("typedef")) { var typeDef = new TypeDef(type.getAttribute("name")); @@ -83,16 +100,6 @@ public static LanguageSpecification parse(InputStream joinPointModel, InputStrea langSpecV2.add(typeDef); } - for (var type : attributeModelNode.getElementsByName("enum")) { - var enumDef = new EnumDef(type.getAttribute("name")); - langSpecV2.add(enumDef); - - setOptional(type.getAttribute("tooltip"), enumDef::setToolTip); - - List valuesList = toEnumValues(type.getElementsByName("value"), langSpecV2); - enumDef.setValues(valuesList); - } - List jps = new ArrayList<>(); for (var jpNode : joinPointModelNode.getElementsByName("joinpoint")) { var jp = new JoinPointClass(jpNode.getAttribute("class")); @@ -100,7 +107,7 @@ public static LanguageSpecification parse(InputStream joinPointModel, InputStrea jps.add(jp); } Collections.sort(jps); - jps.stream().forEach(langSpecV2::add); + jps.forEach(langSpecV2::add); var joinpoints = joinPointModelNode.getElementsByName("joinpoints").get(0); langSpecV2.setRoot(joinpoints.getAttribute("root_class")); @@ -138,7 +145,14 @@ public static LanguageSpecification parse(InputStream joinPointModel, InputStrea JoinPointClass jp = langSpecV2.getJoinPoint(jpClass); String extendsType = jpNode.getAttribute("extends"); if (!extendsType.isEmpty()) { - jp.setExtend(langSpecV2.getJoinPoint(extendsType)); + JoinPointClass parent = langSpecV2.getJoinPoint(extendsType); + if (parent == null) { + throw new LanguageSpecificationException( + "Unknown extends target '" + extendsType + "' for join point '" + jpClass + "'"); + } + + validateNoInheritanceCycle(jp, parent); + jp.setExtend(parent); } else { jp.setExtend(global); } @@ -146,7 +160,7 @@ public static LanguageSpecification parse(InputStream joinPointModel, InputStrea // Obtain attribute nodes from artifacts List artifactNodes = attributeModelNode.getElementsByName("artifact").stream() .filter(attribute -> attribute.getAttribute("class").equals(jpClass)) - .collect(Collectors.toList()); + .toList(); var attributeNodes = artifactNodes.stream() .flatMap(art -> art.getElementsByName("attribute").stream()) @@ -155,28 +169,25 @@ public static LanguageSpecification parse(InputStream joinPointModel, InputStrea // Add attributes jp.setAttributes(convertAttributes(attributeNodes, langSpecV2)); - // Add selects - jp.setSelects(convertSelects(langSpecV2, jpNode.getElementsByName("select"))); - // Add actions - jp.setActions(convertActions(langSpecV2, joinPointActions.get(jpClass))); - - // Set default attributes - for (var artifact : attributeModelNode.getElementsByName("artifact")) { - var defaultValue = artifact.getAttribute("default"); - if (defaultValue.isEmpty()) { - continue; - } + jp.setActions(convertActions(langSpecV2, joinPointActions.get(jpClass), jpClass)); + } - var artifactJp = langSpecV2.getJoinPoint(artifact.getAttribute("class")); + // Set default attributes + for (var artifact : attributeModelNode.getElementsByName("artifact")) { + var defaultValue = artifact.getAttribute("default"); + if (defaultValue.isEmpty()) { + continue; + } - if (artifactJp == null) { - SpecsLogs.info("Artifact without join point: " + artifact.getAttribute("class")); - continue; - } + var artifactJp = langSpecV2.getJoinPoint(artifact.getAttribute("class")); - artifactJp.setDefaultAttribute(defaultValue); + if (artifactJp == null) { + SpecsLogs.info("Artifact without join point: " + artifact.getAttribute("class")); + continue; } + + artifactJp.setDefaultAttribute(defaultValue); } return langSpecV2; @@ -206,7 +217,7 @@ private static List toEnumValues(List enumValues, Languag } private static void populateGlobal(XmlDocument jpModel, XmlDocument artifacts, XmlDocument actionModel, - LanguageSpecification langSpecV2, JoinPointClass global, List globalActionNodes) { + LanguageSpecification langSpecV2, JoinPointClass global, List globalActionNodes) { var globalAttributes = artifacts.getElementByName("global"); if (globalAttributes != null) { @@ -214,12 +225,12 @@ private static void populateGlobal(XmlDocument jpModel, XmlDocument artifacts, X .forEach(global::add); } - convertActions(langSpecV2, globalActionNodes).stream() + convertActions(langSpecV2, globalActionNodes, JoinPointClass.getGlobalName()) .forEach(global::add); } private static List convertAttributes(List attributeNodes, - LanguageSpecification langSpec) { + LanguageSpecification langSpec) { List attributes = new ArrayList<>(); for (var attributeNode : attributeNodes) { @@ -245,32 +256,23 @@ private static Attribute getAttribute(XmlElement attributeNode, LanguageSpecific parameterNode.getAttribute("name"), parameterNode.getAttribute("default")); } - var defNodes = attributeNode.getElementsByName("def"); - - for (var defNode : defNodes) { - // If def does not have a type, use the attribute type - newAttribute.addDef(parseDef(defNode, type)); - } - return newAttribute; } - private static Def parseDef(XmlElement defNode, String attributeType) { - // Check if it has an optional 'type' - var type = defNode.getAttribute("type", attributeType); - - return new Def(type); - } - private static String getType(XmlElement node) { // Default type is "void" return node.getAttribute("type", "void"); } private static List convertActions(LanguageSpecification langSpecV2, - List actionNodes) { + List actionNodes, String ownerName) { + + if (actionNodes == null || actionNodes.isEmpty()) { + return new ArrayList<>(); + } List newActions = new ArrayList<>(); + var seenSignatures = new HashSet(); for (var action : actionNodes) { var parameterNodes = action.getElementsByName("parameter"); List declarations = new ArrayList<>(); @@ -283,6 +285,11 @@ private static List convertActions(LanguageSpecification langSpecV2, Action newAction = new Action(langSpecV2.getType(action.getAttribute("return", "void")), action.getAttribute("name"), declarations); setOptional(action.getAttribute("tooltip"), newAction::setToolTip); + var signature = newAction.getSignature(); + if (!seenSignatures.add(signature)) { + throw new LanguageSpecificationException( + "Duplicate action signature '" + signature + "' for join point '" + ownerName + "'"); + } newActions.add(newAction); } @@ -290,27 +297,19 @@ private static List convertActions(LanguageSpecification langSpecV2, return newActions; } - private static List selects = new ArrayList<>(); - - for (var selectNode : selectNodes) { - String selectClassName = selectNode.getAttribute("class"); - JoinPointClass selectJP = langSpecV2.getJoinPoint(selectClassName); + private static void validateNoInheritanceCycle(JoinPointClass child, JoinPointClass parent) { + if (parent == null) { + return; + } - // Validation: selectJP must not be null - if (selectJP == null) { - throw new RuntimeException("Select has invalid join point name as class: " + selectClassName); + JoinPointClass current = parent; + while (current != null) { + if (current == child) { + throw new LanguageSpecificationException( + "Inheritance cycle detected for join point '" + child.getName() + "'"); } - String alias = selectNode.getAttribute("alias"); - alias = alias.equals(selectClassName) ? "" : alias; // Is this necessary? - Select newSelect = new Select(selectJP, alias); - newSelect.setToolTip(selectNode.getAttribute("tooltip", null)); - selects.add(newSelect); + current = current.getExtend().orElse(null); } - - return selects; } } diff --git a/LanguageSpecification/src/pt/up/fe/specs/lara/langspec/SchemaResource.java b/LanguageSpecification/src/pt/up/fe/specs/lara/langspec/SchemaResource.java index 009e0aaee..5924d600d 100644 --- a/LanguageSpecification/src/pt/up/fe/specs/lara/langspec/SchemaResource.java +++ b/LanguageSpecification/src/pt/up/fe/specs/lara/langspec/SchemaResource.java @@ -28,9 +28,6 @@ public enum SchemaResource implements ResourceProvider { private static final String BASE_PACKAGE = "schemas/"; - /** - * @param resource - */ private SchemaResource(String resource) { this.resource = BASE_PACKAGE + resource; } diff --git a/LanguageSpecification/src/utils/SelectUtils.java b/LanguageSpecification/src/utils/SelectUtils.java deleted file mode 100644 index 0133badd4..000000000 --- a/LanguageSpecification/src/utils/SelectUtils.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package utils; - -public class SelectUtils { - -} diff --git a/LanguageSpecification/src/utils/SelectionPath.java b/LanguageSpecification/src/utils/SelectionPath.java deleted file mode 100644 index 2ba5439f1..000000000 --- a/LanguageSpecification/src/utils/SelectionPath.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Copyright 2017 SPeCS. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package utils; - -import org.lara.language.specification.dsl.JoinPointClass; -import org.lara.language.specification.dsl.Select; -import tdrc.utils.StringUtils; - -import java.util.*; - -/** - * Will contain a path from a given join point to the destiny.
- * - * @author tdrc - * - */ -public class SelectionPath { - - private Stack getPath() { - // return path; - // } - - public Stack getReversedPath() { - if (path == null) { - return null; - } - List path) { - this.path = path; - } - - public Optional> getSecondaryPath() { - return secondaryPath; - } - - public Optional> getReversedSecondaryPath() { - if (!hasSecondaryPath()) { - return Optional.empty(); - } - List(secondaryPath.get()); - Collections.reverse(selects); - return Optional.of(selects); - } - - public void setSecondaryPath(Optional> secondaryPath) { - this.secondaryPath = secondaryPath; - } - - public void setSecondaryPath(Stack reversedPath = getReversedPath(); - - if (!reversedPath.isEmpty()) { - - toString += "\n\tMain path: " + StringUtils.join(reversedPath, "."); - } - } - if (hasSecondaryPath()) { - List path = new Stack<>(); - final Select selected = select(source, targetJP); - if (selected != null) { - - path.push(selected); - selPath.setPath(path); - // System.out.println("SEL PATH 2: " + selPath); - return selPath; - } else { - - path = selectWithMiddlePath(targetJP, source, selPath); - if (!path.isEmpty()) { - selPath.setPath(path); - } - } - // System.out.println("SEL PATH 3: " + selPath); - return selPath; - - } - - /** - * Selects a subsequent join point from the given join point - * - * @param jp the base join point - * @param joinPointClass the selected join point - * @return a {@link Select} if the name occurs, null otherwise. - */ - public Select select(JoinPointClass jp, String joinPointClass) { - return jp.getSelect(joinPointClass).orElse(null); - - // Global selects not supported - // if (globalSelects.containsKey(joinPointClass)) { - // return globalSelects.get(joinPointClass); - // } - - // Verify the selects pertaining to the join point - // for (final Select select : jp.getSelects()getSelect()) { - // - // if (select.getAlias().equals(joinPointClass)) { - // return select; - // } - // } - // // If the join point does not contain, verify the super type - // // (recursively!) - // if (!jp.getExtends().equals(jp)) { - // - // jp = (JoinPointType) jp.getExtends(); - // return select(jp, joinPointClass); - // } - // return null; - } - - private Stack path = new Stack<>(); - - final Set ignoreSet = new HashSet<>(); - ignoreSet.add(source); - // for (final Select select : source.getSelect()) { - for (final Select select : source.getSelects()) { - // final JoinPointType next = select.getClazz(); - final JoinPointClass next = select.getClazz(); - final Stack selectionPathAux(JoinPointClass current, String joinPointName, - ArrayList visitedList, Set ignoreSet, SelectionPath selPath) { - - Stack pathAux = selectionPathAux(next, joinPointName, visitedList, ignoreSet, selPath); - if (!pathAux.isEmpty()) { - pathAux.add(select); - if (selPath.hasSecondaryPath()) { - selPath.getSecondaryPath().get().add(select); - } - if (!path.isEmpty()) { - if (!alreadyFound) { - selPath.setSecondaryPath(pathAux); - selPath.setTieBreakReason("use the first path found (from a depth first search)"); - // System.out.println( - // "More than one path for inital join point '" + joinPointName + "'. Two of then are: "); - // Function, String> converted = p -> { - // if (p.getLeft().equals(p.getRight())) { - // return p.getLeft(); - // } - // return "(" + p.getRight() + " as " + p.getLeft() + ")"; - // }; - // - // System.out.println("\t1. " + StringUtils.join(path, converted, ".")); - // System.out.println("\t2. " + StringUtils.join(pathAux, converted, ".")); - // - // System.out.println("Select uses a depth first search. Will use 1."); - alreadyFound = true; - } - break; - } - path = pathAux; - } else { - ignoreSet.add(next); - } - } - visitedList.remove(current); - - return path; - } - - /** - * Searches for a join point with the same description as the {@link Select} element - * - * @param jp the list of join points - * @param select the selected join point to search - * @return a {@link JoinPointClass} if the select exists in the join point model, null otherwise. - */ - public static JoinPointClass getJoinPoint(Select select) { - final JoinPointClass joinPointType = select.getClazz(); - return joinPointType; - } - - /** - * Get the path from an existent join point root (inclusive) to the target join point (inclusive) - * - * @param tag the join point target - * @return the first path to the join point (Depth First Search) - */ - public SelectionPath selectionPath(String joinPointName) { - // System.out.println("SELECT PATH 1: from root (" + langSpec.getRoot() + ") to " + joinPointName); - // final JoinPointClass joinPointRoot = getRoot(); - final JoinPointClass joinPointRoot = langSpec.getRoot(); - SelectionPath selPath = new SelectionPath(joinPointRoot, joinPointName); - Stack + + + + + + ",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||y.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||y.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||y.push(".#.+[+~]"),e.querySelectorAll("\\\f"),y.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="
";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),d.cssHas||y.push(":has"),y=y.length&&new RegExp(y.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),v=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType&&e.documentElement||e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&v(p,e)?-1:t==C||t.ownerDocument==p&&v(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!y||!y.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),v.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",v.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",v.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),v.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="

",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(v.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return B(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=_e(v.pixelPosition,function(e,t){if(t)return t=Be(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return B(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0