diff --git a/.gitignore b/.gitignore
index 7d5e6d711..e24fe0bbb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
target/
classes/
tools/eclipse/plugins/org.scribble.*/bin/
-*.jar
.classpath
.project
.checkstyle
@@ -9,49 +8,71 @@ tools/eclipse/plugins/org.scribble.*/bin/
.DS_Store
*~
*.swp
-bin/scribblec.sh
*.bak
+*.versionsBackup
+
+.idea
+**/*.iml
javadoc
-#modules/demos/scrib
-
-modules/demos/scrib/betty16/src/betty16/lec1/httplong/HttpLong/
-modules/demos/scrib/betty16/src/betty16/lec1/httpshort/HttpShort/
-modules/demos/scrib/betty16/src/betty16/lec2/adder/Adder/
-modules/demos/scrib/betty16/src/betty16/lec2/smtp/Smtp/
-modules/demos/scrib/bettybook/src/bettybook/http/longv/HttpLong/
-modules/demos/scrib/bettybook/src/bettybook/http/shortv/HttpShort/
-modules/demos/scrib/bettybook/src/bettybook/math/scrib/Math/
-modules/demos/scrib/coco/src/coco/fibo/Fibo/
-modules/demos/scrib/coco/src/coco/smtp/Smtp/
-modules/demos/scrib/fase16/src/fase16/adder/Adder/
-modules/demos/scrib/fase16/src/fase16/smtp/Smtp/
-modules/demos/scrib/fib/src/fib/Fib/
-modules/demos/scrib/http/src/http/longvers/HttpLong/
-modules/demos/scrib/http/src/http/shortvers/HttpShort/
-modules/demos/scrib/loan/src/loan/LoanApplication/
-modules/demos/scrib/smtp/src/smtp/Smtp/
-modules/demos/scrib/travel/src/travel/Travel/
-
-#modules/core/src/test/scrib
-
-modules/core/src/test/scrib/exercise/calculator/EProtocol/
-modules/core/src/test/scrib/exercise/voting/EProtocol/
-
-modules/core/src/test/scrib/demo/fase17/travel/TravelAgent/
-modules/core/src/test/scrib/demo/fase17/travel2/TravelAgent2/
-
-modules/core/src/test/scrib/scratch/scratch1/
-modules/core/src/test/scrib/scratch/scratch2/
-modules/core/src/test/scrib/test/foo/Foo/
-modules/core/src/test/scrib/test/test1/
-modules/core/src/test/scrib/test/test2/
-modules/core/src/test/scrib/test/test3/
-modules/core/src/test/scrib/test/test4/
-modules/core/src/test/scrib/test/test5/
-modules/core/src/test/scrib/test/test6/
-modules/core/src/test/scrib/test/test7/
-modules/core/src/test/scrib/test/test8/
-modules/core/src/test/scrib/test/test9/
+
+##
+#scribble-demos/scrib
+
+scribble-demos/scrib/Makefile
+scribble-demos/scrib/tutorial/src/tutorial/adder/Adder/
+scribble-demos/scrib/betty16/src/betty16/lec1/httplong/HttpLong/
+scribble-demos/scrib/betty16/src/betty16/lec1/httpshort/HttpShort/
+scribble-demos/scrib/betty16/src/betty16/lec2/adder/Adder/
+scribble-demos/scrib/betty16/src/betty16/lec2/smtp/Smtp/
+scribble-demos/scrib/bettybook/src/bettybook/http/longv/HttpLong/
+scribble-demos/scrib/bettybook/src/bettybook/http/shortv/HttpShort/
+scribble-demos/scrib/bettybook/src/bettybook/math/scrib/Math/
+scribble-demos/scrib/coco/src/coco/fibo/Fibo/
+scribble-demos/scrib/coco/src/coco/smtp/Smtp/
+scribble-demos/scrib/fase16/src/fase16/adder/Adder/
+scribble-demos/scrib/fase16/src/fase16/smtp/Smtp/
+scribble-demos/scrib/fib/src/fib/Fib/
+scribble-demos/scrib/http/src/http/longvers/HttpLong/
+scribble-demos/scrib/http/src/http/shortvers/HttpShort/
+scribble-demos/scrib/loan/src/loan/LoanApplication/
+scribble-demos/scrib/smtp/src/smtp/Smtp/
+scribble-demos/scrib/travel/src/travel/Travel/
+scribble-demos/scrib/tutorial/src/tutorial/adder/Adder/
+
+
+##
+#scribble-test/src/test/scrib
+
+scribble-test/src/test/scrib/exercise/calculator/EProtocol/
+scribble-test/src/test/scrib/exercise/voting/EProtocol/
+
+scribble-test/src/test/scrib/demo/fase17/travel/TravelAgent/
+scribble-test/src/test/scrib/demo/fase17/travel2/TravelAgent2/
+scribble-test/src/test/scrib/demo/highlow/HighLow/
+
+scribble-test/src/test/scrib/scratch/scratch1/
+scribble-test/src/test/scrib/scratch/scratch2/
+scribble-test/src/test/scrib/test/foo/Foo/
+scribble-test/src/test/scrib/test/test1/
+scribble-test/src/test/scrib/test/test2/
+scribble-test/src/test/scrib/test/test3/
+scribble-test/src/test/scrib/test/test4/
+scribble-test/src/test/scrib/test/test5/
+scribble-test/src/test/scrib/test/test6/
+scribble-test/src/test/scrib/test/test7/
+scribble-test/src/test/scrib/test/test8/
+scribble-test/src/test/scrib/test/test9/
+
+scribble-test/src/test/scrib/test/test2/Test2/
+scribble-test/src/test/scrib/test/test3/Test3/
+scribble-test/src/test/scrib/test/test4/Test4/
+scribble-test/src/test/scrib/test/test5/Test5/
+scribble-test/src/test/scrib/test/test6/Test6/
+scribble-test/src/test/scrib/test/test7/Test7/
+
+
+bin/scribblec.sh
+permissions-fix.sh
diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar
new file mode 100644
index 000000000..c6feb8bb6
Binary files /dev/null and b/.mvn/wrapper/maven-wrapper.jar differ
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 000000000..56bb0164e
--- /dev/null
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1 @@
+distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip
\ No newline at end of file
diff --git a/.settings.xml b/.settings.xml
new file mode 100644
index 000000000..8fbe094c3
--- /dev/null
+++ b/.settings.xml
@@ -0,0 +1,28 @@
+
+
+
+
+ sonatype
+ ${env.SONATYPE_USER}
+ ${env.SONATYPE_PASSWORD}
+
+
+ bintray
+ ${env.BINTRAY_USER}
+ ${env.BINTRAY_KEY}
+
+
+ jfrog-snapshots
+ ${env.BINTRAY_USER}
+ ${env.BINTRAY_KEY}
+
+
+ github.com
+ ${env.GH_USER}
+ ${env.GH_TOKEN}
+
+
+
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000000000..0f95eaf29
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,43 @@
+sudo: required
+dist: trusty
+
+language: java
+jdk:
+- oraclejdk8
+
+cache:
+ directories:
+ - $HOME/.m2/repository
+
+before_install:
+ # allocate commits to CI, not the owner of the deploy key
+ - git config user.name "scribbleci"
+ - git config user.email "ci@scribble.org"
+
+ # setup https authentication credentials, used by ./mvnw release:prepare
+ - git config credential.helper "store --file=.git/credentials"
+ - echo "https://$GH_TOKEN:@github.com" > .git/credentials
+
+install:
+ # Override default travis to use the maven wrapper
+ - ./mvnw install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
+
+script:
+ - ./travis/publish.sh
+
+branches:
+ except:
+ - /^[0-9]/
+
+env:
+ global:
+ # Ex. travis encrypt -r org/repo GH_TOKEN=XXX-https://github.com/settings/tokens-XXX
+ - secure: "EZHcIA6vC1eUqj1vMRlsMh+wBkdEejPNIy7ZDpKkf6Ntsv8COTyKbzr/mDWyl8W8BgieiYKvLiCJQpUj8ZNagGTUw8znngW6XQhDZJTuuimuyq9RikK1+owd+BNNybMTIbe21CuKpEwWranbINBJvu/Wi7IHXuqqcClQJ/fDApE="
+ # Ex. travis encrypt -r org/repo SONATYPE_USER=your_sonatype_account
+ - secure: "zD27+IC5mFIMz5lvL+cwjAeXHEdJuAFwl0M6lBr5g5/4IqInPq5bXyVeQI5vSMmKa9xk9tdx4tvRSnIqIvSqrXj0t3yl9b3lXmFFbOTtSem7Mu8MhIdSTcXkPCdt0I/1MUmtJpExQ29BwNZWwiSXeOBngxrgZTpUUhi806JGpME="
+ # Ex. travis encrypt -r org/repo SONATYPE_PASSWORD=your_sonatype_password
+ - secure: "ewf2f+EBpizqXJ9i90ekHbvODH59KKFulMdSko6qhle6E6IsTK5tuWzwSir3lRqTRAiVoJ/F3IR32fkzkMv+KaZCookN8jmFb/OI58x8jzTRz8+pJkSCMWZ+pUgZUZt51D/85pTkw3ftacVQt3oYP4wPIkJdF0c3UArTjOsapso="
+ # Ex. travis encrypt -r org/repo BINTRAY_USER=your_github_account
+ - secure: "Mofhc9/R1c3r1Ve4ZTmIX/gMb737FqvaOrAIjVSaaSW/T/pSqgh8AZu0bndVrQZ4YSpkmZcmhdO8NX0MtrxHBQMddY/DpE2o0G4oAkRUVtYUz7o5rL8Q5xVtQUngzaMrpFPBF2JlAoK+/iJDF839wGuQdiV9koaViOMt61yVRHw="
+ # Ex. travis encrypt -r org/repo BINTRAY_KEY=xxx-https://bintray.com/profile/edit-xxx
+ - secure: "yxiVTp3pD6UPex4G69tbYkXB5QWqQsu4vlUrS/RRaxOW7TWeZRl4hXtqOUwL3AxoZcJFivE4OcqdUlw2IOYVBtrVTngQ/ZAVefdD/ohNPO3+6SdP2uzqdnqAxEi7kJBqaCvUG1uEPdp+S+w5f6VcK0rfxgK+IRUxREhDmCFuCg8="
diff --git a/CHANGES b/CHANGES.md
similarity index 100%
rename from CHANGES
rename to CHANGES.md
diff --git a/README b/README
deleted file mode 100644
index e9283ec2c..000000000
--- a/README
+++ /dev/null
@@ -1,103 +0,0 @@
-README for
-
- scribble-dist-0.4-SNAPSHOT.zip
-
-This distribution is built from the master branch
-
- https://github.com/scribble/scribble-java/tree/master
-
-by
-
- mvn [clean] install
-
-(Output written to dist/target)
-
-
-Issue reporting
----
-
-Bugs and issues can be reported via the github Issues facility.
-
-Or email rhu1234 [at] doc.ic.ac.uk excluding the 1234.
-
-
-Scribble distribution zip contents:
----
-
-- lib jars needed to run the scribble-java tool
-- scribblec.sh script for running the command line tool
-
-
-Command line usage:
----
-
-> List command line options.
-
- ./scribblec.sh --help
-
-
-> Check well-formedness of global protocols in, e.g., Test.scr.
-
- ./scribblec.sh Test.scr
-
-Notes:
-- Use the -oldwf command line flag to use the simpler syntactic protocol
- well-formedness from the previous version of Scribble.
-- Use the -V command line flag to obtain full traces for errors according
- to the new protocol validation (and other details).
-
-
-> Project local protocol for role "C" of protocol "Proto" in Test.scr
-
- ./scribblec.sh Test.scr -project Proto C
-
-
-> Print dot representation of Endpoint FSM for role "C" of protocol "Proto"
- in Test.scr
-
- ./scribblec.sh Test.scr -fsm Proto C
-
-
-> Generate Java Endpoint API for role "C" of protocol "Proto"
- in Test.scr
-
- ./scribblec.sh -d . Test.scr -api Proto C
-
-
-Examples:
----
-
-> To make an HelloWorld test:
-
- echo 'module Test; global protocol Proto(role C, role S) {
- Hello() from C to S; }' > Test.scr
-
-
-Further examples can be found in:
-
- https://github.com/scribble/scribble-java/tree/master/modules/demos/scrib
-
-The distribution zip does not include these examples. They can be obtained
-as part of the source repository, or separately via the above link.
-
-> E.g. To generate the Java Endpoint API for role "C" of the "Adder"
- protocol from http://www.doc.ic.ac.uk/~rhu/scribble/fase16.pdf
-
- ./scribblec.sh -d modules/demos/scrib/fase16/src
- modules/demos/scrib/fase16/src/fase16/adder/Adder.scr -api Adder C
-
-
-Alternative command line usage:
----
-
-To run the Scribble tool directly via java:
-
- try scribblec.sh with the --verbose flag
-
-to see the underlying java command with main class, classpath and other args.
-
-Or try (from Nick Ng):
-
- $ mvn dependency:build-classpath -Dmdep.outputFile=classpath
- $ java -cp $(cat dist/classpath)
- org.scribble.cli.CommandLine [args] MyModule.scr
diff --git a/README.md b/README.md
new file mode 100644
index 000000000..408b44a3a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,108 @@
+[![Build Status][ci-img]][ci] [![Released Version][maven-img]][maven]
+
+# Java Tooling for Scribble
+
+This project provides Java tooling/libraries for the Scribble multi-party
+protocol definition language.
+
+
+## Building from source
+
+First step is to clone this git repository locally. Once available, run the
+following maven command to build the project:
+
+ mvn [clean] install
+
+The distribution will be available from the folder _scribble-dist/target_. The
+contents of the zip is:
+
+- lib jars needed to run the scribble-java tool
+- scribblec.sh script for running the command line tool
+
+
+## Command line usage:
+
+Assuming scribblec.sh has been extracted from the above zip:
+
+> List command line options.
+
+ ./scribblec.sh --help
+
+Assuming a Scribble module file Test.scr in the same directory:
+
+> Check well-formedness of global protocols in module Test.scr.
+
+ ./scribblec.sh Test.scr
+
+Note: try the -V command line flag to obtain full traces for errors (and other
+ details).
+
+> Project local protocol for role "C" of protocol "Proto" in Test.scr
+
+ ./scribblec.sh Test.scr -project Proto C
+
+
+> Print (a dot representation of) the Endpoint FSM for role "C" of protocol
+ "Proto" in Test.scr
+
+ ./scribblec.sh Test.scr -fsm Proto C
+
+
+> Generate Java Endpoint API for role "C" of protocol "Proto"
+ in Test.scr
+
+ ./scribblec.sh -d . Test.scr -api Proto C
+
+Note: omitting the -d argument will print the output to stdout.
+
+
+## Examples:
+
+> To write a HelloWorld protocol in Test.scr (e.g., for the commands listed above):
+
+ echo 'module Test; global protocol Proto(role C, role S) { Hello() from C to S; }' > Test.scr
+
+
+Further examples can be found in:
+
+ https://github.com/scribble/scribble-java/tree/master/scribble-demos/scrib
+
+The distribution zip does not include these examples. They can be obtained as
+part of the source repository, or separately via the above link.
+
+> E.g. To generate the Java Endpoint API for role "C" in the "Adder" protocol from the
+ Scribble-Java tutorial (http://www.scribble.org/docs/scribble-java.html#QUICK)
+
+ ./scribblec.sh scribble-demos/scrib/tutorial/src/tutorial/adder/Adder.scr
+ -d scribble-demos/scrib/tutorial/src/ -api Adder C
+
+
+## Alternative command line usage:
+
+To run the Scribble tool directly via java, try
+
+ ./scribblec.sh --verbose [args]
+
+to see the underlying java command with main class, classpath and other args.
+
+Or try (from Nick Ng):
+
+ mvn dependency:build-classpath -Dmdep.outputFile=classpath
+
+ java -cp $(cat dist/classpath) org.scribble.cli.CommandLine [args] MyModule.scr
+
+
+## Issue reporting
+
+Bugs and issues can be reported via the github Issues facility.
+
+Or email r.z.h.hu1234 [at] herts.ac.uk excluding the 1234.
+
+
+ [ci-img]: https://travis-ci.org/scribble/scribble-java.svg?branch=master
+ [ci]: https://travis-ci.org/scribble/scribble-java
+ [cov-img]: https://coveralls.io/repos/github/scribble/scribble-java/badge.svg?branch=master
+ [cov]: https://coveralls.io/github/scribble/scribble-java?branch=master
+ [maven-img]: https://img.shields.io/maven-central/v/org.scribble/scribble-core.svg?maxAge=2592000
+ [maven]: http://search.maven.org/#search%7Cga%7C1%7Cscribble-core
+
diff --git a/RELEASE.md b/RELEASE.md
new file mode 100644
index 000000000..b8775e2e2
--- /dev/null
+++ b/RELEASE.md
@@ -0,0 +1,18 @@
+# Scribble Release Process
+
+This repo uses semantic versions. Please keep this in mind when choosing version numbers.
+
+1. **Alert others you are releasing**
+
+ There should be no commits made to master while the release is in progress (about 10 minutes). Before you start
+ a release, alert others so that they don't accidentally merge
+ anything. If they do, and the build fails because of that, you'll have to recreate the release tag described below.
+
+1. **Push a git tag**
+
+ The tag should be of the format `release-N.M.L`, ex `git tag release-3.7.1; git push origin release-3.7.1`.
+
+1. **Wait for Travis CI**
+
+ This part is controlled by [`travis/publish.sh`](travis/publish.sh). It creates a bunch of new commits, bumps
+ the version, publishes artifacts, and syncs to Maven Central.
\ No newline at end of file
diff --git a/dist/pom.xml b/dist/pom.xml
deleted file mode 100644
index 3fb115775..000000000
--- a/dist/pom.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
-
- 4.0.0
-
-
- org.scribble
- parent
- 0.4-SNAPSHOT
-
-
- scribble-dist
- pom
- Scribble::Distribution
- Scribble distribution.
-
-
-
- org.scribble
- scribble-core
-
-
- org.scribble
- scribble-parser
-
-
- org.scribble
- scribble-cli
-
-
-
-
-
-
- maven-assembly-plugin
-
-
- src/main/scripts/distro-assembly.xml
-
- false
-
-
-
- distro-assembly
- package
-
- single
-
-
-
-
-
-
-
diff --git a/dist/src/main/resources/scribblec.sh b/dist/src/main/resources/scribblec.sh
deleted file mode 100644
index 78a33abcc..000000000
--- a/dist/src/main/resources/scribblec.sh
+++ /dev/null
@@ -1,182 +0,0 @@
-#!/bin/sh
-
-# Directory containing Scribble jars
-LIB=lib
-
-# antlr 3.2 location (if no lib jar)
-ANTLR=
- # e.g. '/cygdrive/c/Users/[User]/.m2/repository/org/antlr/antlr-runtime/3.2/antlr-runtime-3.2.jar'
-
-PRG=`basename "$0"`
-DIR=`dirname "$0"` # Non Cygwin..
-#DIR=`dirname "$0"`/.. # Cygwin
-#BASEDIR=$(dirname $0)
-
-usage() {
- echo Usage: 'scribblec.sh [option]... [option]...'
- cat < Source Scribble module (.scr file)
-
-Options:
- -h, --help Show this info and exit$
- -V Scribble debug info$
- --verbose Echo the java command$
-
- -ip Scribble module import path$
-
- -oldwf Use the simpler syntactic protocol well-formedness
-
-
- -project Project protocol
-
- -fsm Generate default Endpoint FSM
- -aut Output as aut (instead of dot)
- -fsmpng
- Draw default Endpoint FSM as png (via dot)
- -vfsm, -ufsm
- -vfsmpng, -ufsmpng
- Output the EFSM used in validation (or the "unfair" variant)
- -minlts
- Minimise EFSMs for dot output and API generation (but not validation)
- (Requires ltsconvert)
-
-
- -model Generate global model
- -modelpng
- Draw global model as png (requires dot)
- -fair Assume fair output choices
- -umodel, -umodelpng (with appropriate args) "Unfair" variant
-
-
- -api Generate Java Endpoint API
- -d API output directory
- -sessapi Generate Session API only
- -chanapi Generate State Channel API only
- -subtypes Enable subtypes for -chanapi
-EOF
-}
-
-fixpath() {
- windows=0
-
- if [ `uname | grep -c CYGWIN` -ne 0 ]; then
- windows=1
- fi
-
- cp="$1"
- if [ "$windows" = 1 ]; then
- cygpath -pw "$cp"
- else
- echo "$cp"
- fi
-}
-
-ARGS=
-
-CLASSPATH=$DIR'/modules/cli/target/classes/'
-CLASSPATH=$CLASSPATH':'$DIR'/modules/core/target/classes'
-CLASSPATH=$CLASSPATH':'$DIR'/modules/parser/target/classes'
-CLASSPATH=$CLASSPATH':'$DIR'/modules/f17/target/classes'
-CLASSPATH=$CLASSPATH':'$ANTLR
-CLASSPATH=$CLASSPATH':'$DIR'/'$LIB'/antlr.jar'
-CLASSPATH=$CLASSPATH':'$DIR'/'$LIB'/antlr-runtime.jar'
-CLASSPATH=$CLASSPATH':'$DIR'/'$LIB'/commons-io.jar'
-CLASSPATH=$CLASSPATH':'$DIR'/'$LIB'/scribble-cli.jar'
-CLASSPATH=$CLASSPATH':'$DIR'/'$LIB'/scribble-core.jar'
-CLASSPATH=$CLASSPATH':'$DIR'/'$LIB'/scribble-parser.jar'
-CLASSPATH=$CLASSPATH':'$DIR'/'$LIB'/scribble-f17.jar'
-CLASSPATH=$CLASSPATH':'$DIR'/'$LIB'/stringtemplate.jar'
-CLASSPATH="'"`fixpath "$CLASSPATH"`"'"
-
-usage=0
-verbose=0
-dot=0
-nondot=0
-
-while true; do
- case "$1" in
- "")
- break
- ;;
- #-dot)
- # # Should not be used in conjunction with other flags..
- # # ..that output to stdout
- # ARGS="$ARGS '-fsm'"
- # shift
- # ARGS="$ARGS '$1'"
- # shift
- # ARGS="$ARGS '$1'"
- # shift
- # dot=$1
- # if [ "$dot" == '' ]; then
- # echo '-dot missing output file name argument'
- # exit 1
- # fi
- # shift
- # ;;
- -h)
- usage=1
- break
- ;;
- --help)
- usage=1
- break
- ;;
- --verbose)
- verbose=1
- shift
- ;;
- #-ip)
- # ARGS="$ARGS '$1'"
- # shift
- # ;;
- #-d)
- # ARGS="$ARGS '$1'"
- # shift
- # ;;
- #-subtypes)
- # ARGS="$ARGS '$1'"
- # shift
- # ;;
- #-*)
- # nondot=1
- # ARGS="$ARGS '$1'"
- # shift
- # ;;
- *)
- ARGS="$ARGS '$1'"
- shift
- ;;
- esac
-done
-
-#if [ "$dot" != 0 ]; then
-# if [ $nondot == 1 ]; then
-# echo '-dot cannot be used in conjunction with other flags that output to stdout: ' $ARGS
-# exit 1
-# fi
-# ARGS="$ARGS |"
-# ARGS="$ARGS dot"
-# ARGS="$ARGS '-Tpng'"
-# ARGS="$ARGS '-o'"
-# ARGS="$ARGS '$dot'"
-#fi
-
-if [ "$usage" = 1 ]; then
- usage
- exit 0
-fi
-
-CMD='java -cp '$CLASSPATH' org.scribble.cli.CommandLine'
-
-scribblec() {
- eval $CMD "$@"
-}
-
-if [ "$verbose" = 1 ]; then
- echo $CMD "$ARGS"
-fi
-
-scribblec "$ARGS"
-
diff --git a/header.txt b/header.txt
new file mode 100644
index 000000000..794754c8a
--- /dev/null
+++ b/header.txt
@@ -0,0 +1,11 @@
+Copyright ${project.inceptionYear} The Scribble Authors
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+in compliance with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed under the License
+is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+or implied. See the License for the specific language governing permissions and limitations under
+the License.
diff --git a/modules/cli/build.properties b/modules/cli/build.properties
deleted file mode 100644
index b844f8dbe..000000000
--- a/modules/cli/build.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-source.. = src/main/java/,\
- target/generated-sources/antlr3/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- src/main/resources/lib/antlr-3.2.jar,\
- OSGI-INF/,\
- LICENSE.txt
-src.includes = target/generated-sources/,\
- src/,\
- pom.xml,\
- build.properties,\
- META-INF/,\
- .project,\
- .classpath,\
- OSGI-INF/,\
- LICENSE.txt
-jars.compile.order = .,\
- lib/antlr-3.2.jar
diff --git a/modules/cli/pom.xml b/modules/cli/pom.xml
deleted file mode 100644
index 3c19966d0..000000000
--- a/modules/cli/pom.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
- 4.0.0
- scribble-cli
- jar
- Scribble::Modules::CLI
-
-
- org.scribble
- parent
- 0.4-SNAPSHOT
- ../../pom.xml
-
-
-
-
- org.scribble
- scribble-core
-
-
- org.scribble
- scribble-parser
-
-
-
- commons-io
- commons-io
-
-
-
- junit
- junit
- test
-
-
-
-
diff --git a/modules/cli/src/main/java/org/scribble/cli/CommandLine.java b/modules/cli/src/main/java/org/scribble/cli/CommandLine.java
deleted file mode 100644
index 588668cf8..000000000
--- a/modules/cli/src/main/java/org/scribble/cli/CommandLine.java
+++ /dev/null
@@ -1,495 +0,0 @@
-package org.scribble.cli;
-
-import java.io.File;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Consumer;
-import java.util.stream.Collectors;
-
-import org.scribble.ast.Module;
-import org.scribble.ast.ProtocolDecl;
-import org.scribble.ast.global.GProtocolDecl;
-import org.scribble.main.Job;
-import org.scribble.main.JobContext;
-import org.scribble.main.MainContext;
-import org.scribble.main.RuntimeScribbleException;
-import org.scribble.main.ScribbleException;
-import org.scribble.main.resource.DirectoryResourceLocator;
-import org.scribble.main.resource.ResourceLocator;
-import org.scribble.model.endpoint.EGraph;
-import org.scribble.model.global.SGraph;
-import org.scribble.sesstype.name.GProtocolName;
-import org.scribble.sesstype.name.LProtocolName;
-import org.scribble.sesstype.name.Role;
-import org.scribble.util.ScribParserException;
-import org.scribble.util.ScribUtil;
-
-public class CommandLine
-{
- protected enum ArgFlag
- {
- // Unique flags
- JUNIT, // For internal use (JUnit test harness)
- MAIN_MOD,
- IMPORT_PATH,
- VERBOSE,
- SCHAN_API_SUBTYPES,
- OLD_WF,
- NO_LIVENESS,
- LTSCONVERT_MIN, // Currently only affects EFSM output (i.e. -fsm..) and API gen -- doesn't affect validation
- FAIR,
- NO_LOCAL_CHOICE_SUBJECT_CHECK,
- NO_ACCEPT_CORRELATION_CHECK,
- DOT,
- AUT,
- NO_VALIDATION,
- INLINE_MAIN_MOD,
- F17,
-
- // Non-unique flags
- PROJECT,
- API_OUTPUT,
- EFSM,
- VALIDATION_EFSM,
- UNFAIR_EFSM,
- UNFAIR_EFSM_PNG,
- EFSM_PNG,
- VALIDATION_EFSM_PNG,
- SGRAPH,
- UNFAIR_SGRAPH,
- SGRAPH_PNG,
- UNFAIR_SGRAPH_PNG,
- API_GEN,
- SESS_API_GEN,
- SCHAN_API_GEN,
- }
-
- private final Map args; // Maps each flag to list of associated argument values
-
- public CommandLine(String... args) throws CommandLineException
- {
- this.args = new CommandLineArgParser(args).getArgs();
- if (!this.args.containsKey(ArgFlag.MAIN_MOD) && !this.args.containsKey(ArgFlag.INLINE_MAIN_MOD))
- {
- throw new CommandLineException("No main module has been specified\r\n");
- }
- }
-
- public static void main(String[] args) throws CommandLineException, ScribbleException
- {
- try
- {
- new CommandLine(args).run();
- }
- catch (ScribParserException | CommandLineException e)
- {
- System.err.println(e.getMessage()); // No need to give full stack trace, even for debug, for command line errors
- System.exit(1);
- }
- catch (RuntimeScribbleException e)
- {
- System.err.println(e.getMessage());
- System.exit(1);
- }
- }
-
- public void run() throws ScribbleException, CommandLineException, ScribParserException
- {
- try
- {
- Job job = newJob(newMainContext());
- ScribbleException fail = null;
- try
- {
- /*// Scribble extensions (custom Job passes)
- if (this.args.containsKey(ArgFlag.F17))
- {
- GProtocolName simpname = new GProtocolName(this.args.get(ArgFlag.F17)[0]);
- F17Main.parseAndCheckWF(job, simpname); // Includes base passes
- }
-
- // Base Scribble
- else*/
- {
- job.checkWellFormedness();
- }
- }
- catch (ScribbleException x)
- {
- fail = x;
- }
- try
- {
- // Following must be ordered appropriately -- ?
- if (this.args.containsKey(ArgFlag.PROJECT))
- {
- outputProjections(job);
- }
- if (this.args.containsKey(ArgFlag.EFSM))
- {
- outputEGraph(job, true, true);
- }
- if (this.args.containsKey(ArgFlag.VALIDATION_EFSM))
- {
- outputEGraph(job, false, true);
- }
- if (this.args.containsKey(ArgFlag.UNFAIR_EFSM))
- {
- outputEGraph(job, false, false);
- }
- if (this.args.containsKey(ArgFlag.EFSM_PNG))
- {
- drawEGraph(job, true, true);
- }
- if (this.args.containsKey(ArgFlag.VALIDATION_EFSM_PNG))
- {
- drawEGraph(job, false, true);
- }
- if (this.args.containsKey(ArgFlag.UNFAIR_EFSM_PNG))
- {
- drawEGraph(job, false, false);
- }
- if (this.args.containsKey(ArgFlag.SGRAPH) || this.args.containsKey(ArgFlag.SGRAPH_PNG)
- || this.args.containsKey(ArgFlag.UNFAIR_SGRAPH) || this.args.containsKey(ArgFlag.UNFAIR_SGRAPH_PNG))
- {
- if (job.useOldWf)
- {
- throw new CommandLineException("Global model flag(s) incompatible with: " + CommandLineArgParser.OLD_WF_FLAG);
- }
- if (this.args.containsKey(ArgFlag.SGRAPH))
- {
- outputSGraph(job, true);
- }
- if (this.args.containsKey(ArgFlag.UNFAIR_SGRAPH))
- {
- outputSGraph(job, false);
- }
- if (this.args.containsKey(ArgFlag.SGRAPH_PNG))
- {
- drawSGraph(job, true);
- }
- if (this.args.containsKey(ArgFlag.UNFAIR_SGRAPH_PNG))
- {
- drawSGraph(job, false);
- }
- }
- }
- catch (ScribbleException x)
- {
- if (fail == null)
- {
- fail = x;
- }
- }
- if (fail != null)
- {
- throw fail;
- }
-
- if (this.args.containsKey(ArgFlag.SESS_API_GEN))
- {
- outputSessionApi(job);
- }
- if (this.args.containsKey(ArgFlag.SCHAN_API_GEN))
- {
- outputStateChannelApi(job);
- }
- if (this.args.containsKey(ArgFlag.API_GEN))
- {
- outputEndpointApi(job);
- }
- }
- catch (ScribbleException e) // Wouldn't need to do this if not Runnable (so maybe change)
- {
- if (this.args.containsKey(ArgFlag.JUNIT) || this.args.containsKey(ArgFlag.VERBOSE))
- {
- /*RuntimeScribbleException ee = new RuntimeScribbleException(e.getMessage());
- ee.setStackTrace(e.getStackTrace());
- throw ee;*/
- throw e;
- }
- else
- {
- System.err.println(e.getMessage()); // JUnit harness looks for an exception
- System.exit(1);
- }
- }
- }
-
- // FIXME: option to write to file, like classes
- private void outputProjections(Job job) throws CommandLineException, ScribbleException
- {
- JobContext jcontext = job.getContext();
- String[] args = this.args.get(ArgFlag.PROJECT);
- for (int i = 0; i < args.length; i += 2)
- {
- GProtocolName fullname = checkGlobalProtocolArg(jcontext, args[i]);
- Role role = checkRoleArg(jcontext, fullname, args[i+1]);
- Map projections = job.getProjections(fullname, role);
- System.out.println("\n" + projections.values().stream().map((p) -> p.toString()).collect(Collectors.joining("\n\n")));
- }
- }
-
- // dot/aut text output
- // forUser: true means for API gen and general user info (may be minimised), false means for validation (non-minimised, fair or unfair)
- // (forUser && !fair) should not hold, i.e. unfair doesn't make sense if forUser
- private void outputEGraph(Job job, boolean forUser, boolean fair) throws ScribbleException, CommandLineException
- {
- JobContext jcontext = job.getContext();
- String[] args = forUser ? this.args.get(ArgFlag.EFSM) : (fair ? this.args.get(ArgFlag.VALIDATION_EFSM) : this.args.get(ArgFlag.UNFAIR_EFSM));
- for (int i = 0; i < args.length; i += 2)
- {
- GProtocolName fullname = checkGlobalProtocolArg(jcontext, args[i]);
- Role role = checkRoleArg(jcontext, fullname, args[i+1]);
- EGraph fsm = getEGraph(job, fullname, role, forUser, fair);
- String out = this.args.containsKey(ArgFlag.AUT) ? fsm.toAut() : fsm.toDot();
- System.out.println("\n" + out); // Endpoint graphs are "inlined" (a single graph is built)
- }
- }
-
- private void drawEGraph(Job job, boolean forUser, boolean fair) throws ScribbleException, CommandLineException
- {
- JobContext jcontext = job.getContext();
- String[] args = forUser ? this.args.get(ArgFlag.EFSM_PNG) : (fair ? this.args.get(ArgFlag.VALIDATION_EFSM_PNG) : this.args.get(ArgFlag.UNFAIR_EFSM_PNG));
- for (int i = 0; i < args.length; i += 3)
- {
- GProtocolName fullname = checkGlobalProtocolArg(jcontext, args[i]);
- Role role = checkRoleArg(jcontext, fullname, args[i+1]);
- String png = args[i+2];
- EGraph fsm = getEGraph(job, fullname, role, forUser, fair);
- runDot(fsm.toDot(), png);
- }
- }
-
- // Endpoint graphs are "inlined", so only a single graph is built (cf. projection output)
- private EGraph getEGraph(Job job, GProtocolName fullname, Role role, boolean forUser, boolean fair)
- throws ScribbleException, CommandLineException
- {
- JobContext jcontext = job.getContext();
- GProtocolDecl gpd = (GProtocolDecl) jcontext.getMainModule().getProtocolDecl(fullname.getSimpleName());
- if (gpd == null || !gpd.header.roledecls.getRoles().contains(role))
- {
- throw new CommandLineException("Bad FSM construction args: " + Arrays.toString(this.args.get(ArgFlag.DOT)));
- }
- EGraph graph;
- if (forUser) // The (possibly minimised) user-output EFSM for API gen
- {
- graph = this.args.containsKey(ArgFlag.LTSCONVERT_MIN)
- ? jcontext.getMinimisedEGraph(fullname, role) : jcontext.getEGraph(fullname, role);
- }
- else // The (possibly unfair-transformed) internal EFSM for validation
- {
- graph = //(!this.args.containsKey(ArgFlag.FAIR) && !this.args.containsKey(ArgFlag.NO_LIVENESS)) // Cf. GlobalModelChecker.getEndpointFSMs
- !fair
- ? jcontext.getUnfairEGraph(fullname, role) : jcontext.getEGraph(fullname, role);
- }
- if (graph == null)
- {
- throw new RuntimeScribbleException("Shouldn't see this: " + fullname); // Should be suppressed by an earlier failure
- }
- return graph;
- }
-
- private void outputSGraph(Job job, boolean fair) throws ScribbleException, CommandLineException
- {
- JobContext jcontext = job.getContext();
- String[] args = fair ? this.args.get(ArgFlag.SGRAPH) : this.args.get(ArgFlag.UNFAIR_SGRAPH);
- for (int i = 0; i < args.length; i += 1)
- {
- GProtocolName fullname = checkGlobalProtocolArg(jcontext, args[i]);
- SGraph model = getSGraph(job, fullname, fair);
- String out = this.args.containsKey(ArgFlag.AUT) ? model.toAut() : model.toDot();
- System.out.println("\n" + out);
- }
- }
-
- private void drawSGraph(Job job, boolean fair) throws ScribbleException, CommandLineException
- {
- JobContext jcontext = job.getContext();
- String[] args = fair ? this.args.get(ArgFlag.SGRAPH_PNG) : this.args.get(ArgFlag.UNFAIR_SGRAPH_PNG);
- for (int i = 0; i < args.length; i += 2)
- {
- GProtocolName fullname = checkGlobalProtocolArg(jcontext, args[i]);
- String png = args[i+1];
- SGraph model = getSGraph(job, fullname, fair);
- runDot(model.toDot(), png);
- }
- }
-
- private static SGraph getSGraph(Job job, GProtocolName fullname, boolean fair) throws ScribbleException
- {
- JobContext jcontext = job.getContext();
- SGraph model = fair ? jcontext.getSGraph(fullname) : jcontext.getUnfairSGraph(fullname);
- if (model == null)
- {
- throw new RuntimeScribbleException("Shouldn't see this: " + fullname); // Should be suppressed by an earlier failure
- }
- return model;
- }
-
- private void outputEndpointApi(Job job) throws ScribbleException, CommandLineException
- {
- JobContext jcontext = job.getContext();
- String[] args = this.args.get(ArgFlag.API_GEN);
- for (int i = 0; i < args.length; i += 2)
- {
- GProtocolName fullname = checkGlobalProtocolArg(jcontext, args[i]);
- Map sessClasses = job.generateSessionApi(fullname);
- outputClasses(sessClasses);
- Role role = checkRoleArg(jcontext, fullname, args[i+1]);
- Map scClasses = job.generateStateChannelApi(fullname, role, this.args.containsKey(ArgFlag.SCHAN_API_SUBTYPES));
- outputClasses(scClasses);
- }
- }
-
- private void outputSessionApi(Job job) throws ScribbleException, CommandLineException
- {
- JobContext jcontext = job.getContext();
- String[] args = this.args.get(ArgFlag.SESS_API_GEN);
- for (String fullname : args)
- {
- GProtocolName gpn = checkGlobalProtocolArg(jcontext, fullname);
- Map classes = job.generateSessionApi(gpn);
- outputClasses(classes);
- }
- }
-
- private void outputStateChannelApi(Job job) throws ScribbleException, CommandLineException
- {
- JobContext jcontext = job.getContext();
- String[] args = this.args.get(ArgFlag.SCHAN_API_GEN);
- for (int i = 0; i < args.length; i += 2)
- {
- GProtocolName fullname = checkGlobalProtocolArg(jcontext, args[i]);
- Role role = checkRoleArg(jcontext, fullname, args[i+1]);
- Map classes = job.generateStateChannelApi(fullname, role, this.args.containsKey(ArgFlag.SCHAN_API_SUBTYPES));
- outputClasses(classes);
- }
- }
-
- // filepath -> class source
- private void outputClasses(Map classes) throws ScribbleException
- {
- Consumer f;
- if (this.args.containsKey(ArgFlag.API_OUTPUT))
- {
- String dir = this.args.get(ArgFlag.API_OUTPUT)[0];
- f = (path) -> { ScribUtil.handleLambdaScribbleException(() ->
- {
- String tmp = dir + "/" + path;
- if (this.args.containsKey(ArgFlag.VERBOSE))
- {
- System.out.println("\n[DEBUG] Writing to: " + tmp);
- }
- ScribUtil.writeToFile(tmp, classes.get(path)); return null;
- }); };
- }
- else
- {
- f = (path) -> { System.out.println(path + ":\n" + classes.get(path)); };
- }
- classes.keySet().stream().forEach(f);
- }
-
- private static void runDot(String dot, String png) throws ScribbleException, CommandLineException
- {
- String tmpName = png + ".tmp";
- File tmp = new File(tmpName);
- if (tmp.exists())
- {
- throw new CommandLineException("Cannot overwrite: " + tmpName);
- }
- try
- {
- ScribUtil.writeToFile(tmpName, dot);
- String[] res = ScribUtil.runProcess("dot", "-Tpng", "-o" + png, tmpName);
- System.out.print(!res[1].isEmpty() ? res[1] : res[0]); // already "\n" terminated
- }
- finally
- {
- tmp.delete();
- }
- }
-
- private Job newJob(MainContext mc)
- {
- //Job job = new Job(cjob); // Doesn't work due to (recursive) maven dependencies
- return mc.newJob();
- }
-
- private MainContext newMainContext() throws ScribParserException, ScribbleException
- {
- //boolean jUnit = this.args.containsKey(ArgFlag.JUNIT);
- boolean debug = this.args.containsKey(ArgFlag.VERBOSE);
- boolean useOldWF = this.args.containsKey(ArgFlag.OLD_WF);
- boolean noLiveness = this.args.containsKey(ArgFlag.NO_LIVENESS);
- boolean minEfsm = this.args.containsKey(ArgFlag.LTSCONVERT_MIN);
- boolean fair = this.args.containsKey(ArgFlag.FAIR);
- boolean noLocalChoiceSubjectCheck = this.args.containsKey(ArgFlag.NO_LOCAL_CHOICE_SUBJECT_CHECK);
- boolean noAcceptCorrelationCheck = this.args.containsKey(ArgFlag.NO_ACCEPT_CORRELATION_CHECK);
- boolean noValidation = this.args.containsKey(ArgFlag.NO_VALIDATION);
- boolean f17 = this.args.containsKey(ArgFlag.F17);
-
- List impaths = this.args.containsKey(ArgFlag.IMPORT_PATH)
- ? CommandLine.parseImportPaths(this.args.get(ArgFlag.IMPORT_PATH)[0])
- : Collections.emptyList();
- ResourceLocator locator = new DirectoryResourceLocator(impaths);
- if (this.args.containsKey(ArgFlag.INLINE_MAIN_MOD))
- {
- return new MainContext(debug, locator, this.args.get(ArgFlag.INLINE_MAIN_MOD)[0], useOldWF, noLiveness, minEfsm, fair,
- noLocalChoiceSubjectCheck, noAcceptCorrelationCheck, noValidation, f17);
- }
- else
- {
- Path mainpath = CommandLine.parseMainPath(this.args.get(ArgFlag.MAIN_MOD)[0]);
- //return new MainContext(jUnit, debug, locator, mainpath, useOldWF, noLiveness);
- return new MainContext(debug, locator, mainpath, useOldWF, noLiveness, minEfsm, fair,
- noLocalChoiceSubjectCheck, noAcceptCorrelationCheck, noValidation, f17);
- }
- }
-
- private static Path parseMainPath(String path)
- {
- return Paths.get(path);
- }
-
- private static List parseImportPaths(String paths)
- {
- return Arrays.stream(paths.split(File.pathSeparator)).map((s) -> Paths.get(s)).collect(Collectors.toList());
- }
-
- private static GProtocolName checkGlobalProtocolArg(JobContext jcontext, String simpname) throws CommandLineException
- {
- GProtocolName simpgpn = new GProtocolName(simpname);
- Module main = jcontext.getMainModule();
- if (!main.hasProtocolDecl(simpgpn))
- {
- throw new CommandLineException("Global protocol not found: " + simpname);
- }
- ProtocolDecl> pd = main.getProtocolDecl(simpgpn);
- if (pd == null || !pd.isGlobal())
- {
- throw new CommandLineException("Global protocol not found: " + simpname);
- }
- if (pd.isAuxModifier()) // CHECKME: maybe don't check for all, e.g. -project
- {
- throw new CommandLineException("Invalid aux protocol specified as root: " + simpname);
- }
- return new GProtocolName(jcontext.main, simpgpn);
- }
-
- private static Role checkRoleArg(JobContext jcontext, GProtocolName fullname, String rolename) throws CommandLineException
- {
- ProtocolDecl> pd = jcontext.getMainModule().getProtocolDecl(fullname.getSimpleName());
- Role role = new Role(rolename);
- if (!pd.header.roledecls.getRoles().contains(role))
- {
- throw new CommandLineException("Role not declared for " + fullname + ": " + role);
- }
- return role;
- }
-}
diff --git a/modules/cli/src/main/java/org/scribble/cli/CommandLineArgParser.java b/modules/cli/src/main/java/org/scribble/cli/CommandLineArgParser.java
deleted file mode 100644
index 4e85ac082..000000000
--- a/modules/cli/src/main/java/org/scribble/cli/CommandLineArgParser.java
+++ /dev/null
@@ -1,407 +0,0 @@
-package org.scribble.cli;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.scribble.cli.CommandLine.ArgFlag;
-
-// String[] -> Map -- Map array values are the arguments associated to each CommandLine.Arg
-public class CommandLineArgParser
-{
- // Unique flags
- public static final String JUNIT_FLAG = "-junit"; // For internal use (JUnit test harness)
- public static final String VERBOSE_FLAG = "-V";
- public static final String IMPORT_PATH_FLAG = "-ip";
- public static final String API_OUTPUT_DIR_FLAG = "-d";
- public static final String STATECHAN_SUBTYPES_FLAG = "-subtypes";
- public static final String OLD_WF_FLAG = "-oldwf";
- public static final String NO_LIVENESS_FLAG = "-nolive";
- public static final String LTSCONVERT_MIN_FLAG = "-minlts";
- public static final String FAIR_FLAG = "-fair";
- public static final String NO_LOCAL_CHOICE_SUBJECT_CHECK = "-nolocalchoicecheck";
- public static final String NO_ACCEPT_CORRELATION_CHECK = "-nocorrelation";
- public static final String DOT_FLAG = "-dot";
- public static final String AUT_FLAG = "-aut";
- public static final String NO_VALIDATION_FLAG = "-novalid";
- public static final String INLINE_MAIN_MOD_FLAG = "-inline";
- public static final String F17_FLAG = "-f17";
-
- // Non-unique flags
- public static final String PROJECT_FLAG = "-project";
- public static final String EFSM_FLAG = "-fsm";
- public static final String VALIDATION_EFSM_FLAG = "-vfsm";
- public static final String UNFAIR_EFSM_FLAG = "-ufsm";
- public static final String EFSM_PNG_FLAG = "-fsmpng";
- public static final String VALIDATION_EFSM_PNG_FLAG = "-vfsmpng";
- public static final String UNFAIR_EFSM_PNG_FLAG = "-ufsmpng";
- public static final String SGRAPH_FLAG = "-model";
- public static final String UNFAIR_SGRAPH_FLAG = "-umodel";
- public static final String SGRAPH_PNG_FLAG = "-modelpng";
- public static final String UNFAIR_SGRAPH_PNG_FLAG = "-umodelpng";
- public static final String API_GEN_FLAG = "-api";
- public static final String SESSION_API_GEN_FLAG = "-sessapi";
- public static final String STATECHAN_API_GEN_FLAG = "-chanapi";
-
- private static final Map UNIQUE_FLAGS = new HashMap<>();
- {
- CommandLineArgParser.UNIQUE_FLAGS.put(CommandLineArgParser.JUNIT_FLAG, CommandLine.ArgFlag.JUNIT);
- CommandLineArgParser.UNIQUE_FLAGS.put(CommandLineArgParser.VERBOSE_FLAG, CommandLine.ArgFlag.VERBOSE);
- CommandLineArgParser.UNIQUE_FLAGS.put(CommandLineArgParser.IMPORT_PATH_FLAG, CommandLine.ArgFlag.IMPORT_PATH);
- CommandLineArgParser.UNIQUE_FLAGS.put(CommandLineArgParser.API_OUTPUT_DIR_FLAG, CommandLine.ArgFlag.API_OUTPUT);
- CommandLineArgParser.UNIQUE_FLAGS.put(CommandLineArgParser.STATECHAN_SUBTYPES_FLAG, CommandLine.ArgFlag.SCHAN_API_SUBTYPES);
- CommandLineArgParser.UNIQUE_FLAGS.put(CommandLineArgParser.OLD_WF_FLAG, CommandLine.ArgFlag.OLD_WF);
- CommandLineArgParser.UNIQUE_FLAGS.put(CommandLineArgParser.LTSCONVERT_MIN_FLAG, CommandLine.ArgFlag.LTSCONVERT_MIN);
- CommandLineArgParser.UNIQUE_FLAGS.put(CommandLineArgParser.FAIR_FLAG, CommandLine.ArgFlag.FAIR);
- CommandLineArgParser.UNIQUE_FLAGS.put(CommandLineArgParser.NO_LOCAL_CHOICE_SUBJECT_CHECK, CommandLine.ArgFlag.NO_LOCAL_CHOICE_SUBJECT_CHECK);
- CommandLineArgParser.UNIQUE_FLAGS.put(CommandLineArgParser.NO_ACCEPT_CORRELATION_CHECK, CommandLine.ArgFlag.NO_ACCEPT_CORRELATION_CHECK);
- CommandLineArgParser.UNIQUE_FLAGS.put(CommandLineArgParser.DOT_FLAG, CommandLine.ArgFlag.DOT);
- CommandLineArgParser.UNIQUE_FLAGS.put(CommandLineArgParser.AUT_FLAG, CommandLine.ArgFlag.AUT);
- CommandLineArgParser.UNIQUE_FLAGS.put(CommandLineArgParser.NO_VALIDATION_FLAG, CommandLine.ArgFlag.NO_VALIDATION);
- CommandLineArgParser.UNIQUE_FLAGS.put(CommandLineArgParser.INLINE_MAIN_MOD_FLAG, CommandLine.ArgFlag.INLINE_MAIN_MOD);
- CommandLineArgParser.UNIQUE_FLAGS.put(CommandLineArgParser.F17_FLAG, CommandLine.ArgFlag.F17);
- }
-
- private static final Map NON_UNIQUE_FLAGS = new HashMap<>();
- {
- CommandLineArgParser.NON_UNIQUE_FLAGS.put(CommandLineArgParser.PROJECT_FLAG, CommandLine.ArgFlag.PROJECT);
- CommandLineArgParser.NON_UNIQUE_FLAGS.put(CommandLineArgParser.EFSM_FLAG, CommandLine.ArgFlag.EFSM);
- CommandLineArgParser.NON_UNIQUE_FLAGS.put(CommandLineArgParser.VALIDATION_EFSM_FLAG, CommandLine.ArgFlag.VALIDATION_EFSM);
- CommandLineArgParser.NON_UNIQUE_FLAGS.put(CommandLineArgParser.UNFAIR_EFSM_FLAG, CommandLine.ArgFlag.UNFAIR_EFSM);
- CommandLineArgParser.NON_UNIQUE_FLAGS.put(CommandLineArgParser.EFSM_PNG_FLAG, CommandLine.ArgFlag.EFSM_PNG);
- CommandLineArgParser.NON_UNIQUE_FLAGS.put(CommandLineArgParser.VALIDATION_EFSM_PNG_FLAG, CommandLine.ArgFlag.VALIDATION_EFSM_PNG);
- CommandLineArgParser.NON_UNIQUE_FLAGS.put(CommandLineArgParser.UNFAIR_EFSM_PNG_FLAG, CommandLine.ArgFlag.UNFAIR_EFSM_PNG);
- CommandLineArgParser.NON_UNIQUE_FLAGS.put(CommandLineArgParser.SGRAPH_FLAG, CommandLine.ArgFlag.SGRAPH);
- CommandLineArgParser.NON_UNIQUE_FLAGS.put(CommandLineArgParser.UNFAIR_SGRAPH_FLAG, CommandLine.ArgFlag.UNFAIR_SGRAPH);
- CommandLineArgParser.NON_UNIQUE_FLAGS.put(CommandLineArgParser.SGRAPH_PNG_FLAG, CommandLine.ArgFlag.SGRAPH_PNG);
- CommandLineArgParser.NON_UNIQUE_FLAGS.put(CommandLineArgParser.UNFAIR_SGRAPH_PNG_FLAG, CommandLine.ArgFlag.UNFAIR_SGRAPH_PNG);
- CommandLineArgParser.NON_UNIQUE_FLAGS.put(CommandLineArgParser.API_GEN_FLAG, CommandLine.ArgFlag.API_GEN);
- CommandLineArgParser.NON_UNIQUE_FLAGS.put(CommandLineArgParser.SESSION_API_GEN_FLAG, CommandLine.ArgFlag.SESS_API_GEN);
- CommandLineArgParser.NON_UNIQUE_FLAGS.put(CommandLineArgParser.STATECHAN_API_GEN_FLAG, CommandLine.ArgFlag.SCHAN_API_GEN);
- }
-
- private static final Map FLAGS = new HashMap<>();
- {
- CommandLineArgParser.FLAGS.putAll(CommandLineArgParser.UNIQUE_FLAGS);
- CommandLineArgParser.FLAGS.putAll(CommandLineArgParser.NON_UNIQUE_FLAGS);
- }
-
- private final String[] args;
- private final Map parsed = new HashMap<>();
-
- public CommandLineArgParser(String[] args) throws CommandLineException
- {
- this.args = args;
- parseArgs();
- }
-
- public Map getArgs()
- {
- return this.parsed;
- }
-
- private void parseArgs() throws CommandLineException
- {
- for (int i = 0; i < this.args.length; i++)
- {
- String arg = this.args[i];
- if (CommandLineArgParser.FLAGS.containsKey(arg))
- {
- i = this.parseFlag(i);
- }
- else
- {
- if (isMainModuleParsed())
- {
- if (arg.startsWith("-"))
- {
- throw new CommandLineException("Unknown flag or bad main module arg: " + arg);
- }
- // May actually be the second bad argument -- we didn't validate the value of the main arg
- throw new CommandLineException("Bad/multiple main module arg: " + arg);
- }
- parseMain(i);
- }
- }
- }
-
- private boolean isMainModuleParsed()
- {
- return this.parsed.containsKey(CommandLine.ArgFlag.MAIN_MOD) || this.parsed.containsKey(CommandLine.ArgFlag.INLINE_MAIN_MOD);
- }
-
- // Pre: i is the index of the current flag to parse
- // Post: i is the index of the last argument parsed -- parseArgs does the index increment to the next current flag
- // Currently allows repeat flag decls: next overrides previous
- private int parseFlag(int i) throws CommandLineException
- {
- String flag = this.args[i];
- switch (flag)
- {
- // Unique flags
- case CommandLineArgParser.IMPORT_PATH_FLAG:
- {
- return parseImportPath(i);
- }
- case CommandLineArgParser.INLINE_MAIN_MOD_FLAG:
- {
- if (isMainModuleParsed())
- {
- throw new CommandLineException("Multiple main modules given.");
- }
- return parseInlineMainModule(i);
- }
- case CommandLineArgParser.F17_FLAG:
- {
- return parseF17(i);
- }
- case CommandLineArgParser.JUNIT_FLAG:
- case CommandLineArgParser.VERBOSE_FLAG:
- case CommandLineArgParser.STATECHAN_SUBTYPES_FLAG:
- case CommandLineArgParser.OLD_WF_FLAG:
- case CommandLineArgParser.NO_LIVENESS_FLAG:
- case CommandLineArgParser.LTSCONVERT_MIN_FLAG:
- case CommandLineArgParser.FAIR_FLAG:
- case CommandLineArgParser.NO_LOCAL_CHOICE_SUBJECT_CHECK:
- case CommandLineArgParser.NO_ACCEPT_CORRELATION_CHECK:
- case CommandLineArgParser.NO_VALIDATION_FLAG:
- {
- checkAndAddNoArgUniqueFlag(flag, new String[0]);
- return i;
- }
- case CommandLineArgParser.API_OUTPUT_DIR_FLAG:
- {
- return parseOutput(i);
- }
- case CommandLineArgParser.DOT_FLAG:
- {
- if (this.parsed.containsKey(CommandLineArgParser.UNIQUE_FLAGS.get(AUT_FLAG)))
- {
- throw new CommandLineException("Incompatible flags: " + DOT_FLAG + " and " + AUT_FLAG);
- }
- checkAndAddNoArgUniqueFlag(flag, new String[0]);
- return i;
- }
- case CommandLineArgParser.AUT_FLAG:
- {
- if (this.parsed.containsKey(CommandLineArgParser.UNIQUE_FLAGS.get(DOT_FLAG)))
- {
- throw new CommandLineException("Incompatible flags: " + DOT_FLAG + " and " + AUT_FLAG);
- }
- checkAndAddNoArgUniqueFlag(flag, new String[0]);
- return i;
- }
-
- // Non-unique flags
- case CommandLineArgParser.PROJECT_FLAG:
- {
- return parseProject(i);
- }
- case CommandLineArgParser.EFSM_FLAG:
- case CommandLineArgParser.VALIDATION_EFSM_FLAG:
- case CommandLineArgParser.UNFAIR_EFSM_FLAG:
- case CommandLineArgParser.API_GEN_FLAG:
- case CommandLineArgParser.STATECHAN_API_GEN_FLAG:
- {
- return parseProtoAndRoleArgs(flag, i);
- }
- case CommandLineArgParser.EFSM_PNG_FLAG:
- case CommandLineArgParser.VALIDATION_EFSM_PNG_FLAG:
- case CommandLineArgParser.UNFAIR_EFSM_PNG_FLAG:
- {
- return parseProtoRoleAndFileArgs(flag, i);
- }
- case CommandLineArgParser.SGRAPH_FLAG:
- case CommandLineArgParser.UNFAIR_SGRAPH_FLAG:
- case CommandLineArgParser.SESSION_API_GEN_FLAG:
- {
- return parseProtoArg(flag, i);
- }
- case CommandLineArgParser.SGRAPH_PNG_FLAG:
- case CommandLineArgParser.UNFAIR_SGRAPH_PNG_FLAG:
- {
- return parseProtoAndFileArgs(flag, i);
- }
-
- default:
- {
- throw new RuntimeException("[TODO] Unknown flag: " + flag);
- }
- }
- }
-
- private void checkAndAddNoArgUniqueFlag(String flag, String[] args) throws CommandLineException
- {
- ArgFlag argFlag = CommandLineArgParser.UNIQUE_FLAGS.get(flag);
- if (this.parsed.containsKey(argFlag))
- {
- throw new CommandLineException("Duplicate flag: " + flag);
- }
- this.parsed.put(argFlag, args);
- }
-
- private int parseOutput(int i) throws CommandLineException
- {
- if ((i + 1) >= this.args.length)
- {
- throw new CommandLineException("Missing directory argument");
- }
- String dir = this.args[++i];
- this.parsed.put(CommandLineArgParser.UNIQUE_FLAGS.get(CommandLineArgParser.API_OUTPUT_DIR_FLAG), new String[] { dir } );
- return i;
- }
-
- private void parseMain(int i) throws CommandLineException
- {
- String main = args[i];
- if (!CommandLineArgParser.validateModuleArg(main))
- {
- throw new CommandLineException("Bad module arg: " + main);
- }
- this.parsed.put(CommandLine.ArgFlag.MAIN_MOD, new String[] { main } );
- }
-
- private int parseImportPath(int i) throws CommandLineException
- {
- if ((i + 1) >= this.args.length)
- {
- throw new CommandLineException("Missing path argument");
- }
- String path = this.args[++i];
- if (!validatePaths(path))
- {
- throw new CommandLineException("Scribble module import path '"+ path +"' is not valid\r\n");
- }
- //this.parsed.put(CommandLineArgParser.FLAGS.get(CommandLineArgParser.PATH_FLAG), new String[] { path });
- checkAndAddNoArgUniqueFlag(CommandLineArgParser.IMPORT_PATH_FLAG, new String[] { path });
- return i;
- }
-
- private int parseInlineMainModule(int i) throws CommandLineException
- {
- if ((i + 1) >= this.args.length)
- {
- throw new CommandLineException("Missing module definition");
- }
- String inline = this.args[++i];
- checkAndAddNoArgUniqueFlag(CommandLineArgParser.INLINE_MAIN_MOD_FLAG, new String[] { inline });
- return i;
- }
-
- private int parseF17(int i) throws CommandLineException
- {
- if ((i + 1) >= this.args.length)
- {
- throw new CommandLineException("Missing simple global protocol name argument");
- }
- String proto = this.args[++i];
- checkAndAddNoArgUniqueFlag(CommandLineArgParser.F17_FLAG, new String[] { proto });
- return i;
- }
-
- private int parseProject(int i) throws CommandLineException // Similar to parseProtoAndRoleArgs
- {
- if ((i + 2) >= this.args.length)
- {
- throw new CommandLineException("Missing protocol/role arguments");
- }
- String proto = this.args[++i];
- String role = this.args[++i];
- /*if (!validateProtocolName(proto)) // TODO
- {
- throw new RuntimeException("Protocol name '"+ proto +"' is not valid\r\n");
- }*/
- concatArgs(CommandLineArgParser.NON_UNIQUE_FLAGS.get(CommandLineArgParser.PROJECT_FLAG), proto, role);
- return i;
- }
-
- private int parseProtoAndRoleArgs(String f, int i) throws CommandLineException
- {
- ArgFlag flag = CommandLineArgParser.NON_UNIQUE_FLAGS.get(f);
- if ((i + 2) >= this.args.length)
- {
- throw new CommandLineException("Missing protocol/role arguments");
- }
- String proto = this.args[++i];
- String role = this.args[++i];
- concatArgs(flag, proto, role);
- return i;
- }
-
- private int parseProtoRoleAndFileArgs(String f, int i) throws CommandLineException
- {
- ArgFlag flag = CommandLineArgParser.NON_UNIQUE_FLAGS.get(f);
- if ((i + 3) >= this.args.length)
- {
- throw new CommandLineException("Missing protocol/role/file arguments");
- }
- String proto = this.args[++i];
- String role = this.args[++i];
- String png = this.args[++i];
- concatArgs(flag, proto, role, png);
- return i;
- }
-
- private int parseProtoArg(String f, int i) throws CommandLineException
- {
- ArgFlag flag = CommandLineArgParser.NON_UNIQUE_FLAGS.get(f);
- if ((i + 1) >= this.args.length)
- {
- throw new CommandLineException("Missing protocol argument");
- }
- String proto = this.args[++i];
- concatArgs(flag, proto);
- return i;
- }
-
- private int parseProtoAndFileArgs(String f, int i) throws CommandLineException
- {
- ArgFlag flag = CommandLineArgParser.NON_UNIQUE_FLAGS.get(f);
- if ((i + 2) >= this.args.length)
- {
- throw new CommandLineException("Missing protocol/file arguments");
- }
- String proto = this.args[++i];
- String png = this.args[++i];
- concatArgs(flag, proto, png);
- return i;
- }
-
- private void concatArgs(ArgFlag flag, String... toAdd)
- {
- String[] args = this.parsed.get(flag);
- if (args == null)
- {
- args = Arrays.copyOf(toAdd, toAdd.length);
- }
- else
- {
- String[] tmp = new String[args.length + toAdd.length];
- System.arraycopy(args, 0, tmp, 0, args.length);
- System.arraycopy(toAdd, 0, tmp, args.length, toAdd.length);
- args = tmp;
- }
- this.parsed.put(flag, args);
- }
-
- // Used to guard subsequent file open attempt?
- private static boolean validateModuleArg(String arg)
- {
- return arg.chars().noneMatch((i) ->
- !Character.isLetterOrDigit(i) && i != '.' && i != File.separatorChar && i != ':' && i != '-' && i != '_'
- && i != '/'); // Hack? (cygwin)
- }
-
- private static boolean validatePaths(String paths)
- {
- for (String path : paths.split(File.pathSeparator))
- {
- if (!new File(path).isDirectory())
- {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/modules/cli/src/main/java/org/scribble/cli/CommandLineException.java b/modules/cli/src/main/java/org/scribble/cli/CommandLineException.java
deleted file mode 100644
index 7494e97ed..000000000
--- a/modules/cli/src/main/java/org/scribble/cli/CommandLineException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.scribble.cli;
-
-public class CommandLineException extends Exception
-{
- private static final long serialVersionUID = 1L;
-
- public CommandLineException()
- {
- // TODO Auto-generated constructor stub
- }
-
- public CommandLineException(String arg0)
- {
- super(arg0);
- // TODO Auto-generated constructor stub
- }
-
- public CommandLineException(Throwable arg0)
- {
- super(arg0);
- // TODO Auto-generated constructor stub
- }
-
- public CommandLineException(String arg0, Throwable arg1)
- {
- super(arg0, arg1);
- // TODO Auto-generated constructor stub
- }
-
- public CommandLineException(String arg0, Throwable arg1, boolean arg2, boolean arg3)
- {
- super(arg0, arg1, arg2, arg3);
- // TODO Auto-generated constructor stub
- }
-}
diff --git a/modules/cli/src/main/java/org/scribble/main/MainContext.java b/modules/cli/src/main/java/org/scribble/main/MainContext.java
deleted file mode 100644
index d0c9c85ed..000000000
--- a/modules/cli/src/main/java/org/scribble/main/MainContext.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package org.scribble.main;
-
-import java.io.File;
-import java.nio.file.Path;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import org.scribble.ast.ImportDecl;
-import org.scribble.ast.ImportModule;
-import org.scribble.ast.Module;
-import org.scribble.main.resource.DirectoryResourceLocator;
-import org.scribble.main.resource.InlineResource;
-import org.scribble.main.resource.Resource;
-import org.scribble.main.resource.ResourceLocator;
-import org.scribble.parser.AntlrParser;
-import org.scribble.parser.ScribModuleLoader;
-import org.scribble.parser.ScribParser;
-import org.scribble.sesstype.name.ModuleName;
-import org.scribble.util.Pair;
-import org.scribble.util.ScribParserException;
-
-
-// N.B. the same package is declared in core
-
-// Scribble tool context for main module
-// FIXME: should be in core org.scribble.main, but currently here due to Maven dependency restrictions
-// MainContext takes ResourceLocator abstractly (e.g. DirectoryResourceLocator), but because abstract Resource itself works off paths, it takes mainpath (rather than something more abstract, e.g. URI, to identify the "main" resource)
-// Resource and ResourceLocator should be made abstract from (file)paths (cf. use of toPath in ScribbleModuleLoader)
-public class MainContext
-{
- //public final boolean jUnit;
- public final boolean debug;
- public final boolean useOldWF;
- public final boolean noLiveness;
- public final boolean minEfsm;
- public final boolean fair;
- public final boolean noLocalChoiceSubjectCheck;
- public final boolean noAcceptCorrelationCheck;
- public final boolean noValidation;
-
- // cli only (not in Job)
- public final boolean f17;
-
- // Only "manually" used here for loading main module (which should be factored out to front end) -- otherwise, only used within loader
- private final AntlrParser antlrParser = new AntlrParser(); // Not encapsulated inside ScribbleParser, because ScribbleParser's main function is to "parse" ANTLR CommonTrees into ModelNodes
- private final ScribParser scribParser = new ScribParser();
-
- private final ResourceLocator locator; // Path -> Resource
- private final ScribModuleLoader loader; // sesstype.ModuleName -> Pair
-
- private ModuleName main;
-
- // ModuleName keys are full module names -- parsed are the modules read from file, distinguished from the generated projection modules
- // Resource recorded for source path
- private final Map> parsed = new HashMap<>();
-
- // FIXME: make Path abstract as e.g. URI -- locator is abstract but Path is coupled to concrete DirectoryResourceLocator
- protected MainContext(boolean debug, ResourceLocator locator, boolean useOldWF, boolean noLiveness, boolean minEfsm,
- boolean fair, boolean noLocalChoiceSubjectCheck, boolean noAcceptCorrelationCheck, boolean noValidation, boolean f17)
- throws ScribParserException, ScribbleException
- {
- //this.jUnit = jUnit;
- this.debug = debug;
- this.useOldWF = useOldWF;
- this.noLiveness = noLiveness;
- this.minEfsm = minEfsm;
- this.fair = fair;
- this.noLocalChoiceSubjectCheck = noLocalChoiceSubjectCheck;
- this.noAcceptCorrelationCheck = noAcceptCorrelationCheck;
- this.noValidation = noValidation;
-
- this.f17 = f17;
-
- this.locator = locator;
- this.loader = new ScribModuleLoader(this.locator, this.antlrParser, this.scribParser);
- }
-
- public MainContext(boolean debug, ResourceLocator locator, String inline, boolean useOldWF, boolean noLiveness, boolean minEfsm,
- boolean fair, boolean noLocalChoiceSubjectCheck, boolean noAcceptCorrelationCheck, boolean noValidation, boolean f17)
- throws ScribParserException, ScribbleException
- {
- this(debug, locator, useOldWF, noLiveness, minEfsm, fair, noLocalChoiceSubjectCheck, noAcceptCorrelationCheck, noValidation, f17);
-
- Resource res = new InlineResource(inline);
- Module mod = (Module) this.scribParser.parse(this.antlrParser.parseAntlrTree(res));
-
- init(res, mod);
- }
-
- // Load main module from file system
- public MainContext(boolean debug, ResourceLocator locator, Path mainpath, boolean useOldWF, boolean noLiveness, boolean minEfsm,
- boolean fair, boolean noLocalChoiceSubjectCheck, boolean noAcceptCorrelationCheck, boolean noValidation, boolean f17)
- throws ScribParserException, ScribbleException
- {
- this(debug, locator, useOldWF, noLiveness, minEfsm, fair, noLocalChoiceSubjectCheck, noAcceptCorrelationCheck, noValidation, f17);
-
- // FIXME: checking main module resource exists at specific location should be factored out to front-end (e.g. CommandLine) -- main module resource is specified at local front end level of abstraction, while MainContext uses abstract resource loading
- //Pair p = this.loader.loadMainModule(mainpath);
- Resource res = DirectoryResourceLocator.getResourceByFullPath(mainpath); // FIXME: hardcoded to DirectoryResourceLocator -- main module loading should be factored out to front end (e.g. CommandLine)
- Module mod = (Module) this.scribParser.parse(this.antlrParser.parseAntlrTree(res)); // FIXME: rename exceptions
- checkMainModuleName(mainpath, mod);
-
- init(res, mod);
- }
-
- private void init(Resource res, Module mainmod) throws ScribParserException, ScribbleException
- {
- Pair p = new Pair<>(res, mainmod);
- this.main = p.right.getFullModuleName(); // FIXME: main modname comes from the inlined moddecl -- check for issues if this clashes with an existing file system resource
- loadAllModules(p);
- }
-
- private void loadAllModules(Pair module) throws ScribParserException, ScribbleException
- {
- this.parsed.put(module.right.getFullModuleName(), module);
- for (ImportDecl> id : module.right.getImportDecls())
- {
- if (id.isImportModule())
- {
- ModuleName modname = ((ImportModule) id).modname.toName();
- if (!this.parsed.containsKey(modname))
- {
- loadAllModules(this.loader.loadModule(modname));
- }
- }
- }
- }
-
- public Map getParsedModules()
- {
- return this.parsed.entrySet().stream().collect(Collectors.toMap((e) -> e.getKey(), (e) -> e.getValue().right));
- }
-
- public Job newJob()
- {
- return new Job(this.debug, this.getParsedModules(), this.main, this.useOldWF, this.noLiveness, this.minEfsm, this.fair,
- this.noLocalChoiceSubjectCheck, this.noAcceptCorrelationCheck, this.noValidation);
- }
-
- // Hacky? But not Scribble tool's job to check nested directory location of module fully corresponds to the fullname of module? Cf. Java classes
- private void checkMainModuleName(Path mainpath, Module main) throws ScribbleException
- {
- String path = mainpath.toString(); // FIXME: hack
- // FileSystems.getDefault().getSeparator() ?
- String tmp = path.substring((path.lastIndexOf(File.separator) == -1) ? 0 : path.lastIndexOf(File.separator) + 1, path.lastIndexOf('.'));
- if (!this.noValidation)
- {
- if (!tmp.equals(main.getFullModuleName().getSimpleName().toString())) // ModuleName.toString hack?
- {
- throw new ScribbleException(main.moddecl.name.getSource(), "Simple module name at path " + path + " mismatch: " + main.getFullModuleName());
- }
- }
- }
-}
diff --git a/modules/cli/src/test/java/scribtest/AllTest.java b/modules/cli/src/test/java/scribtest/AllTest.java
deleted file mode 100644
index 4c1514e17..000000000
--- a/modules/cli/src/test/java/scribtest/AllTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package scribtest;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-import org.scribble.cli.CommandLine;
-import org.scribble.cli.CommandLineArgParser;
-import org.scribble.cli.CommandLineException;
-import org.scribble.main.ScribbleException;
-import org.scribble.util.ScribParserException;
-
-/**
- * Runs all tests under good and bad root directories in Scribble.
- */
-//@RunWith(value = Parameterized.class)
-@RunWith(Parameterized.class)
-public class AllTest
-{
- protected static final boolean GOOD_TEST = false;
- protected static final boolean BAD_TEST = !GOOD_TEST;
-
- protected final String example;
- protected final boolean isBadTest;
-
- // relative to cli/src/test/resources (or target/test-classes/)
- protected static final String ALL_ROOT = ".";
- protected static final String GOOD_ROOT = "good";
- protected static final String BAD_ROOT = "bad";
-
- public AllTest(String example, boolean isBadTest)
- {
- this.example = example;
- this.isBadTest = isBadTest;
- }
-
- @Parameters(name = "{0}")
- public static Collection data()
- {
- // Test all tests under good and bad root directories
- String dir_good = ClassLoader.getSystemResource(GoodTest.GOOD_ROOT).getFile();
- String dir_bad = ClassLoader.getSystemResource(BadTest.BAD_ROOT).getFile();
- List result = new LinkedList<>();
- result.addAll(Harness.makeTests(GOOD_TEST, dir_good));
- result.addAll(Harness.makeTests(BAD_TEST, dir_bad));
- return result;
- }
-
- @Test
- public void tests() throws IOException, InterruptedException, ExecutionException
- {
- try
- {
- // TODO: For now just locate classpath for resources -- later maybe directly execute job
- /*URL url = ClassLoader.getSystemResource(AllTest.GOOD_ROOT); // Assume good/bad have same parent
- String dir = url.getFile().substring(0, url.getFile().length() - ("/" + AllTest.GOOD_ROOT).length());*/
- String dir = ClassLoader.getSystemResource(AllTest.ALL_ROOT).getFile();
-
- if (File.separator.equals("\\")) // HACK: Windows
- {
- dir = dir.substring(1).replace("/", "\\");
- }
-
- // FIXME: read runtime arguments from a config file, e.g. -oldwf, -fair, etc
- // Also need a way to specify expected tool output (e.g. projections/EFSMs for good, errors for bad)
- new CommandLine(this.example, CommandLineArgParser.JUNIT_FLAG, CommandLineArgParser.IMPORT_PATH_FLAG, dir).run();
- // Added JUNIT flag -- but for some reason only bad DoArgList01.scr was breaking without it...
- Assert.assertFalse("Expecting exception", this.isBadTest);
- }
- catch (ScribbleException e)
- {
- Assert.assertTrue("Unexpected exception '" + e.getMessage() + "'", this.isBadTest);
- }
- catch (ScribParserException | CommandLineException e)
- {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/modules/cli/src/test/java/scribtest/BadTest.java b/modules/cli/src/test/java/scribtest/BadTest.java
deleted file mode 100644
index c33b355a7..000000000
--- a/modules/cli/src/test/java/scribtest/BadTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package scribtest;
-
-import java.util.Collection;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-// For running all tests under the specified directory as bad tests
-// Needs -Dtest.dir=[test root dir] system property -- Eclipse VM arg: -Dtest.dir=${selected_resource_loc}
-//@RunWith(value = Parameterized.class)
-@RunWith(Parameterized.class)
-public class BadTest extends AllTest
-{
- public BadTest(String example, boolean isBadTest)
- {
- super(example, isBadTest);
- }
-
- @Parameters(name = "{0}")
- public static Collection data()
- {
- return Harness.checkTestDirProperty(AllTest.BAD_TEST, BAD_ROOT);
- /*String dir_good = ClassLoader.getSystemResource(GoodTest.GOOD_ROOT).getFile();
- String dir_bad = ClassLoader.getSystemResource(BadTest.BAD_ROOT).getFile();
- List result = new LinkedList<>();
- //result.add(new Object[] { "C:\\cygwin\\home\\Raymond\\code\\scribble\\github-rhu1\\scribble-java\\modules\\cli\\target\\test-classes\\good\\efsm\\grecursion\\Test03.scr", false });
- result.add(new Object[] { "C:\\cygwin\\home\\Raymond\\code\\scribble\\github-rhu1\\scribble-java\\modules\\cli\\target\\test-classes\\bad\\efsm\\grecursion\\unfair\\Test01.scr", true });
- result.add(new Object[] { "C:\\cygwin\\home\\Raymond\\code\\scribble\\github-rhu1\\scribble-java\\modules\\cli\\target\\test-classes\\bad\\efsm\\grecursion\\unfair\\Test06.scr", true });
- //result.addAll(Harness.makeTests(GOOD_TEST, dir_good));
- //result.addAll(Harness.makeTests(BAD_TEST, dir_bad));
- return result;
- //*/
- }
-}
diff --git a/modules/cli/src/test/java/scribtest/GoodTest.java b/modules/cli/src/test/java/scribtest/GoodTest.java
deleted file mode 100644
index 77bbf3688..000000000
--- a/modules/cli/src/test/java/scribtest/GoodTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package scribtest;
-
-import java.util.Collection;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-// For running all tests under the specified directory as good tests
-// Needs -Dtest.dir=[test root dir] system property -- Eclipse VM arg: -Dtest.dir=${selected_resource_loc}
-@RunWith(value = Parameterized.class)
-public class GoodTest extends AllTest
-{
- public GoodTest(String example, boolean isBadTest)
- {
- super(example, isBadTest);
- }
-
- @Parameters(name = "{0}")
- public static Collection data()
- {
- //String dir = ClassLoader.getSystemResource(AllTest.GOOD_ROOT).getFile(); // No: checkTestDirProperty does this
- String dir = AllTest.GOOD_ROOT;
- return Harness.checkTestDirProperty(AllTest.GOOD_TEST, dir);
- }
-}
diff --git a/modules/cli/src/test/java/scribtest/IgnoredDirectoryWhenFilter.java b/modules/cli/src/test/java/scribtest/IgnoredDirectoryWhenFilter.java
deleted file mode 100644
index 5d54b1118..000000000
--- a/modules/cli/src/test/java/scribtest/IgnoredDirectoryWhenFilter.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package scribtest;
-
-import java.io.File;
-import java.io.FileFilter;
-
-import org.apache.commons.io.filefilter.AbstractFileFilter;
-
-public class IgnoredDirectoryWhenFilter extends AbstractFileFilter {
- private final FileFilter filter;
-
- public IgnoredDirectoryWhenFilter(FileFilter filter) {
- this.filter = filter;
- }
-
- @Override
- public boolean accept(File file) {
- if (!file.isDirectory()) {
- return false;
- }
- return file.listFiles(filter).length == 0;
- }
-}
diff --git a/modules/cli/src/test/resources/bad/efsm/grecursion/unfair/Test01.scr b/modules/cli/src/test/resources/bad/efsm/grecursion/unfair/Test01.scr
deleted file mode 100644
index 69428ba26..000000000
--- a/modules/cli/src/test/resources/bad/efsm/grecursion/unfair/Test01.scr
+++ /dev/null
@@ -1,38 +0,0 @@
-module bad.efsm.grecursion.unfair.Test01;
-
-
-// OK if -fair
-// Also tests GraphBuilderUtil addContinueEdge (addEdge vs. addEdgeAux) AllTest/BadTest problem
-global protocol Proto1(role A, role B, role C)
-{
- rec Y
- {
- choice at A
- {
- rec X
- {
- choice at A
- {
- 1() from A to B;
- continue X;
- }
- or
- {
- 2() from A to C;
- continue Y;
- }
- or
- {
- 3() from A to B;
- 3() from A to C;
- }
- }
- }
- or
- {
- 4() from A to B;
- continue Y;
- }
- }
-}
-
diff --git a/modules/cli/src/test/resources/bad/efsm/grecursion/unfair/Test06.scr b/modules/cli/src/test/resources/bad/efsm/grecursion/unfair/Test06.scr
deleted file mode 100644
index bcd9a2308..000000000
--- a/modules/cli/src/test/resources/bad/efsm/grecursion/unfair/Test06.scr
+++ /dev/null
@@ -1,28 +0,0 @@
-module bad.efsm.grecursion.unfair.Test06;
-
-
-global protocol Proto1(role A, role B, role C)
-{
- choice at A // OK if -fair
- {
- 1() from A to B;
- do Proto1Aux1(A, B, C);
- }
- or
- {
- do Proto1Aux2(A, B, C);
- }
-}
-
-aux global protocol Proto1Aux1(role A, role B, role C)
-{
- do Proto1(A, B, C);
-}
-
-aux global protocol Proto1Aux2(role A, role B, role C)
-{
- 2() from A to B;
- 3() from B to C;
- do Proto1(A, B, C);
-}
-
diff --git a/modules/cli/src/test/resources/bad/efsm/grecursion/unfair/Test11b.scr b/modules/cli/src/test/resources/bad/efsm/grecursion/unfair/Test11b.scr
deleted file mode 100644
index f5ee7a5a0..000000000
--- a/modules/cli/src/test/resources/bad/efsm/grecursion/unfair/Test11b.scr
+++ /dev/null
@@ -1,27 +0,0 @@
-module bad.efsm.grecursion.unfair.Test11b;
-
-
-// OK if -fair
-global protocol Proto1(role A, role B, role C)
-{
- rec X
- {
- choice at A
- {
- 1() from A to B;
- choice at B
- {
- 2() from B to A;
- //4() from B to C; // Testing EFSM building
- continue X;
- }
- or
- {
- 3() from B to A;
- 4() from B to C;
- continue X;
- }
- }
- }
-}
-
diff --git a/modules/cli/src/test/resources/bad/liveness/messagelive/Test01.scr b/modules/cli/src/test/resources/bad/liveness/messagelive/Test01.scr
deleted file mode 100644
index 533c9b62a..000000000
--- a/modules/cli/src/test/resources/bad/liveness/messagelive/Test01.scr
+++ /dev/null
@@ -1,25 +0,0 @@
-module bad.liveness.messagelive.Test01;
-
-
-global protocol Proto1(role A, role B, role C)
-{
- choice at A
- {
- 1() from A to B; // Bad: testing deadlock detection (input blocked -> terminated)
- 2() from A to B; // Message liveness -- also counterpart wait-for
- 2() from B to C;
- }
- or
- {
- 1() from A to B;
- rec X
- {
- // NB: not a role progress problem: A is already done by here
- 4() from B to C;
- 5() from C to B;
- continue X;
- }
- }
-}
-
-
diff --git a/modules/cli/src/test/resources/bad/liveness/roleprog/unfair/Test06.scr b/modules/cli/src/test/resources/bad/liveness/roleprog/unfair/Test06.scr
deleted file mode 100644
index d40b82d09..000000000
--- a/modules/cli/src/test/resources/bad/liveness/roleprog/unfair/Test06.scr
+++ /dev/null
@@ -1,29 +0,0 @@
-module bad.liveness.roleprog.unfair.Test06;
-
-
-// Duplicate of bad.efsm.unfair.Test06
-global protocol Proto1(role A, role B, role C)
-{
- choice at A // OK if -fair
- {
- 1() from A to B;
- do Proto1Aux1(A, B, C);
- }
- or
- {
- do Proto1Aux2(A, B, C);
- }
-}
-
-aux global protocol Proto1Aux1(role A, role B, role C)
-{
- do Proto1(A, B, C);
-}
-
-aux global protocol Proto1Aux2(role A, role B, role C)
-{
- 2() from A to B;
- 3() from B to C;
- do Proto1(A, B, C);
-}
-
diff --git a/modules/cli/src/test/resources/bad/reach/globals/gdo/Test01b.scr b/modules/cli/src/test/resources/bad/reach/globals/gdo/Test01b.scr
deleted file mode 100644
index 81b31a8e4..000000000
--- a/modules/cli/src/test/resources/bad/reach/globals/gdo/Test01b.scr
+++ /dev/null
@@ -1,16 +0,0 @@
-module bad.reach.globals.gdo.Test01b;
-
-
-aux global protocol Proto1(role A, role B)
-{
- 1() from A to B;
- do Proto1(A, B);
- 3() from A to B;
-}
-
-global protocol Proto2(role C, role D)
-{
- 2() from C to D;
- do Proto2(C, D);
- //2() from C to D;
-}
diff --git a/modules/cli/src/test/resources/bad/reach/globals/gdo/Test02a.scr b/modules/cli/src/test/resources/bad/reach/globals/gdo/Test02a.scr
deleted file mode 100644
index 0bc0a6f9f..000000000
--- a/modules/cli/src/test/resources/bad/reach/globals/gdo/Test02a.scr
+++ /dev/null
@@ -1,16 +0,0 @@
-module bad.reach.globals.gdo.Test02a;
-
-
-global protocol Proto1(role A, role B)
-{
- 1() from A to B;
- do Proto1(A, B);
- //3() from A to B;
-}
-
-aux global protocol Proto2(role C, role D)
-{
- 2() from C to D;
- do Proto2(C, D);
- 2() from C to D;
-}
diff --git a/modules/cli/src/test/resources/bad/reach/globals/grecursion/Recursion19b.scr b/modules/cli/src/test/resources/bad/reach/globals/grecursion/Recursion19b.scr
deleted file mode 100644
index 8dbdb1055..000000000
--- a/modules/cli/src/test/resources/bad/reach/globals/grecursion/Recursion19b.scr
+++ /dev/null
@@ -1,19 +0,0 @@
-module bad.reach.globals.grecursion.Recursion19b;
-
-
-global protocol Proto1(role A, role B)
-{
- rec X
- {
- choice at A
- {
- continue X;
- }
- or
- {
- 2() from A to B;
- }
- 1() from A to B; // Reachability error -- comes out as a global model error if that pass is done first (tail recursion needed as syntactic check prior to model checking) // Reachability now done before model check
- }
-}
-
diff --git a/modules/cli/src/test/resources/bad/syntax/disamb/Test01.scr b/modules/cli/src/test/resources/bad/syntax/disamb/Test01.scr
deleted file mode 100644
index 9fd651a4d..000000000
--- a/modules/cli/src/test/resources/bad/syntax/disamb/Test01.scr
+++ /dev/null
@@ -1,14 +0,0 @@
-module bad.syntax.disamb.Test01;
-
-
-sig "foo" from "bar" as M1;
-
-
-global protocol Foo(role A, role B)
-{
- () from A to B;
- M from A to B;
- M1 from A to B;
- M2 from A to B;
-}
-
diff --git a/modules/cli/src/test/resources/bad/syntax/disamb/imports/Import02.scr b/modules/cli/src/test/resources/bad/syntax/disamb/imports/Import02.scr
deleted file mode 100644
index 81b9e15dd..000000000
--- a/modules/cli/src/test/resources/bad/syntax/disamb/imports/Import02.scr
+++ /dev/null
@@ -1,4 +0,0 @@
-module bad.syntax.disamb.imports.Import02;
-
-
-import bad.syntax.disamb.imports.Import02;
diff --git a/modules/cli/src/test/resources/bad/syntax/disamb/imports/Import03.scr b/modules/cli/src/test/resources/bad/syntax/disamb/imports/Import03.scr
deleted file mode 100644
index 707101855..000000000
--- a/modules/cli/src/test/resources/bad/syntax/disamb/imports/Import03.scr
+++ /dev/null
@@ -1,4 +0,0 @@
-module bad.syntax.disamb.imports.Import03;
-
-
-import bad.syntax.disamb.imports.Import03 as Import03; // The simple name Import03 is implicitly visible from moduledecl
diff --git a/modules/cli/src/test/resources/bad/syntax/disamb/modules/Modules02.scr b/modules/cli/src/test/resources/bad/syntax/disamb/modules/Modules02.scr
deleted file mode 100644
index 85cb8386d..000000000
--- a/modules/cli/src/test/resources/bad/syntax/disamb/modules/Modules02.scr
+++ /dev/null
@@ -1,5 +0,0 @@
-module bad.syntax.disamb.modules.Modules02;
-
-
-type "java.lang.String" from "rt.jar" as String;
-type "java.lang.String" from "rt.jar" as String;
diff --git a/modules/cli/src/test/resources/bad/todo/Modules02.scr b/modules/cli/src/test/resources/bad/todo/Modules02.scr
deleted file mode 100644
index 61d3b7a66..000000000
--- a/modules/cli/src/test/resources/bad/todo/Modules02.scr
+++ /dev/null
@@ -1,12 +0,0 @@
-module bad.syntax.disamb.modules.Modules02;
-
-
-global protocol Foo(role A, role B)
-{
-
-}
-
-local protocol Foo(role A, role B) // TODO: local not parsed
-{
-
-}
diff --git a/modules/cli/src/test/resources/bad/wfchoice/enabling/fourparty/Test01.scr b/modules/cli/src/test/resources/bad/wfchoice/enabling/fourparty/Test01.scr
deleted file mode 100644
index 9410bbdb6..000000000
--- a/modules/cli/src/test/resources/bad/wfchoice/enabling/fourparty/Test01.scr
+++ /dev/null
@@ -1,27 +0,0 @@
-module bad.wfchoice.enabling.fourparty.Test01;
-
-
-global protocol Proto1(role A, role B, role C, role D)
-{
- choice at A
- {
- 1() from A to B;
- rec X
- {
- 2() from B to C;
- choice at C
- {
- 2() from C to A;
- continue X; // Enabling error, with the continue inside this choice scope (continue factored out after choice is not enabling error)
- }
- or
- {
- () from C to A;
- () from C to D;
- continue X;
- }
- }
- }
-}
-
-
diff --git a/modules/cli/src/test/resources/good/efsm/gchoice/Test09.scr b/modules/cli/src/test/resources/good/efsm/gchoice/Test09.scr
deleted file mode 100644
index 2b5b86816..000000000
--- a/modules/cli/src/test/resources/good/efsm/gchoice/Test09.scr
+++ /dev/null
@@ -1,20 +0,0 @@
-module good.efsm.gchoice.Test09;
-
-
-global protocol Foo(role A, role B)
-{
- rec X
- {
- choice at A
- {
- 1() from A to B;
- }
- or
- {
- 1() from A to B;
- }
- continue X; // Testing recursion edge replacement cornercase (length 1 non-det choice paths are merged as a single case)
- }
-}
-
-
diff --git a/modules/cli/src/test/resources/good/efsm/gcontinue/choiceunguarded/Test01a.scr b/modules/cli/src/test/resources/good/efsm/gcontinue/choiceunguarded/Test01a.scr
deleted file mode 100644
index 6454e8f24..000000000
--- a/modules/cli/src/test/resources/good/efsm/gcontinue/choiceunguarded/Test01a.scr
+++ /dev/null
@@ -1,21 +0,0 @@
-module good.efsm.gcontinue.choiceunguarded.Test01a;
-
-
-// Cf. -minfsm
-global protocol Proto1(role A, role B)
-{
- rec X
- {
- 1() from A to B;
- choice at A
- {
- continue X; // Not "isomorphic" to a single continue X, because non-det not bisim equiv (cf. language equiv) -- so no "syntatic collapse" to single case
- }
- or
- {
- continue X;
- }
- }
-}
-
-
diff --git a/modules/cli/src/test/resources/good/efsm/gdo/Test10.scr b/modules/cli/src/test/resources/good/efsm/gdo/Test10.scr
deleted file mode 100644
index b2c0a6662..000000000
--- a/modules/cli/src/test/resources/good/efsm/gdo/Test10.scr
+++ /dev/null
@@ -1,34 +0,0 @@
-module good.efsm.gdo.Test10;
-
-
-global protocol Proto1(role A, role B, role C)
-{
- choice at A
- {
- do Proto1Aux1(A, B, C);
- }
- or
- {
- do Proto1Aux2(A, B, C);
- }
-}
-
-aux global protocol Proto1Aux1(role A, role B, role C)
-{
- choice at A
- {
- 3() from A to B;
- 3() from A to C;
- do Proto1Aux1(A, B, C);
- }
-}
-
-aux global protocol Proto1Aux2(role A, role B, role C)
-{
- choice at A
- {
- 2() from A to B;
- do Proto1Aux1(A, B, C);
- }
-}
-
diff --git a/modules/cli/src/test/resources/good/efsm/grecursion/Test09.scr b/modules/cli/src/test/resources/good/efsm/grecursion/Test09.scr
deleted file mode 100644
index 2a51a4800..000000000
--- a/modules/cli/src/test/resources/good/efsm/grecursion/Test09.scr
+++ /dev/null
@@ -1,36 +0,0 @@
-module good.efsm.grecursion.Test09;
-
-
-global protocol Proto1(role A, role B, role C)
-{
- 1() from A to B;
- 2() from A to C;
- rec X
- {
- choice at A
- {
- 3() from A to B;
- }
- choice at A
- {
- rec Y
- {
- choice at A
- {
- 3() from A to B;
- continue X;
- }
- or
- {
- 4() from A to B;
- continue Y;
- }
- or
- {
- 5() from A to B;
- }
- }
- }
- }
-}
-
diff --git a/modules/cli/src/test/resources/good/efsm/grecursion/choiceunguarded/Test04.scr b/modules/cli/src/test/resources/good/efsm/grecursion/choiceunguarded/Test04.scr
deleted file mode 100644
index 7b9616e8a..000000000
--- a/modules/cli/src/test/resources/good/efsm/grecursion/choiceunguarded/Test04.scr
+++ /dev/null
@@ -1,25 +0,0 @@
-module good.efsm.grecursion.choiceunguarded.Test04;
-
-
-// Same as good.syntax.inlinedunfolding.grecursion.Test04;
-global protocol Proto4(role A, role B)
-{
- choice at A
- {
- rec X
- {
- choice at A
- {
- 1() from A to B;
- continue X;
- }
- or
- {
- 2() from A to B;
- continue X;
- }
- }
- }
-}
-
-
diff --git a/modules/cli/src/test/resources/good/liveness/roleprog/Test10.scr b/modules/cli/src/test/resources/good/liveness/roleprog/Test10.scr
deleted file mode 100644
index ca50ee5b4..000000000
--- a/modules/cli/src/test/resources/good/liveness/roleprog/Test10.scr
+++ /dev/null
@@ -1,35 +0,0 @@
-module good.efsm.gdo.Test10;
-
-
-// Duplicate of good.efsm.gdo.Test10
-global protocol Proto1(role A, role B, role C)
-{
- choice at A
- {
- do Proto1Aux1(A, B, C);
- }
- or
- {
- do Proto1Aux2(A, B, C);
- }
-}
-
-aux global protocol Proto1Aux1(role A, role B, role C)
-{
- choice at A
- {
- 3() from A to B;
- 3() from A to C;
- do Proto1Aux1(A, B, C);
- }
-}
-
-aux global protocol Proto1Aux2(role A, role B, role C)
-{
- choice at A
- {
- 2() from A to B;
- do Proto1Aux1(A, B, C);
- }
-}
-
diff --git a/modules/cli/src/test/resources/good/misc/imports/Import01.scr b/modules/cli/src/test/resources/good/misc/imports/Import01.scr
deleted file mode 100644
index 59236bf3b..000000000
--- a/modules/cli/src/test/resources/good/misc/imports/Import01.scr
+++ /dev/null
@@ -1,9 +0,0 @@
-//Raymond@HZHL2 ~/code/python/scribble-tools
-//$ PYTHONPATH='lib/:bin/' python src/scribble/Main.py -ip test/ test/base/impourt/Import1.scr
-
-module good.misc.imports.Import01;
-
-
-import good.misc.imports.pack1.Pack01;
-//import good.misc.imports.pack1.Pack1;
-
diff --git a/modules/cli/src/test/resources/good/misc/imports/Import08.scr b/modules/cli/src/test/resources/good/misc/imports/Import08.scr
deleted file mode 100644
index a99c2153f..000000000
--- a/modules/cli/src/test/resources/good/misc/imports/Import08.scr
+++ /dev/null
@@ -1,13 +0,0 @@
-//Raymond@HZHL2 ~/code/python/scribble-tools
-//$ PYTHONPATH='lib/:bin/' python src/scribble/Main.py -ip test/ test/base/impourt/Import8.scr
-
-module good.misc.imports.Import08;
-
-import good.misc.imports.pack1.Pack08;
-
-
-global protocol Import8(role A, role B)
-{
- do good.misc.imports.pack1.Pack08.Pack8(A, B);
-}
-
diff --git a/modules/cli/src/test/resources/good/syntax/disamb/Test01.scr b/modules/cli/src/test/resources/good/syntax/disamb/Test01.scr
deleted file mode 100644
index 4eebee80f..000000000
--- a/modules/cli/src/test/resources/good/syntax/disamb/Test01.scr
+++ /dev/null
@@ -1,14 +0,0 @@
-module good.syntax.disamb.Test01;
-
-
-sig "foo" from "bar" as M1;
-
-
-global protocol Foo(role A, role B)
-{
- () from A to B;
- M from A to B;
- M1 from A to B;
- //M2 from A to B;
-}
-
diff --git a/modules/cli/src/test/resources/good/syntax/disamb/imports/Import01.scr b/modules/cli/src/test/resources/good/syntax/disamb/imports/Import01.scr
deleted file mode 100644
index 6838fb96d..000000000
--- a/modules/cli/src/test/resources/good/syntax/disamb/imports/Import01.scr
+++ /dev/null
@@ -1,13 +0,0 @@
-module good.syntax.disamb.imports.Import01;
-
-
-import good.syntax.disamb.imports.Import01a;
-import good.syntax.disamb.imports.pack1.Import01b as Test4; // <- "Test3" as Test4
-
-
-global protocol Import1(role A, role B)
-{
- 1() from A to B;
- do good.syntax.disamb.imports.Import01a.Import1a(A, B);
- do Test4.Import1b(A, B);
-}
diff --git a/modules/cli/src/test/resources/good/syntax/disamb/imports/Import01a.scr b/modules/cli/src/test/resources/good/syntax/disamb/imports/Import01a.scr
deleted file mode 100644
index 3d068779b..000000000
--- a/modules/cli/src/test/resources/good/syntax/disamb/imports/Import01a.scr
+++ /dev/null
@@ -1,14 +0,0 @@
-module good.syntax.disamb.imports.Import01a;
-
-import good.syntax.disamb.imports.pack1.Import01b as Test3;
-import good.syntax.disamb.imports.Import01c;
-import good.syntax.disamb.imports.Import01c as T4;
-
-global protocol Import1a(role C, role D)
-{
- 2(Test3.TTT) from C to D;
- 2() from C to D;
- do Test3.Import1b(C, D);
- do good.syntax.disamb.imports.Import01c.Import1c(C, D);
- do T4.Import1c(C, D);
-}
diff --git a/modules/cli/src/test/resources/good/syntax/disamb/imports/Import02.scr b/modules/cli/src/test/resources/good/syntax/disamb/imports/Import02.scr
deleted file mode 100644
index 477519e8c..000000000
--- a/modules/cli/src/test/resources/good/syntax/disamb/imports/Import02.scr
+++ /dev/null
@@ -1,25 +0,0 @@
-module good.syntax.disamb.imports.Import02;
-
-
-import good.syntax.disamb.imports.pack1.Import02b;
-
-
-global protocol Foo(role A, role B)
-{
- choice at A
- {
- 1() from A to B;
- }
- or
- {
- do good.syntax.disamb.imports.pack1.Import02b.Bar(A, B);
- do Bar(A, B);
- }
-}
-
-
-global protocol Bar(role C, role D)
-{
- 2() from C to D;
-}
-
diff --git a/modules/cli/src/test/resources/good/syntax/disamb/imports/Import03.scr b/modules/cli/src/test/resources/good/syntax/disamb/imports/Import03.scr
deleted file mode 100644
index bc46b8e4f..000000000
--- a/modules/cli/src/test/resources/good/syntax/disamb/imports/Import03.scr
+++ /dev/null
@@ -1,13 +0,0 @@
-module good.syntax.disamb.imports.Import03;
-
-
-import good.syntax.disamb.imports.pack1.Import02b;
-
-
-global protocol Foo(role A, role B)
-{
- 1() from A to B;
- do good.syntax.disamb.imports.pack1.Import02b.Bar(A, B);
- 2() from A to B;
-}
-
diff --git a/modules/cli/src/test/resources/good/syntax/disamb/imports/pack1/Test2.scr b/modules/cli/src/test/resources/good/syntax/disamb/imports/pack1/Test2.scr
deleted file mode 100644
index 34bf5ea39..000000000
--- a/modules/cli/src/test/resources/good/syntax/disamb/imports/pack1/Test2.scr
+++ /dev/null
@@ -1,16 +0,0 @@
-module good.syntax.disamb.imports.pack1.Test2;
-
-
-import good.syntax.disamb.imports.pack1.test3.Test3 as Test3; // The name Test3 is Test3 in Test1
-import good.syntax.disamb.imports.pack1.Test4 as Test4; // The name Test4 is test3.Test3 in Test1
-import good.syntax.disamb.imports.pack1.Test4 as T4;
-
-
-global protocol Proto2(role C, role D)
-{
- 2(Test3.TTT) from C to D;
- do Test3.Bar3(C, D);
- do Test4.Proto4(C, D);
- do T4.Proto4(C, D);
-}
-
diff --git a/modules/cli/src/test/resources/good/syntax/disamb/imports/pack1/Test3.scr b/modules/cli/src/test/resources/good/syntax/disamb/imports/pack1/Test3.scr
deleted file mode 100644
index a163ef9aa..000000000
--- a/modules/cli/src/test/resources/good/syntax/disamb/imports/pack1/Test3.scr
+++ /dev/null
@@ -1,8 +0,0 @@
-module good.syntax.disamb.imports.pack1.Test3;
-
-
-global protocol Foo3(role C, role D)
-{
- foo3() from C to D;
-}
-
diff --git a/modules/cli/src/test/resources/good/syntax/disamb/imports/pack1/Test4.scr b/modules/cli/src/test/resources/good/syntax/disamb/imports/pack1/Test4.scr
deleted file mode 100644
index ca405a6e8..000000000
--- a/modules/cli/src/test/resources/good/syntax/disamb/imports/pack1/Test4.scr
+++ /dev/null
@@ -1,8 +0,0 @@
-module good.syntax.disamb.imports.pack1.Test4;
-
-
-global protocol Proto4(role C, role D)
-{
- 4() from C to D;
-}
-
diff --git a/modules/cli/src/test/resources/good/syntax/disamb/imports/pack1/test3/Test3.scr b/modules/cli/src/test/resources/good/syntax/disamb/imports/pack1/test3/Test3.scr
deleted file mode 100644
index b143e39ff..000000000
--- a/modules/cli/src/test/resources/good/syntax/disamb/imports/pack1/test3/Test3.scr
+++ /dev/null
@@ -1,11 +0,0 @@
-module good.syntax.disamb.imports.pack1.test3.Test3;
-
-
-type "..." from "..." as TTT;
-
-
-global protocol Bar3(role A, role B)
-{
- bar3() from A to B;
-}
-
diff --git a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gcontinue/Test03.scr b/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gcontinue/Test03.scr
deleted file mode 100644
index 5ba8c158a..000000000
--- a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gcontinue/Test03.scr
+++ /dev/null
@@ -1,21 +0,0 @@
-module good.syntax.inlinedunfolding.gcontinue.Test03;
-
-
-global protocol Proto1(role A, role B)
-{
- rec X
- {
- 1() from A to B;
- choice at A
- {
- continue X;
- }
- or
- {
- 2() from A to B;
- continue X;
- }
- }
-}
-
-
diff --git a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/Test01a.scr b/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/Test01a.scr
deleted file mode 100644
index b7574a44e..000000000
--- a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/Test01a.scr
+++ /dev/null
@@ -1,18 +0,0 @@
-module good.syntax.inlinedunfolding.gdo.Test01a;
-
-
-global protocol Foo(role A, role B)
-{
- choice at A
- {
- do Bar(A, B);
- }
-}
-
-// The Bar inlined rec for root Foo gets "dropped" by unguarded unfolding because no continue for this rec
-aux global protocol Bar(role A, role B)
-{
- 1() from A to B;
- do Foo(A, B);
-}
-
diff --git a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/Test01b.scr b/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/Test01b.scr
deleted file mode 100644
index 1127d5ea4..000000000
--- a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/Test01b.scr
+++ /dev/null
@@ -1,18 +0,0 @@
-module good.syntax.inlinedunfolding.gdo.Test01b;
-
-
-global protocol Foo(role A, role B)
-{
- choice at A
- {
- do Bar(A, B);
- }
-}
-
-// For root Foo, Bar inlined as unguarded rec, then gets unfolded
-aux global protocol Bar(role A, role B)
-{
- 4() from A to B;
- do Bar(A, B);
-}
-
diff --git a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/Test02.scr b/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/Test02.scr
deleted file mode 100644
index 595eabe3f..000000000
--- a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/Test02.scr
+++ /dev/null
@@ -1,43 +0,0 @@
-module good.syntax.inlinedunfolding.gdo.Test02;
-
-
-import good.syntax.inlinedunfolding.gdo.pack1.Test2 as Test2;
-
-
-global protocol Foo(role A, role B)
-{
- do Test2.Proto2(A, B);
- 1() from A to B;
- choice at A
- {
- //1() from A to B;
- do Bar1(A, B);
- //1() from A to B;
- //do Foo(A, B);
- }
- or
- {
- //5() from A to B;
- do Bar2(A, B);
- }
- or
- {
- //2() from A to B;
- 4() from A to B;
- }
-}
-
-global protocol Bar1(role C, role D)
-{
- 2() from C to D;
- 3() from C to D;
- do Foo(C, D);
- //do Foo(D, C);
-}
-
-global protocol Bar2(role C, role D)
-{
- 5() from C to D;
- do Bar2(C, D);
-}
-
diff --git a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/Test03.scr b/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/Test03.scr
deleted file mode 100644
index 491a05870..000000000
--- a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/Test03.scr
+++ /dev/null
@@ -1,16 +0,0 @@
-module good.syntax.inlinedunfolding.gdo.Test03;
-
-
-global protocol Proto1(role A, role B)
-{
- choice at A
- {
- do Proto1Aux1(A, B); // Inlined as rec, then rec "dropped" by unfolding (no continue)
- }
-}
-
-aux global protocol Proto1Aux1(role A, role B)
-{
- 1() from A to B;
-}
-
diff --git a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/pack1/Test2.scr b/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/pack1/Test2.scr
deleted file mode 100644
index f6ed06dc1..000000000
--- a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/pack1/Test2.scr
+++ /dev/null
@@ -1,16 +0,0 @@
-module good.syntax.inlinedunfolding.gdo.pack1.Test2;
-
-
-import good.syntax.inlinedunfolding.gdo.pack1.test3.Test3 as Test3; // The name Test3 is Test3 in Test1
-import good.syntax.inlinedunfolding.gdo.pack1.Test4 as Test4; // The name Test4 is test3.Test3 in Test1
-import good.syntax.inlinedunfolding.gdo.pack1.Test4 as T4;
-
-
-global protocol Proto2(role C, role D)
-{
- 2(Test3.TTT) from C to D;
- do Test3.Bar3(C, D);
- do Test4.Proto4(C, D);
- do T4.Proto4(C, D);
-}
-
diff --git a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/pack1/Test3.scr b/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/pack1/Test3.scr
deleted file mode 100644
index b377306e1..000000000
--- a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/pack1/Test3.scr
+++ /dev/null
@@ -1,8 +0,0 @@
-module good.syntax.inlinedunfolding.gdo.pack1.Test3;
-
-
-global protocol Foo3(role C, role D)
-{
- foo3() from C to D;
-}
-
diff --git a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/pack1/Test4.scr b/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/pack1/Test4.scr
deleted file mode 100644
index d1898a79a..000000000
--- a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/pack1/Test4.scr
+++ /dev/null
@@ -1,8 +0,0 @@
-module good.syntax.inlinedunfolding.gdo.pack1.Test4;
-
-
-global protocol Proto4(role C, role D)
-{
- 4() from C to D;
-}
-
diff --git a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/pack1/test3/Test3.scr b/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/pack1/test3/Test3.scr
deleted file mode 100644
index 480cd2dd3..000000000
--- a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/gdo/pack1/test3/Test3.scr
+++ /dev/null
@@ -1,11 +0,0 @@
-module good.syntax.inlinedunfolding.gdo.pack1.test3.Test3;
-
-
-type "..." from "..." as TTT;
-
-
-global protocol Bar3(role A, role B)
-{
- bar3() from A to B;
-}
-
diff --git a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/grecursion/Test01.scr b/modules/cli/src/test/resources/good/syntax/inlinedunfolding/grecursion/Test01.scr
deleted file mode 100644
index 556b5c426..000000000
--- a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/grecursion/Test01.scr
+++ /dev/null
@@ -1,18 +0,0 @@
-module good.syntax.inlinedunfolding.grecursion.Test01;
-
-
-global protocol Foo(role A, role B)
-{
- choice at A
- {
- rec X // Unguarded rec gets unfolded
- {
- 1() from A to B;
- continue X;
- }
- }
- or
- {
- 2() from A to B;
- }
-}
diff --git a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/grecursion/Test02a.scr b/modules/cli/src/test/resources/good/syntax/inlinedunfolding/grecursion/Test02a.scr
deleted file mode 100644
index 19dde559b..000000000
--- a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/grecursion/Test02a.scr
+++ /dev/null
@@ -1,23 +0,0 @@
-module good.syntax.inlinedunfolding.grecursion.Test02a;
-
-
-global protocol Proto1(role A, role B)
-{
- rec X
- {
- 1() from A to B;
- choice at A
- {
- continue X;
- }
- or
- {
- rec Y // Testing nested InlinedProtocolUnfolding case
- {
- 2() from A to B;
- continue Y;
- }
- }
- }
-}
-
diff --git a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/grecursion/Test04.scr b/modules/cli/src/test/resources/good/syntax/inlinedunfolding/grecursion/Test04.scr
deleted file mode 100644
index 38d071416..000000000
--- a/modules/cli/src/test/resources/good/syntax/inlinedunfolding/grecursion/Test04.scr
+++ /dev/null
@@ -1,24 +0,0 @@
-module good.syntax.inlinedunfolding.grecursion.Test04;
-
-
-global protocol Proto4(role A, role B)
-{
- choice at A
- {
- rec X
- {
- choice at A
- {
- 1() from A to B;
- continue X;
- }
- or
- {
- 2() from A to B;
- continue X;
- }
- }
- }
-}
-
-
diff --git a/modules/cli/src/test/resources/good/syntax/projroledeclfix/Test01.scr b/modules/cli/src/test/resources/good/syntax/projroledeclfix/Test01.scr
deleted file mode 100644
index da73b0485..000000000
--- a/modules/cli/src/test/resources/good/syntax/projroledeclfix/Test01.scr
+++ /dev/null
@@ -1,19 +0,0 @@
-//$ bin/scribblec.sh modules/cli/src/test/resources/good/projroledeclfix/Test01.scr -project Bar F
-
-
-module good.syntax.projroledeclfix.Test01;
-
-
-// Test unused roledecl filtering in projections
-global protocol Foo(role A, role B, role C)
-{
- 1() from A to B;
- do Bar(A, B, C);
-}
-
-global protocol Bar(role D, role E, role F)
-{
- 2() from D to F;
- do Foo(D, E, F);
-}
-
diff --git a/modules/cli/src/test/resources/good/wfchoice/gdo/params/Test02.scr b/modules/cli/src/test/resources/good/wfchoice/gdo/params/Test02.scr
deleted file mode 100644
index d8ed58124..000000000
--- a/modules/cli/src/test/resources/good/wfchoice/gdo/params/Test02.scr
+++ /dev/null
@@ -1,23 +0,0 @@
-module good.wfchoice.gdo.params.Test02;
-
-
-global protocol Foo(role A, role B)
-{
- choice at A
- {
- do Bar<1()>(A, B);
- 1() from B to A;
- }
- or
- {
- do Bar<2()>(A, B);
- 2() from B to A;
- }
-}
-
-
-aux global protocol Bar(role C, role D)
-{
- M from C to D;
-}
-
diff --git a/modules/cli/src/test/resources/scribble/examples/GMessage.scr b/modules/cli/src/test/resources/scribble/examples/GMessage.scr
deleted file mode 100644
index 9296dc6cd..000000000
--- a/modules/cli/src/test/resources/scribble/examples/GMessage.scr
+++ /dev/null
@@ -1,9 +0,0 @@
-module scribble.examples.GMessage;
-
-global protocol GMessageProtocol(role Buyer,role Seller) {
- buy(Order,Customer) from Buyer to Seller;
- buy(Order,Customer) from Buyer to Seller;
- buy(o:Order,c:Customer) from Buyer to Seller;
- buy(Order) from Buyer to Seller;
- buy(ord:Order) from Buyer to Seller;
-}
diff --git a/modules/cli/src/test/resources/scribble/examples/Imports.scr b/modules/cli/src/test/resources/scribble/examples/Imports.scr
deleted file mode 100644
index 5e23ce411..000000000
--- a/modules/cli/src/test/resources/scribble/examples/Imports.scr
+++ /dev/null
@@ -1,6 +0,0 @@
-module scribble.examples.Imports;
-
-import scribble.examples.GMessage;
-
-global protocol ImportsProtocol(role Buyer,role Seller) {
-}
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
deleted file mode 100644
index 82fbcddb9..000000000
--- a/modules/core/pom.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-
- 4.0.0
- scribble-core
- jar
- Scribble::Modules::Core
-
-
- org.scribble
- parent
- 0.4-SNAPSHOT
- ../../pom.xml
-
-
-
-
- junit
- junit
- test
-
-
- org.antlr
- antlr-runtime
-
-
-
-
-
-
- maven-javadoc-plugin
-
-
- generate-javadoc
- package
-
- jar
-
-
-
-
- org.jboss.apiviz.APIviz
-
- org.jboss.apiviz
- apiviz
- 1.2.4.GA
-
- true
- false
-
- -d ${project.build.directory}/javadoc
- -charset UTF-8
- -docencoding UTF-8
- -version
- -author
- -breakiterator
- -windowtitle "${project.name} ${project.version} API Reference"
- -doctitle "${project.name} ${project.version} API Reference"
- -bottom "Copyright © ${project.inceptionYear}-Present ${project.organization.name}. All Rights Reserved."
- -link http://java.sun.com/javase/6/docs/api/
- -sourceclasspath ${project.build.outputDirectory}
-
- UTF-8
- en_US
-
- org.scribble.model
-
-
-
-
-
-
diff --git a/modules/core/src/main/java/org/scribble/ast/AstFactory.java b/modules/core/src/main/java/org/scribble/ast/AstFactory.java
deleted file mode 100644
index fda972e53..000000000
--- a/modules/core/src/main/java/org/scribble/ast/AstFactory.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package org.scribble.ast;
-
-import java.util.List;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.ast.global.GChoice;
-import org.scribble.ast.global.GConnect;
-import org.scribble.ast.global.GContinue;
-import org.scribble.ast.global.GDelegationElem;
-import org.scribble.ast.global.GDisconnect;
-import org.scribble.ast.global.GDo;
-import org.scribble.ast.global.GInteractionNode;
-import org.scribble.ast.global.GInteractionSeq;
-import org.scribble.ast.global.GMessageTransfer;
-import org.scribble.ast.global.GProtocolBlock;
-import org.scribble.ast.global.GProtocolDecl;
-import org.scribble.ast.global.GProtocolDef;
-import org.scribble.ast.global.GProtocolHeader;
-import org.scribble.ast.global.GRecursion;
-import org.scribble.ast.global.GWrap;
-import org.scribble.ast.local.LAccept;
-import org.scribble.ast.local.LChoice;
-import org.scribble.ast.local.LConnect;
-import org.scribble.ast.local.LContinue;
-import org.scribble.ast.local.LDelegationElem;
-import org.scribble.ast.local.LDisconnect;
-import org.scribble.ast.local.LDo;
-import org.scribble.ast.local.LInteractionNode;
-import org.scribble.ast.local.LInteractionSeq;
-import org.scribble.ast.local.LProtocolBlock;
-import org.scribble.ast.local.LProtocolDecl;
-import org.scribble.ast.local.LProtocolDef;
-import org.scribble.ast.local.LProtocolHeader;
-import org.scribble.ast.local.LReceive;
-import org.scribble.ast.local.LRecursion;
-import org.scribble.ast.local.LSend;
-import org.scribble.ast.local.LWrapClient;
-import org.scribble.ast.local.LWrapServer;
-import org.scribble.ast.local.SelfRoleDecl;
-import org.scribble.ast.name.NameNode;
-import org.scribble.ast.name.PayloadElemNameNode;
-import org.scribble.ast.name.qualified.DataTypeNode;
-import org.scribble.ast.name.qualified.GProtocolNameNode;
-import org.scribble.ast.name.qualified.LProtocolNameNode;
-import org.scribble.ast.name.qualified.MessageSigNameNode;
-import org.scribble.ast.name.qualified.ModuleNameNode;
-import org.scribble.ast.name.qualified.QualifiedNameNode;
-import org.scribble.ast.name.simple.AmbigNameNode;
-import org.scribble.ast.name.simple.DummyProjectionRoleNode;
-import org.scribble.ast.name.simple.NonRoleParamNode;
-import org.scribble.ast.name.simple.OpNode;
-import org.scribble.ast.name.simple.RecVarNode;
-import org.scribble.ast.name.simple.RoleNode;
-import org.scribble.sesstype.kind.Kind;
-import org.scribble.sesstype.kind.NonRoleParamKind;
-import org.scribble.sesstype.kind.PayloadTypeKind;
-import org.scribble.sesstype.name.GProtocolName;
-import org.scribble.sesstype.name.Role;
-
-
-public interface AstFactory
-{
- Module Module(CommonTree source, ModuleDecl moddecl, List> imports, List> data, List> protos);
-
- MessageSigNode MessageSigNode(CommonTree source, OpNode op, PayloadElemList payload);
- //PayloadElemList PayloadElemList(List> payloadelems);
- PayloadElemList PayloadElemList(CommonTree source, List> payloadelems);
- //PayloadElem PayloadElem(PayloadElemNameNode name);
- //UnaryPayloadElem DataTypeElem(PayloadElemNameNode name);
- //UnaryPayloadElem UnaryPayloadElem(PayloadElemNameNode> name);
- UnaryPayloadElem UnaryPayloadElem(CommonTree source, PayloadElemNameNode name);
- GDelegationElem GDelegationElem(CommonTree source, GProtocolNameNode name, RoleNode role);
- LDelegationElem LDelegationElem(CommonTree source, LProtocolNameNode name);
-
- ModuleDecl ModuleDecl(CommonTree source, ModuleNameNode fullmodname);
- ImportModule ImportModule(CommonTree source, ModuleNameNode modname, ModuleNameNode alias);
-
- MessageSigNameDecl MessageSigNameDecl(CommonTree source, String schema, String extName, String extSource, MessageSigNameNode name);
- DataTypeDecl DataTypeDecl(CommonTree source, String schema, String extName, String extSource, DataTypeNode name);
-
- GProtocolDecl GProtocolDecl(CommonTree source, List modifiers, GProtocolHeader header, GProtocolDef def);
- GProtocolHeader GProtocolHeader(CommonTree source, GProtocolNameNode name, RoleDeclList roledecls, NonRoleParamDeclList paramdecls);
-
- RoleDeclList RoleDeclList(CommonTree source, List rds);
- RoleDecl RoleDecl(CommonTree source, RoleNode role);
- //ConnectDecl ConnectDecl(CommonTree source, RoleNode src, RoleNode role);
- NonRoleParamDeclList NonRoleParamDeclList(CommonTree source, List> pds);
- NonRoleParamDecl NonRoleParamDecl(CommonTree source, K kind, NonRoleParamNode name);
-
- GProtocolDef GProtocolDef(CommonTree source, GProtocolBlock block);
- GProtocolBlock GProtocolBlock(CommonTree source, GInteractionSeq gis);
- GInteractionSeq GInteractionSeq(CommonTree source, List gis);
-
- GMessageTransfer GMessageTransfer(CommonTree source, RoleNode src, MessageNode msg, List dests);
- GConnect GConnect(CommonTree source, RoleNode src, MessageNode msg, RoleNode dest);
- //GConnect GConnect(CommonTree source, RoleNode src, RoleNode dest);
- GDisconnect GDisconnect(CommonTree source, RoleNode src, RoleNode dest);
- GWrap GWrap(CommonTree source, RoleNode src, RoleNode dest);
- GChoice GChoice(CommonTree source, RoleNode subj, List blocks);
- GRecursion GRecursion(CommonTree source, RecVarNode recvar, GProtocolBlock block);
- GContinue GContinue(CommonTree source, RecVarNode recvar);
- GDo GDo(CommonTree source, RoleArgList roles, NonRoleArgList args, GProtocolNameNode proto);
-
- RoleArgList RoleArgList(CommonTree source, List roles);
- RoleArg RoleArg(CommonTree source, RoleNode role);
- NonRoleArgList NonRoleArgList(CommonTree source, List args);
- NonRoleArg NonRoleArg(CommonTree source, NonRoleArgNode arg);
-
- NameNode SimpleNameNode(CommonTree source, K kind, String identifier);
- QualifiedNameNode QualifiedNameNode(CommonTree source, K kind, String... elems);
-
- AmbigNameNode AmbiguousNameNode(CommonTree source, String identifier);
- NonRoleParamNode NonRoleParamNode(CommonTree source, K kind, String identifier);
- DummyProjectionRoleNode DummyProjectionRoleNode();
-
- LProtocolDecl LProtocolDecl(CommonTree source, List modifiers, LProtocolHeader header, LProtocolDef def);
- LProtocolHeader LProtocolHeader(CommonTree source, LProtocolNameNode name, RoleDeclList roledecls, NonRoleParamDeclList paramdecls);
- SelfRoleDecl SelfRoleDecl(CommonTree source, RoleNode namenode);
- LProtocolDef LProtocolDef(CommonTree source, LProtocolBlock block);
- LProtocolBlock LProtocolBlock(CommonTree source, LInteractionSeq seq);
- LInteractionSeq LInteractionSeq(CommonTree source, List actions);
-
- LSend LSend(CommonTree source, RoleNode src, MessageNode msg, List dests);
- LReceive LReceive(CommonTree source, RoleNode src, MessageNode msg, List dests);
- LConnect LConnect(CommonTree source, RoleNode src, MessageNode msg, RoleNode dest);
- LAccept LAccept(CommonTree source, RoleNode src, MessageNode msg, RoleNode dest);
- /*LConnect LConnect(CommonTree source, RoleNode src, RoleNode dest);
- LAccept LAccept(CommonTree source, RoleNode src, RoleNode dest);*/
- LDisconnect LDisconnect(CommonTree source, RoleNode self, RoleNode peer);
- LWrapClient LWrapClient(CommonTree source, RoleNode self, RoleNode peer);
- LWrapServer LWrapServer(CommonTree source, RoleNode self, RoleNode peer);
- LChoice LChoice(CommonTree source, RoleNode subj, List blocks);
- LRecursion LRecursion(CommonTree source, RecVarNode recvar, LProtocolBlock block);
- LContinue LContinue(CommonTree source, RecVarNode recvar);
- LDo LDo(CommonTree source, RoleArgList roles, NonRoleArgList args, LProtocolNameNode proto);
-
- LProtocolDecl LProjectionDecl(CommonTree source, List modifiers, GProtocolName fullname, Role self, LProtocolHeader header, LProtocolDef def); // del extends that of LProtocolDecl
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/AstFactoryImpl.java b/modules/core/src/main/java/org/scribble/ast/AstFactoryImpl.java
deleted file mode 100644
index 44ca19662..000000000
--- a/modules/core/src/main/java/org/scribble/ast/AstFactoryImpl.java
+++ /dev/null
@@ -1,656 +0,0 @@
-package org.scribble.ast;
-
-import java.util.List;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.ast.global.GChoice;
-import org.scribble.ast.global.GConnect;
-import org.scribble.ast.global.GContinue;
-import org.scribble.ast.global.GDelegationElem;
-import org.scribble.ast.global.GDisconnect;
-import org.scribble.ast.global.GDo;
-import org.scribble.ast.global.GInteractionNode;
-import org.scribble.ast.global.GInteractionSeq;
-import org.scribble.ast.global.GMessageTransfer;
-import org.scribble.ast.global.GProtocolBlock;
-import org.scribble.ast.global.GProtocolDecl;
-import org.scribble.ast.global.GProtocolDef;
-import org.scribble.ast.global.GProtocolHeader;
-import org.scribble.ast.global.GRecursion;
-import org.scribble.ast.global.GWrap;
-import org.scribble.ast.local.LAccept;
-import org.scribble.ast.local.LChoice;
-import org.scribble.ast.local.LConnect;
-import org.scribble.ast.local.LContinue;
-import org.scribble.ast.local.LDelegationElem;
-import org.scribble.ast.local.LDisconnect;
-import org.scribble.ast.local.LDo;
-import org.scribble.ast.local.LInteractionNode;
-import org.scribble.ast.local.LInteractionSeq;
-import org.scribble.ast.local.LProtocolBlock;
-import org.scribble.ast.local.LProtocolDecl;
-import org.scribble.ast.local.LProtocolDef;
-import org.scribble.ast.local.LProtocolHeader;
-import org.scribble.ast.local.LReceive;
-import org.scribble.ast.local.LRecursion;
-import org.scribble.ast.local.LSend;
-import org.scribble.ast.local.LWrapClient;
-import org.scribble.ast.local.LWrapServer;
-import org.scribble.ast.local.SelfRoleDecl;
-import org.scribble.ast.name.NameNode;
-import org.scribble.ast.name.PayloadElemNameNode;
-import org.scribble.ast.name.qualified.DataTypeNode;
-import org.scribble.ast.name.qualified.GProtocolNameNode;
-import org.scribble.ast.name.qualified.LProtocolNameNode;
-import org.scribble.ast.name.qualified.MessageSigNameNode;
-import org.scribble.ast.name.qualified.ModuleNameNode;
-import org.scribble.ast.name.qualified.QualifiedNameNode;
-import org.scribble.ast.name.simple.AmbigNameNode;
-import org.scribble.ast.name.simple.DummyProjectionRoleNode;
-import org.scribble.ast.name.simple.NonRoleParamNode;
-import org.scribble.ast.name.simple.OpNode;
-import org.scribble.ast.name.simple.RecVarNode;
-import org.scribble.ast.name.simple.RoleNode;
-import org.scribble.del.DefaultDel;
-import org.scribble.del.ImportModuleDel;
-import org.scribble.del.ModuleDel;
-import org.scribble.del.NonRoleArgListDel;
-import org.scribble.del.NonRoleParamDeclDel;
-import org.scribble.del.NonRoleParamDeclListDel;
-import org.scribble.del.RoleArgListDel;
-import org.scribble.del.RoleDeclDel;
-import org.scribble.del.RoleDeclListDel;
-import org.scribble.del.ScribDel;
-import org.scribble.del.global.GChoiceDel;
-import org.scribble.del.global.GConnectDel;
-import org.scribble.del.global.GContinueDel;
-import org.scribble.del.global.GDelegationElemDel;
-import org.scribble.del.global.GDisconnectDel;
-import org.scribble.del.global.GDoDel;
-import org.scribble.del.global.GInteractionSeqDel;
-import org.scribble.del.global.GMessageTransferDel;
-import org.scribble.del.global.GProtocolBlockDel;
-import org.scribble.del.global.GProtocolDeclDel;
-import org.scribble.del.global.GProtocolDefDel;
-import org.scribble.del.global.GRecursionDel;
-import org.scribble.del.global.GWrapDel;
-import org.scribble.del.local.LAcceptDel;
-import org.scribble.del.local.LChoiceDel;
-import org.scribble.del.local.LConnectDel;
-import org.scribble.del.local.LContinueDel;
-import org.scribble.del.local.LDisconnectDel;
-import org.scribble.del.local.LDoDel;
-import org.scribble.del.local.LInteractionSeqDel;
-import org.scribble.del.local.LProjectionDeclDel;
-import org.scribble.del.local.LProtocolBlockDel;
-import org.scribble.del.local.LProtocolDeclDel;
-import org.scribble.del.local.LProtocolDefDel;
-import org.scribble.del.local.LReceiveDel;
-import org.scribble.del.local.LRecursionDel;
-import org.scribble.del.local.LSendDel;
-import org.scribble.del.local.LWrapClientDel;
-import org.scribble.del.local.LWrapServerDel;
-import org.scribble.del.name.AmbigNameNodeDel;
-import org.scribble.del.name.DataTypeNodeDel;
-import org.scribble.del.name.MessageSigNameNodeDel;
-import org.scribble.del.name.ParamNodeDel;
-import org.scribble.del.name.RecVarNodeDel;
-import org.scribble.del.name.RoleNodeDel;
-import org.scribble.sesstype.kind.DataTypeKind;
-import org.scribble.sesstype.kind.Global;
-import org.scribble.sesstype.kind.Kind;
-import org.scribble.sesstype.kind.Local;
-import org.scribble.sesstype.kind.ModuleKind;
-import org.scribble.sesstype.kind.NonRoleParamKind;
-import org.scribble.sesstype.kind.OpKind;
-import org.scribble.sesstype.kind.PayloadTypeKind;
-import org.scribble.sesstype.kind.RecVarKind;
-import org.scribble.sesstype.kind.RoleKind;
-import org.scribble.sesstype.kind.SigKind;
-import org.scribble.sesstype.name.GProtocolName;
-import org.scribble.sesstype.name.Role;
-
-
-public class AstFactoryImpl implements AstFactory
-{
- public static final AstFactory FACTORY = new AstFactoryImpl();
-
- @Override
- public MessageSigNode MessageSigNode(CommonTree source, OpNode op, PayloadElemList payload)
- {
- MessageSigNode msn = new MessageSigNode(source, op, payload);
- msn = del(msn, createDefaultDelegate());
- return msn;
- }
-
- @Override
- //public PayloadElemList PayloadElemList(List payloadelems)
- public PayloadElemList PayloadElemList(CommonTree source, List> payloadelems)
- {
- PayloadElemList p = new PayloadElemList(source, payloadelems);
- p = del(p, createDefaultDelegate());
- return p;
- }
-
- /*@Override
- public PayloadElem PayloadElem(PayloadElemNameNode name)
- {
- PayloadElem pe = new PayloadElem(name);
- pe = del(pe, createDefaultDelegate());
- return pe;
- }*/
-
- @Override
- //public UnaryPayloadElem DataTypeElem(PayloadElemNameNode name)
- //public UnaryPayloadElem UnaryPayloadElem(PayloadElemNameNode> name)
- public UnaryPayloadElem UnaryPayloadElem(CommonTree source, PayloadElemNameNode name)
- {
- UnaryPayloadElem de= new UnaryPayloadElem<>(source, name);
- de = del(de, createDefaultDelegate());
- return de;
- }
-
- @Override
- public GDelegationElem GDelegationElem(CommonTree source, GProtocolNameNode proto, RoleNode role)
- {
- GDelegationElem de = new GDelegationElem(source, proto, role);
- //de = del(de, createDefaultDelegate());
- de = del(de, new GDelegationElemDel()); // FIXME: GDelegationElemDel
- return de;
- }
-
- @Override
- public LDelegationElem LDelegationElem(CommonTree source, LProtocolNameNode proto)
- {
- LDelegationElem de = new LDelegationElem(source, proto);
- de = del(de, createDefaultDelegate());
- return de;
- }
-
- @Override
- public Module Module(CommonTree source, ModuleDecl moddecl, List> imports, List> data, List> protos)
- {
- Module module = new Module(source, moddecl, imports, data, protos);
- module = del(module, new ModuleDel());
- return module;
- }
-
- @Override
- public ModuleDecl ModuleDecl(CommonTree source, ModuleNameNode fullmodname)
- {
- ModuleDecl md = new ModuleDecl(source, fullmodname);
- md = del(md, createDefaultDelegate());
- return md;
- }
-
- @Override
- public ImportModule ImportModule(CommonTree source, ModuleNameNode modname, ModuleNameNode alias)
- {
- ImportModule im = new ImportModule(source, modname, alias);
- im = del(im, new ImportModuleDel());
- return im;
- }
-
- @Override
- public MessageSigNameDecl MessageSigNameDecl(CommonTree source, String schema, String extName, String extSource, MessageSigNameNode alias)
- {
- MessageSigNameDecl msd = new MessageSigNameDecl(source, schema, extName, extSource, alias);
- msd = del(msd, createDefaultDelegate());
- return msd;
- }
-
- @Override
- public DataTypeDecl DataTypeDecl(CommonTree source, String schema, String extName, String extSource, DataTypeNode alias)
- {
- DataTypeDecl dtd = new DataTypeDecl(source, schema, extName, extSource, alias);
- dtd = del(dtd, createDefaultDelegate());
- return dtd;
- }
-
- @Override
- public GProtocolDecl GProtocolDecl(CommonTree source, List modifiers, GProtocolHeader header, GProtocolDef def)
- {
- GProtocolDecl gpd = new GProtocolDecl(source, modifiers, header, def);
- gpd = del(gpd, new GProtocolDeclDel());
- return gpd;
- }
-
- @Override
- public GProtocolHeader GProtocolHeader(CommonTree source, GProtocolNameNode name, RoleDeclList roledecls, NonRoleParamDeclList paramdecls)
- {
- GProtocolHeader gph = new GProtocolHeader(source, name, roledecls, paramdecls);
- gph = del(gph, createDefaultDelegate());
- return gph;
- }
-
- @Override
- public RoleDeclList RoleDeclList(CommonTree source, List rds)
- {
- RoleDeclList rdl = new RoleDeclList(source, rds);
- rdl = del(rdl, new RoleDeclListDel());
- return rdl;
- }
-
- @Override
- public RoleDecl RoleDecl(CommonTree source, RoleNode namenode)
- {
- RoleDecl rd = new RoleDecl(source, namenode);
- rd = del(rd, new RoleDeclDel());
- return rd;
- }
-
- /*@Override
- public ConnectDecl ConnectDecl(RoleNode src, RoleNode role)
- {
- ConnectDecl cd = new ConnectDecl(src, role);
- cd = del(cd, new ConnectDeclDel());
- return cd;
- }*/
-
- @Override
- public NonRoleParamDeclList NonRoleParamDeclList(CommonTree source, List> pds)
- {
- NonRoleParamDeclList pdl = new NonRoleParamDeclList(source, pds);
- pdl = del(pdl, new NonRoleParamDeclListDel());
- return pdl;
- }
-
- @Override
- public NonRoleParamDecl NonRoleParamDecl(CommonTree source, K kind, NonRoleParamNode namenode)
- {
- NonRoleParamDecl pd = new NonRoleParamDecl(source, kind, namenode);
- pd = del(pd, new NonRoleParamDeclDel());
- return pd;
- }
-
- @Override
- public GProtocolDef GProtocolDef(CommonTree source, GProtocolBlock block)
- {
- GProtocolDef gpd = new GProtocolDef(source, block);
- gpd = del(gpd, new GProtocolDefDel());
- return gpd;
- }
-
- @Override
- public GProtocolBlock GProtocolBlock(CommonTree source, GInteractionSeq seq)
- {
- GProtocolBlock gpb = new GProtocolBlock(source, seq);
- gpb = del(gpb, new GProtocolBlockDel());
- return gpb;
- }
-
- @Override
- public GInteractionSeq GInteractionSeq(CommonTree source, List actions)
- {
- GInteractionSeq gis = new GInteractionSeq(source, actions);
- gis = del(gis, new GInteractionSeqDel());
- return gis;
- }
-
- @Override
- public GMessageTransfer GMessageTransfer(CommonTree source, RoleNode src, MessageNode msg, List dests)
- {
- GMessageTransfer gmt = new GMessageTransfer(source, src, msg, dests);
- gmt = del(gmt, new GMessageTransferDel());
- return gmt;
- }
-
- @Override
- public GConnect GConnect(CommonTree source, RoleNode src, MessageNode msg, RoleNode dest)
- //public GConnect GConnect(RoleNode src, RoleNode dest)
- {
- GConnect gc = new GConnect(source, src, msg, dest);
- //GConnect gc = new GConnect(src, dest);
- gc = del(gc, new GConnectDel());
- return gc;
- }
-
- @Override
- public GDisconnect GDisconnect(CommonTree source, RoleNode src, RoleNode dest)
- {
- GDisconnect gc = new GDisconnect(source, src, dest);
- gc = del(gc, new GDisconnectDel());
- return gc;
- }
-
- @Override
- public GWrap GWrap(CommonTree source, RoleNode src, RoleNode dest)
- {
- GWrap gw = new GWrap(source, src, dest);
- gw = del(gw, new GWrapDel());
- return gw;
- }
-
- @Override
- public GChoice GChoice(CommonTree source, RoleNode subj, List blocks)
- {
- GChoice gc = new GChoice(source, subj, blocks);
- gc = del(gc, new GChoiceDel());
- return gc;
- }
-
- @Override
- public GRecursion GRecursion(CommonTree source, RecVarNode recvar, GProtocolBlock block)
- {
- GRecursion gr = new GRecursion(source, recvar, block);
- gr = del(gr, new GRecursionDel());
- return gr;
- }
-
- @Override
- public GContinue GContinue(CommonTree source, RecVarNode recvar)
- {
- GContinue gc = new GContinue(source, recvar);
- gc = del(gc, new GContinueDel());
- return gc;
- }
-
- @Override
- public GDo GDo(CommonTree source, RoleArgList roleinstans, NonRoleArgList arginstans, GProtocolNameNode proto)
- {
- GDo gd = new GDo(source, roleinstans, arginstans, proto);
- gd = del(gd, new GDoDel());
- return gd;
- }
-
- @Override
- public RoleArgList RoleArgList(CommonTree source, List ris)
- {
- RoleArgList rdl = new RoleArgList(source, ris);
- rdl = del(rdl, new RoleArgListDel());
- return rdl;
- }
-
- @Override
- public RoleArg RoleArg(CommonTree source, RoleNode role)
- {
- RoleArg ri = new RoleArg(source, role);
- ri = del(ri, createDefaultDelegate());
- return ri;
- }
-
- @Override
- public NonRoleArgList NonRoleArgList(CommonTree source, List ais)
- {
- NonRoleArgList rdl = new NonRoleArgList(source, ais);
- rdl = del(rdl, new NonRoleArgListDel());
- return rdl;
- }
-
- @Override
- public NonRoleArg NonRoleArg(CommonTree source, NonRoleArgNode arg)
- {
- NonRoleArg ri = new NonRoleArg(source, arg);
- ri = del(ri, createDefaultDelegate());
- return ri;
- }
-
- @Override
- public NameNode SimpleNameNode(CommonTree source, K kind, String identifier)
- {
- NameNode extends Kind> snn = null;
- if (kind.equals(RecVarKind.KIND))
- {
- snn = new RecVarNode(source, identifier);
- snn = del(snn, new RecVarNodeDel());
- }
- else if (kind.equals(RoleKind.KIND))
- {
- snn = new RoleNode(source, identifier);
- snn = del(snn, new RoleNodeDel());
- }
- if (snn != null)
- {
- return castNameNode(kind, snn);
- }
-
- if (kind.equals(OpKind.KIND))
- {
- snn = new OpNode(source, identifier);
- }
- else
- {
- throw new RuntimeException("Shouldn't get in here: " + kind);
- }
- return castNameNode(kind, del(snn, createDefaultDelegate()));
- }
-
- @Override
- public QualifiedNameNode QualifiedNameNode(CommonTree source, K kind, String... elems)
- {
- QualifiedNameNode extends Kind> qnn = null;
- if (kind.equals(SigKind.KIND))
- {
- qnn = new MessageSigNameNode(source, elems);
- qnn = del(qnn, new MessageSigNameNodeDel());
- }
- else if (kind.equals(DataTypeKind.KIND))
- {
- qnn = new DataTypeNode(source, elems);
- qnn = del(qnn, new DataTypeNodeDel());
- }
- if (qnn != null)
- {
- return castNameNode(kind, qnn);
- }
-
- if (kind.equals(ModuleKind.KIND))
- {
- qnn = new ModuleNameNode(source, elems);
- }
- else if (kind.equals(Global.KIND))
- {
- qnn = new GProtocolNameNode(source, elems);
- }
- else if (kind.equals(Local.KIND))
- {
- qnn = new LProtocolNameNode(source,elems);
- }
- else
- {
- throw new RuntimeException("Shouldn't get in here: " + kind);
- }
- return castNameNode(kind, del(qnn, createDefaultDelegate()));
- }
-
- private static , K extends Kind> T castNameNode(K kind, NameNode extends Kind> n)
- {
- if (!n.toName().getKind().equals(kind))
- {
- throw new RuntimeException("Shouldn't get in here: " + kind + ", " + n);
- }
- @SuppressWarnings("unchecked")
- T tmp = (T) n;
- return tmp;
- }
-
- @Override
- public AmbigNameNode AmbiguousNameNode(CommonTree source, String identifier)
- {
- AmbigNameNode ann = new AmbigNameNode(source, identifier);
- ann = (AmbigNameNode) ann.del(new AmbigNameNodeDel());
- return ann;
- }
-
- @Override
- public NonRoleParamNode NonRoleParamNode(CommonTree source, K kind, String identifier)
- {
- NonRoleParamNode pn = new NonRoleParamNode(source, kind, identifier);
- pn = del(pn, new ParamNodeDel());
- return pn;
- }
-
- @Override
- public DummyProjectionRoleNode DummyProjectionRoleNode()
- {
- DummyProjectionRoleNode dprn = new DummyProjectionRoleNode();
- dprn = (DummyProjectionRoleNode) dprn.del(createDefaultDelegate());
- return dprn;
- }
-
- @Override
- public LProtocolDecl LProtocolDecl(CommonTree source, List modifiers, LProtocolHeader header, LProtocolDef def)
- {
- LProtocolDecl lpd = new LProtocolDecl(source, modifiers, header, def);
- lpd = del(lpd, new LProtocolDeclDel());
- return lpd;
- }
-
- @Override
- public LProtocolHeader LProtocolHeader(CommonTree source, LProtocolNameNode name, RoleDeclList roledecls, NonRoleParamDeclList paramdecls)
- {
- LProtocolHeader lph = new LProtocolHeader(source, name, roledecls, paramdecls);
- lph = del(lph, createDefaultDelegate());
- return lph;
- }
-
- @Override
- public SelfRoleDecl SelfRoleDecl(CommonTree source, RoleNode namenode)
- {
- SelfRoleDecl rd = new SelfRoleDecl(source, namenode);
- rd = del(rd, new RoleDeclDel());
- return rd;
- }
-
- @Override
- public LProtocolDef LProtocolDef(CommonTree source, LProtocolBlock block)
- {
- LProtocolDef lpd = new LProtocolDef(source, block);
- lpd = del(lpd, new LProtocolDefDel());
- return lpd;
- }
-
- @Override
- public LProtocolBlock LProtocolBlock(CommonTree source, LInteractionSeq seq)
- {
- LProtocolBlock lpb = new LProtocolBlock(source, seq);
- lpb = del(lpb, new LProtocolBlockDel());
- return lpb;
- }
-
- @Override
- public LInteractionSeq LInteractionSeq(CommonTree source, List actions)
- {
- LInteractionSeq lis = new LInteractionSeq(source, actions);
- lis = del(lis, new LInteractionSeqDel());
- return lis;
- }
-
- @Override
- public LSend LSend(CommonTree source, RoleNode src, MessageNode msg, List dests)
- {
- LSend ls = new LSend(source, src, msg, dests);
- ls = del(ls, new LSendDel());
- return ls;
- }
-
- @Override
- public LReceive LReceive(CommonTree source, RoleNode src, MessageNode msg, List dests)
- {
- LReceive ls = new LReceive(source, src, msg, dests);
- ls = del(ls, new LReceiveDel());
- return ls;
- }
-
- @Override
- public LConnect LConnect(CommonTree source, RoleNode src, MessageNode msg, RoleNode dest)
- //public LConnect LConnect(RoleNode src, RoleNode dest)
- {
- LConnect lc = new LConnect(source, src, msg, dest);
- //LConnect lc = new LConnect(src, dest);
- lc = del(lc, new LConnectDel());
- return lc;
- }
-
- @Override
- public LAccept LAccept(CommonTree source, RoleNode src, MessageNode msg, RoleNode dest)
- //public LAccept LAccept(RoleNode src, RoleNode dest)
- {
- LAccept la = new LAccept(source, src, msg, dest);
- //LAccept la = new LAccept(src, dest);
- la = del(la, new LAcceptDel());
- return la;
- }
-
- @Override
- public LDisconnect LDisconnect(CommonTree source, RoleNode self, RoleNode peer)
- {
- LDisconnect lc = new LDisconnect(source, self, peer);
- lc = del(lc, new LDisconnectDel());
- return lc;
- }
-
- @Override
- public LWrapClient LWrapClient(CommonTree source, RoleNode self, RoleNode peer)
- {
- LWrapClient lwc = new LWrapClient(source, self, peer);
- lwc = del(lwc, new LWrapClientDel());
- return lwc;
- }
-
- @Override
- public LWrapServer LWrapServer(CommonTree source, RoleNode self, RoleNode peer)
- {
- LWrapServer lws = new LWrapServer(source, self, peer);
- lws = del(lws, new LWrapServerDel());
- return lws;
- }
-
- @Override
- public LChoice LChoice(CommonTree source, RoleNode subj, List blocks)
- {
- LChoice lc = new LChoice(source, subj, blocks);
- lc = del(lc, new LChoiceDel());
- return lc;
- }
-
- @Override
- public LRecursion LRecursion(CommonTree source, RecVarNode recvar, LProtocolBlock block)
- {
- LRecursion lr = new LRecursion(source, recvar, block);
- lr = del(lr, new LRecursionDel());
- return lr;
- }
-
- @Override
- public LContinue LContinue(CommonTree source, RecVarNode recvar)
- {
- LContinue lc = new LContinue(source, recvar);
- lc = del(lc, new LContinueDel());
- return lc;
- }
-
- @Override
- public LDo LDo(CommonTree source, RoleArgList roleinstans, NonRoleArgList arginstans, LProtocolNameNode proto)
- {
- LDo ld = new LDo(source, roleinstans, arginstans, proto);
- ld = del(ld, new LDoDel());
- return ld;
- }
-
- private ScribDel createDefaultDelegate()
- {
- return new DefaultDel();
- }
-
- // FIXME: factor out
- //@SuppressWarnings("unchecked")
- private static T del(T n, ScribDel del)
- {
- /*ScribNodeBase ret = n.del(del); // FIXME: del makes another shallow copy of n
- if (ret.getClass() != n.getClass())
- {
- throw new RuntimeException("Shouldn't get in here: " + ret.getClass() + ", " + n.getClass());
- }
- return (T) ret;*/
- return ScribNodeBase.del(n, del);
- }
-
- @Override
- public LProtocolDecl LProjectionDecl(CommonTree source, List modifiers, GProtocolName fullname, Role self, LProtocolHeader header, LProtocolDef def) // del extends that of LProtocolDecl
- {
- LProtocolDecl lpd = new LProtocolDecl(source, modifiers, header, def);
- lpd = ScribNodeBase.del(lpd, new LProjectionDeclDel(fullname, self));
- return lpd;
- }
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/Choice.java b/modules/core/src/main/java/org/scribble/ast/Choice.java
deleted file mode 100644
index 7ab5967c3..000000000
--- a/modules/core/src/main/java/org/scribble/ast/Choice.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.scribble.ast;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.ast.name.simple.RoleNode;
-import org.scribble.main.ScribbleException;
-import org.scribble.sesstype.kind.ProtocolKind;
-import org.scribble.visit.AstVisitor;
-
-public abstract class Choice extends CompoundInteractionNode
-{
- public final RoleNode subj;
- private final List extends ProtocolBlock> blocks;
- // Factor up? And specialise to singleton for Recursion/Interruptible? Maybe too artificial -- could separate unaryblocked and multiblocked compound ops?
-
- protected Choice(CommonTree source, RoleNode subj, List extends ProtocolBlock> blocks)
- {
- super(source);
- this.subj = subj;
- this.blocks = new LinkedList<>(blocks);
- }
-
- public abstract Choice reconstruct(RoleNode subj, List extends ProtocolBlock> blocks);
-
- @Override
- public Choice visitChildren(AstVisitor nv) throws ScribbleException
- {
- RoleNode subj = (RoleNode) visitChild(this.subj, nv);
- List extends ProtocolBlock> blocks = visitChildListWithClassEqualityCheck(this, this.blocks, nv);
- return reconstruct(subj, blocks);
- }
-
- public List extends ProtocolBlock> getBlocks()
- {
- return Collections.unmodifiableList(this.blocks);
- }
-
- @Override
- public String toString()
- {
- String sep = " " + Constants.OR_KW + " ";
- return Constants.CHOICE_KW + " " + Constants.AT_KW + " " + this.subj + " "
- + this.blocks.stream().map((b) -> b.toString()).collect(Collectors.joining(sep));
- }
-
- /*@Override
- public Map getEnablingMessages()
- {
-
- }*/
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/CompoundInteraction.java b/modules/core/src/main/java/org/scribble/ast/CompoundInteraction.java
deleted file mode 100644
index 079577a21..000000000
--- a/modules/core/src/main/java/org/scribble/ast/CompoundInteraction.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.scribble.ast;
-
-import org.antlr.runtime.tree.CommonTree;
-
-// ProtocolBlock or CompoundInteractionNode
-public abstract class CompoundInteraction extends ScribNodeBase
-{
- public CompoundInteraction(CommonTree source)
- {
- super(source);
- }
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/CompoundInteractionNode.java b/modules/core/src/main/java/org/scribble/ast/CompoundInteractionNode.java
deleted file mode 100644
index 9bdf0fd96..000000000
--- a/modules/core/src/main/java/org/scribble/ast/CompoundInteractionNode.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.scribble.ast;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.sesstype.kind.ProtocolKind;
-
-// Name should be read (Compound ( InteractionNode ))
-public abstract class CompoundInteractionNode
- extends CompoundInteraction implements InteractionNode
-{
- protected CompoundInteractionNode(CommonTree source)
- {
- super(source);
- }
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/ConnectionAction.java b/modules/core/src/main/java/org/scribble/ast/ConnectionAction.java
deleted file mode 100644
index 51fe14aac..000000000
--- a/modules/core/src/main/java/org/scribble/ast/ConnectionAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.scribble.ast;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.ast.name.simple.RoleNode;
-import org.scribble.main.ScribbleException;
-import org.scribble.sesstype.kind.ProtocolKind;
-import org.scribble.visit.AstVisitor;
-
-// FIXME: factor with MessageTransfer
-public abstract class ConnectionAction extends SimpleInteractionNode
-{
- public final RoleNode src;
- public final MessageNode msg;
- public final RoleNode dest;
-
- protected ConnectionAction(CommonTree source, RoleNode src, MessageNode msg, RoleNode dest)
- //protected ConnectionAction(RoleNode src, RoleNode dest)
- {
- super(source);
- this.src = src;
- this.msg = msg;
- this.dest = dest;
- }
-
- public abstract ConnectionAction reconstruct(RoleNode src, MessageNode msg, RoleNode dest);
- //public abstract ConnectionAction reconstruct(RoleNode src, RoleNode dest);
-
- @Override
- public ConnectionAction visitChildren(AstVisitor nv) throws ScribbleException
- {
- RoleNode src = (RoleNode) visitChild(this.src, nv);
- MessageNode msg = (MessageNode) visitChild(this.msg, nv);
- RoleNode dest = (RoleNode) visitChild(this.dest, nv);
- return reconstruct(src, msg, dest);
- //return reconstruct(src, dest);
- }
-
- @Override
- public abstract String toString();
-
- protected boolean isUnitMessage()
- {
- if (!this.msg.isMessageSigNode())
- {
- return false;
- }
- MessageSigNode msn = (MessageSigNode) this.msg;
- return msn.op.isEmpty() && msn.payloads.isEmpty();
- }
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/Constants.java b/modules/core/src/main/java/org/scribble/ast/Constants.java
deleted file mode 100644
index cc5a9348d..000000000
--- a/modules/core/src/main/java/org/scribble/ast/Constants.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.scribble.ast;
-
-
-// FIXME: cannot use AntlrConstants from org.scribble.parser due to Maven dependency restrictions
-public class Constants
-{
- public static final String SCRIBBLE_FILE_EXTENSION = "scr";
-
- // Duplicated from AntlrConstants due to Maven dependency restrictions
- public static final String MODULE_KW = "module";
- public static final String IMPORT_KW = "import";
- public static final String TYPE_KW = "type";
- public static final String PROTOCOL_KW = "protocol";
- public static final String GLOBAL_KW = "global";
- public static final String LOCAL_KW = "local";
- public static final String ROLE_KW = "role";
- public static final String ACCEPT_KW = "accept";
- public static final String SELF_KW = "self";
- public static final String SIG_KW = "sig";
- public static final String INSTANTIATES_KW = "instantiates";
-
- public static final String CONNECT_KW = "connect";
- public static final String DISCONNECT_KW = "disconnect";
- public static final String WRAP_KW = "wrap";
- public static final String FROM_KW = "from";
- public static final String TO_KW = "to";
- public static final String CHOICE_KW = "choice";
- public static final String AT_KW = "at";
- public static final String OR_KW = "or";
- public static final String REC_KW = "rec";
- public static final String CONTINUE_KW = "continue";
- public static final String PAR_KW = "par";
- public static final String AND_KW = "and";
- public static final String INTERRUPTIBLE_KW = "interruptible";
- public static final String WITH_KW = "with";
- public static final String BY_KW = "by";
- public static final String DO_KW = "do";
- public static final String AS_KW = "as";
- public static final String SPAWN_KW = "spawn";
- public static final String THROWS_KW = "throws";
- public static final String CATCHES_KW = "catches";
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/Continue.java b/modules/core/src/main/java/org/scribble/ast/Continue.java
deleted file mode 100644
index 16c169dd3..000000000
--- a/modules/core/src/main/java/org/scribble/ast/Continue.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.scribble.ast;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.ast.name.simple.RecVarNode;
-import org.scribble.main.ScribbleException;
-import org.scribble.sesstype.kind.ProtocolKind;
-import org.scribble.visit.AstVisitor;
-
-public abstract class Continue extends SimpleInteractionNode
-{
- public final RecVarNode recvar;
-
- protected Continue(CommonTree source, RecVarNode recvar)
- {
- super(source);
- this.recvar = recvar;
- }
-
- public abstract Continue reconstruct(RecVarNode recvar);
-
- @Override
- public Continue visitChildren(AstVisitor nv) throws ScribbleException
- {
- RecVarNode recvar = (RecVarNode) visitChild(this.recvar, nv);
- return reconstruct(recvar);
- }
-
- @Override
- public String toString()
- {
- return Constants.CONTINUE_KW + " " + this.recvar + ";";
- }
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/DataTypeDecl.java b/modules/core/src/main/java/org/scribble/ast/DataTypeDecl.java
deleted file mode 100644
index 465f307da..000000000
--- a/modules/core/src/main/java/org/scribble/ast/DataTypeDecl.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.scribble.ast;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.ast.name.qualified.DataTypeNode;
-import org.scribble.ast.name.qualified.MemberNameNode;
-import org.scribble.del.ScribDel;
-import org.scribble.sesstype.kind.DataTypeKind;
-import org.scribble.sesstype.name.DataType;
-import org.scribble.sesstype.name.ModuleName;
-
-public class DataTypeDecl extends NonProtocolDecl
-{
- public DataTypeDecl(CommonTree source, String schema, String extName, String extSource, DataTypeNode name)
- {
- super(source, schema, extName, extSource, name);
- }
-
- @Override
- protected ScribNodeBase copy()
- {
- return new DataTypeDecl(this.source, this.schema, this.extName, this.extSource, getNameNode());
- }
-
- @Override
- public DataTypeDecl clone()
- {
- DataTypeNode name = (DataTypeNode) this.name.clone();
- return AstFactoryImpl.FACTORY.DataTypeDecl(this.source, this.schema, this.extName, this.extSource, name);
- }
-
- @Override
- public DataTypeDecl reconstruct(String schema, String extName, String extSource, MemberNameNode name)
- {
- ScribDel del = del();
- DataTypeDecl dtd = new DataTypeDecl(this.source, schema, extName, extSource, (DataTypeNode) name);
- dtd = (DataTypeDecl) dtd.del(del);
- return dtd;
- }
-
- @Override
- public boolean isDataTypeDecl()
- {
- return true;
- }
-
- @Override
- public DataTypeNode getNameNode()
- {
- return (DataTypeNode) super.getNameNode();
- }
-
- @Override
- public DataType getDeclName()
- {
- return (DataType) super.getDeclName();
- }
-
- @Override
- public DataType getFullMemberName(Module mod)
- {
- ModuleName fullmodname = mod.getFullModuleName();
- return new DataType(fullmodname, getDeclName());
- }
-
- @Override
- public String toString()
- {
- return Constants.TYPE_KW + " <" + this.schema + "> " + this.extName
- + " " + Constants.FROM_KW + " " + this.extSource + " "
- + Constants.AS_KW + " " + this.name + ";";
- }
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/Do.java b/modules/core/src/main/java/org/scribble/ast/Do.java
deleted file mode 100644
index f8b02e31c..000000000
--- a/modules/core/src/main/java/org/scribble/ast/Do.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.scribble.ast;
-
-import java.util.Iterator;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.ast.context.ModuleContext;
-import org.scribble.ast.name.qualified.ProtocolNameNode;
-import org.scribble.main.JobContext;
-import org.scribble.main.ScribbleException;
-import org.scribble.sesstype.kind.ProtocolKind;
-import org.scribble.sesstype.name.ProtocolName;
-import org.scribble.sesstype.name.Role;
-import org.scribble.visit.AstVisitor;
-
-public abstract class Do extends SimpleInteractionNode //implements ScopedNode
-{
- //public final ScopeNode scope;
- public final RoleArgList roles;
- public final NonRoleArgList args;
- public final ProtocolNameNode proto; // Maybe use an "Ambiguous" version until names resolved -- is a visible protocol, but not necessarily a simple or full member name
-
- protected Do(CommonTree source, RoleArgList roleinstans, NonRoleArgList arginstans, ProtocolNameNode proto)
- {
- super(source);
- //this.scope = scope;
- this.roles = roleinstans;
- this.args = arginstans;
- this.proto = proto;
- }
-
- public abstract Do reconstruct(RoleArgList roleinstans, NonRoleArgList arginstans, ProtocolNameNode proto);
-
- public abstract ProtocolNameNode getProtocolNameNode();
-
- @Override
- public Do visitChildren(AstVisitor nv) throws ScribbleException
- {
- //ScopeNode scope = isScoped() ? (ScopeNode) visitChild(this.scope, nv) : null;
- RoleArgList ril = (RoleArgList) visitChild(this.roles, nv);
- NonRoleArgList al = (NonRoleArgList) visitChild(this.args, nv);
- ProtocolNameNode proto = visitChildWithClassEqualityCheck(this, this.proto, nv);
- return reconstruct(ril, al, proto);
- }
-
- // FIXME: mcontext now redundant because NameDisambiguator converts all targets to full names
- // To get full name from original target name, use mcontext visible names (e.g. in or before name disambiguation pass)
- // This is still useful for subclass casting to G/LProtocolName
- public ProtocolName getTargetProtocolDeclFullName(ModuleContext mcontext)
- {
- //return mcontext.checkProtocolDeclDependencyFullName(this.proto.toName());
- return this.proto.toName(); // Pre: use after name disambiguation (maybe drop FullName suffix)
- }
-
- // mcontext redundant because redundant for getTargetProtocolDeclFullName
- public ProtocolDecl getTargetProtocolDecl(JobContext jcontext, ModuleContext mcontext)
- {
- ProtocolName fullname = getTargetProtocolDeclFullName(mcontext);
- return jcontext.getModule(fullname.getPrefix()).getProtocolDecl(fullname.getSimpleName());
- }
-
- public Role getTargetRoleParameter(JobContext jcontext, ModuleContext mcontext, Role role)
- {
- Iterator args = this.roles.getRoles().iterator();
- Iterator params = getTargetProtocolDecl(jcontext, mcontext).header.roledecls.getRoles().iterator();
- while (args.hasNext())
- {
- Role arg = args.next();
- Role param = params.next();
- if (arg.equals(role))
- {
- return param;
- }
- }
- throw new RuntimeException("Not an argument role: " + role);
- }
-
- /*@Override
- public boolean isEmptyScope()
- {
- return this.scope == null;
- }
-
- @Override
- //public Scope getScope()
- public SimpleName getScopeElement()
- {
- return this.scope.toName();
- }
-
- public boolean isScoped()
- {
- return this.scope != null;
- }*/
-
- @Override
- public String toString()
- {
- String s = Constants.DO_KW + " ";
- //if (!hasEmptyScopeNode())
- /*if (isScoped())
- {
- s += this.scope + ":";
- }*/
- return s + this.proto + this.args + this.roles + ";";
- }
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/DoArg.java b/modules/core/src/main/java/org/scribble/ast/DoArg.java
deleted file mode 100644
index 995f183f9..000000000
--- a/modules/core/src/main/java/org/scribble/ast/DoArg.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.scribble.ast;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.main.ScribbleException;
-import org.scribble.sesstype.name.Role;
-import org.scribble.visit.AstVisitor;
-
-// Cf. NameDeclNode/HeaderParameterDecl, i.e. wrappers for param names/arg values
-// Simpler than NameDeclNode, doesn't constrain node-type correspondence for names
-public abstract class DoArg extends ScribNodeBase
-{
- public final T val;
-
- protected DoArg(CommonTree source, T arg)
- {
- super(source);
- this.val = arg;
- }
-
- public abstract DoArg reconstruct(T arg);
-
- @Override
- public DoArg visitChildren(AstVisitor nv) throws ScribbleException
- {
- ScribNode visited = visitChild(this.val, nv); // Disambiguation will replace AmbiguousNameNodes*/
- if (!(visited instanceof DoArgNode))
- {
- throw new RuntimeException("Shouldn't get in here: " + visited);
- }
- @SuppressWarnings("unchecked")
- T arg = (T) visited;
- return reconstruct(arg);
- }
-
- public T getVal()
- {
- return this.val;
- }
-
- public abstract DoArg project(Role self);
-
- @Override
- public String toString()
- {
- return this.val.toString();
- }
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/DoArgList.java b/modules/core/src/main/java/org/scribble/ast/DoArgList.java
deleted file mode 100644
index 20d601ca4..000000000
--- a/modules/core/src/main/java/org/scribble/ast/DoArgList.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.scribble.ast;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.main.ScribbleException;
-import org.scribble.sesstype.name.Role;
-import org.scribble.visit.AstVisitor;
-
-// Cf. HeaderParameterDeclList -- but not kinded, because cannot determine Arg kind directly from node syntax itself (kinding for ModelNodes is to supplement syntactic information, not "typing" work)
-// DoArgList (NonRoleArgList) can be of mixed kinds, so DoArg (NonRoleArg) used as "wildcard" wrapper
-// "? extends InstantiationNode" not enforced here (e.g. can put "? extends ModelNode"), because ultimately any instantiation of this class needs an actual instance of "Instantiation" which has to have a parameter that extends "InstantiationNode"
-public abstract class DoArgList> extends ScribNodeBase
-{
- private final List args;
-
- public DoArgList(CommonTree source, List is)
- {
- super(source);
- this.args = new LinkedList<>(is);
- }
-
- public abstract DoArgList reconstruct(List instans);
-
- public abstract DoArgList project(Role self);
-
- @Override
- public DoArgList visitChildren(AstVisitor nv) throws ScribbleException
- {
- List nds = visitChildListWithClassEqualityCheck(this, this.args, nv);
- return reconstruct(nds);
- }
-
- public List getDoArgs()
- {
- return Collections.unmodifiableList(this.args);
- }
-
- public int length()
- {
- return this.args.size();
- }
-
- // Like HeaderParamDeclList, without enclosing braces -- added by subclasses
- @Override
- public String toString()
- {
- return this.args.stream().map((a) -> a.toString()).collect(Collectors.joining(", "));
- }
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/DoArgNode.java b/modules/core/src/main/java/org/scribble/ast/DoArgNode.java
deleted file mode 100644
index ce9e92a40..000000000
--- a/modules/core/src/main/java/org/scribble/ast/DoArgNode.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.scribble.ast;
-
-// DoArgNode for DoArg is "dual" to (Simple)NameNode for HeaderParamDecls -- but do args are not all necessarily e.g. simplenames so have to introduce a new interface
-// RoleNodes and NonRoleArgNodes
-public interface DoArgNode extends ScribNode
-{
-
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/HeaderParamDecl.java b/modules/core/src/main/java/org/scribble/ast/HeaderParamDecl.java
deleted file mode 100644
index c7ff70c48..000000000
--- a/modules/core/src/main/java/org/scribble/ast/HeaderParamDecl.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.scribble.ast;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.ast.name.simple.SimpleNameNode;
-import org.scribble.main.ScribbleException;
-import org.scribble.sesstype.kind.ParamKind;
-import org.scribble.sesstype.name.Role;
-import org.scribble.visit.AstVisitor;
-
-// Names that are declared in a protocol header (roles and parameters -- not the protocol name though)
-// RoleKind or (NonRole)ParamKind
-public abstract class HeaderParamDecl extends NameDeclNode
-{
- protected HeaderParamDecl(CommonTree source, SimpleNameNode name)
- {
- super(source, name);
- }
-
- public abstract HeaderParamDecl reconstruct(SimpleNameNode name);
-
- @Override
- public HeaderParamDecl visitChildren(AstVisitor nv) throws ScribbleException
- {
- SimpleNameNode name = visitChildWithClassEqualityCheck(this, (SimpleNameNode) this.name, nv);
- return reconstruct(name);
- }
-
- public abstract HeaderParamDecl project(Role self); // Move to delegate?
-
- public abstract String getKeyword();
-
- @Override
- public String toString()
- {
- return getKeyword() + " " + getDeclName().toString();
- }
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/HeaderParamDeclList.java b/modules/core/src/main/java/org/scribble/ast/HeaderParamDeclList.java
deleted file mode 100644
index 2057c41b0..000000000
--- a/modules/core/src/main/java/org/scribble/ast/HeaderParamDeclList.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.scribble.ast;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.main.ScribbleException;
-import org.scribble.sesstype.kind.ParamKind;
-import org.scribble.sesstype.name.Role;
-import org.scribble.visit.AstVisitor;
-
-
-// RoleKind or (NonRole)ParamKind
-public abstract class HeaderParamDeclList extends ScribNodeBase
-{
- private final List extends HeaderParamDecl> decls;
-
- protected HeaderParamDeclList(CommonTree source, List extends HeaderParamDecl> decls)
- {
- super(source);
- this.decls = new LinkedList<>(decls);
- }
-
- public abstract HeaderParamDeclList reconstruct(List extends HeaderParamDecl> decls);
-
- @Override
- public HeaderParamDeclList extends K> visitChildren(AstVisitor nv) throws ScribbleException
- {
- List extends HeaderParamDecl> nds = visitChildListWithClassEqualityCheck(this, this.decls, nv);
- return reconstruct(nds);
- }
-
- public List extends HeaderParamDecl> getDecls()
- {
- return Collections.unmodifiableList(this.decls);
- }
-
- public abstract HeaderParamDeclList project(Role self); // FIXME: move to delegate
-
- public int length()
- {
- return this.decls.size();
- }
-
- public boolean isEmpty()
- {
- return this.decls.isEmpty();
- }
-
- // Without enclosing braces -- added by subclasses
- @Override
- public String toString()
- {
- return this.decls.stream().map((nd) -> nd.toString()).collect(Collectors.joining(", "));
- }
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/ImportDecl.java b/modules/core/src/main/java/org/scribble/ast/ImportDecl.java
deleted file mode 100644
index c7297bc19..000000000
--- a/modules/core/src/main/java/org/scribble/ast/ImportDecl.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.scribble.ast;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.sesstype.kind.ImportKind;
-import org.scribble.sesstype.name.Name;
-
-// TODO: factor out stuff from ImportModule and ImportMember into here, e.g. alias/name, reconstruct
-public abstract class ImportDecl extends ScribNodeBase//, ModuleMember //implements NameDeclaration
-{
- protected ImportDecl(CommonTree source)
- {
- super(source);
- }
-
- public abstract boolean isAliased();
- public abstract Name getAlias();
- //public abstract Name getVisibleName();
-
- public boolean isImportModule()
- {
- return false;
- }
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/ImportModule.java b/modules/core/src/main/java/org/scribble/ast/ImportModule.java
deleted file mode 100644
index a9400b265..000000000
--- a/modules/core/src/main/java/org/scribble/ast/ImportModule.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.scribble.ast;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.ast.name.qualified.ModuleNameNode;
-import org.scribble.del.ScribDel;
-import org.scribble.main.ScribbleException;
-import org.scribble.sesstype.kind.ModuleKind;
-import org.scribble.sesstype.name.ModuleName;
-import org.scribble.visit.AstVisitor;
-
-public class ImportModule extends ImportDecl
-{
- public final ModuleNameNode modname;
- public final ModuleNameNode alias; // Factor up to ImportDecl
-
- public ImportModule(CommonTree source, ModuleNameNode modname, ModuleNameNode alias)
- {
- super(source);
- this.modname = modname;
- this.alias = alias;
- }
-
- @Override
- protected ImportModule copy()
- {
- return new ImportModule(this.source, this.modname, this.alias);
- }
-
- @Override
- public ImportModule clone()
- {
- ModuleNameNode name = (ModuleNameNode) this.modname.clone();
- ModuleNameNode alias = (ModuleNameNode) this.alias.clone();
- return AstFactoryImpl.FACTORY.ImportModule(this.source, name, alias);
- }
-
- public ImportModule reconstruct(ModuleNameNode modname, ModuleNameNode alias) // Factor up
- {
- ScribDel del = del();
- ImportModule im = new ImportModule(this.source, modname, alias);
- im = (ImportModule) im.del(del);
- return im;
- }
-
- @Override
- public ImportModule visitChildren(AstVisitor nv) throws ScribbleException
- {
- ModuleNameNode modname = (ModuleNameNode) visitChild(this.modname, nv);
- ModuleNameNode alias = (isAliased()) ? (ModuleNameNode) visitChild(this.alias, nv) : null;
- return reconstruct(modname, alias);
- }
-
- @Override
- public boolean isImportModule()
- {
- return true;
- }
-
- @Override
- public boolean isAliased()
- {
- return this.alias != null;
- }
-
- /*@Override
- public ModuleName getVisibleName()
- {
- return isAliased() ? getAlias() : this.modname.toName();
- }*/
-
- @Override
- public ModuleName getAlias()
- {
- return this.alias.toName();
- }
-
- @Override
- public String toString()
- {
- String s = Constants.IMPORT_KW + " " + this.modname;
- if (isAliased())
- {
- s += " " + Constants.AS_KW + " " + this.alias;
- }
- return s + ";";
- }
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/InteractionNode.java b/modules/core/src/main/java/org/scribble/ast/InteractionNode.java
deleted file mode 100644
index ca78b8341..000000000
--- a/modules/core/src/main/java/org/scribble/ast/InteractionNode.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.scribble.ast;
-
-import org.scribble.sesstype.kind.ProtocolKind;
-
-// Make a compound interaction subclass for choice/parallel etc?
-public interface InteractionNode extends ProtocolKindNode
-{
- //Set> collectMessageIds(); // Not worth implementing this homomorphically for every case except MessageTransfer, better to use visitChildren pattern
- //Map> getEnablingMessages();
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/InteractionSeq.java b/modules/core/src/main/java/org/scribble/ast/InteractionSeq.java
deleted file mode 100644
index 428118d5d..000000000
--- a/modules/core/src/main/java/org/scribble/ast/InteractionSeq.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.scribble.ast;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.main.ScribbleException;
-import org.scribble.sesstype.kind.ProtocolKind;
-import org.scribble.visit.AstVisitor;
-
-public abstract class InteractionSeq extends ScribNodeBase implements ProtocolKindNode
-{
- private final List extends InteractionNode> inters;
-
- /*@SuppressWarnings("unchecked")
- private final Function> cast = (n) -> (InteractionNode) n;*/
-
- protected InteractionSeq(CommonTree source, List extends InteractionNode> inters)
- {
- super(source);
- this.inters = inters;
- }
-
- public abstract InteractionSeq reconstruct(List extends InteractionNode> ins);
-
- @SuppressWarnings("unchecked")
- private final Function> KIND_CAST = (n) -> (ProtocolKindNode) n;
-
- @Override
- public ScribNode visitChildren(AstVisitor nv) throws ScribbleException
- {
- //List extends InteractionNode> actions = visitChildListWithStrictClassCheck(this, this.actions, nv);
- //List> actions = visitChildListWithCastCheck(this, this.inters, nv, InteractionNode.class, getKind(), this.cast); // Maybe too strict (e.g. rec unfolding maybe shouldn't return the rec)
- List> actions = new LinkedList<>();
- for (InteractionNode in : this.inters)
- {
- //ScribNode visited = visitChild(in, nv);
- ProtocolKindNode visited = visitProtocolKindChildWithCastCheck(this, in, nv, ProtocolKindNode.class, in.getKind(), KIND_CAST);
- if (visited instanceof InteractionSeq>)
- {
- InteractionSeq tmp = (InteractionSeq) visited;
- actions.addAll(tmp.inters);
- }
- else
- {
- InteractionNode tmp = (InteractionNode) visited;
- actions.add(tmp);
- }
- }
- return reconstruct(actions);
- }
-
- public List extends InteractionNode> getInteractions()
- {
- return Collections.unmodifiableList(this.inters);
- }
-
- public boolean isEmpty()
- {
- return this.inters.isEmpty();
- }
-
- @Override
- public String toString()
- {
- return this.inters.stream().map((i) -> i.toString()).collect(Collectors.joining("\n"));
- }
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/Interrupt.java b/modules/core/src/main/java/org/scribble/ast/Interrupt.java
deleted file mode 100644
index 2d4108642..000000000
--- a/modules/core/src/main/java/org/scribble/ast/Interrupt.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package org.scribble.ast;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.ast.name.simple.RoleNode;
-
-// Maybe factor out a base class with MessageTransfer (the list of dest roles has a different meaning though)
-// Can't use abstract/reconstruct pattern, LocalInterrupt has different arguments -- add dummy dests field here to make reconstruct work?
-public class Interrupt extends ScribNodeBase//AbstractSimpleInteractionNode
-{
- public final RoleNode src;
- private final List msgs;
-
- protected Interrupt(CommonTree source, RoleNode src, List msgs)
- {
- super(source);
- this.src = src;
- this.msgs = new LinkedList<>(msgs);
- }
-
- @Override
- protected ScribNodeBase copy()
- {
- // TODO Auto-generated method stub
- throw new RuntimeException("TODO: " + this);
- }
-
- @Override
- public Interrupt clone()
- {
- // TODO Auto-generated method stub
- throw new RuntimeException("TODO: " + this);
- }
-
- public List getMessages()
- {
- return this.msgs;
- }
-
- //protected abstract Interrupt reconstruct(CommonTree ct, RoleNode src, List msgs, GlobalInterruptContext ncontext, Env env);
-
- /*@Override
- public Interrupt leaveWFChoiceCheck(WellFormedChoiceChecker checker) throws ScribbleException
- {
- Role src = this.src.toName();
- WellFormedChoiceEnv env = checker.getEnv();
- for (Message msg : this.msgs.stream().map((mn) -> mn.toMessage()).collect(Collectors.toList()))
- {
- for (Role dest : ((GlobalInterruptContext) getContext()).getDestinations())
- {
- // Recorded in the interruptible env (not the block or the parent)
- //checker.setEnv(checker.getEnv().addInterrupt(src, dest, msg.toScopedMessage(checker.getScope()))); // No: src must be enabled, and if receiver may be enabled by this interrupt then it must also be receiving normally inside the interruptible block
- //checker.getEnv().addMessage(src, dest, msg);
- env = env.addInterrupt(src, dest, msg.toScopedMessage(checker.getScope()));
- }
- }
- checker.setEnv(env);
- return this;
- }
-
- /*@Override
- public Interrupt leave(EnvVisitor nv) throws ScribbleException
- {
- Interrupt gi = (Interrupt) super.leave(nv);
- Env env = nv.getEnv();
- Role src = gi.src.toName();
- List tmp = new LinkedList<>(gi.dests); // For GlobalInterrupt, won't work till after well-formedness checked
- tmp.remove(src);
- for (MessageNode msg : this.msgs)
- {
- for (Role dest : tmp)
- {
- env.ops.addOperator(src, dest, msg.getOperator());
- }
- }
- return gi;
- }
-
- @Override
- public Interrupt substitute(Substitutor subs) throws ScribbleException
- {
- // Follows GlobalMessageTransfer
- RoleNode src = subs.substituteRole(this.src.toName());
- List msgs = new LinkedList<>();
- for (MessageNode msg : this.msgs)
- {
- if (msg.isParameterNode())
- {
- msgs.add((MessageNode) subs.substituteParameter(((ParameterNode) msg).toName()));
- }
- else
- {
- msgs.add((MessageNode) subs.visit((AbstractNode) msg));
- }
- }
- List dests = new LinkedList<>();
- for (Role dest : this.dests)
- {
- dests.add(subs.substituteRole(dest).toName());
- }
- return new Interrupt(this.ct, src, msgs, dests);
- }* /
-
- @Override
- public Interrupt visitChildren(NodeVisitor nv) throws ScribbleException
- {
- RoleNode src = (RoleNode) visitChild(this.src, nv);
- List msgs = new LinkedList<>();
- for (MessageNode msg : this.msgs)
- {
- //msgs.add(MessageTransfer.visitMessageNode(nv, msg));
- msgs.add((MessageNode) visitChild(msg, nv));
- }
- return new Interrupt(this.ct, src, msgs, getContext(), getEnv());//, this.dests);
- //return reconstruct(this.ct, src, msgs, getContext(), getEnv());
- }
-
- @Override
- public GlobalInterruptContext getContext()
- {
- return (GlobalInterruptContext) super.getContext();
- }*/
-
- /*public List getOperators(Env env)
- {
- List ops = new LinkedList<>();
- for (MessageNode msg : this.msgs)
- {
- // FIXME: factor out scope prefix manipulation
- ops.add(new Operator(env.scopes.getCurrentPrefix() + msg.getOperator().text));
- }
- return ops;
- }*/
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/Interruptible.java b/modules/core/src/main/java/org/scribble/ast/Interruptible.java
deleted file mode 100644
index 00b98024e..000000000
--- a/modules/core/src/main/java/org/scribble/ast/Interruptible.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package org.scribble.ast;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.ast.name.simple.ScopeNode;
-import org.scribble.sesstype.kind.ProtocolKind;
-
-public abstract class Interruptible extends CompoundInteractionNode implements ScopedNode
-{
- public final ScopeNode scope;
- public final ProtocolBlock block;
- private final List extends Interrupt> interrs;
-
- protected Interruptible(CommonTree source, ScopeNode scope, ProtocolBlock block, List extends Interrupt> interrs)
- {
- super(source);
- this.scope = scope;
- this.block = block;
- this.interrs = interrs;
- }
-
- /*protected abstract Interruptible reconstruct(CommonTree ct, ScopeNode scope, T1 block, List interrs, CompoundInteractionNodeContext icontext, Env env);
-
- @Override
- public NodeContextBuilder enterContextBuilding(NodeContextBuilder builder) throws ScribbleException
- {
- builder.pushContext(new CompoundInteractionNodeContext());
- return builder;
- }
-
- @Override
- public Interruptible leaveContextBuilding(NodeContextBuilder builder) throws ScribbleException
- {
- CompoundInteractionNodeContext icontext = (CompoundInteractionNodeContext) builder.popContext();
- builder.replaceContext(((CompoundInteractionContext) builder.peekContext()).merge(icontext));
- icontext = (CompoundInteractionNodeContext) icontext.merge(this.block.getContext());
- //return new Interruptible(this.ct, this.scope, this.block, this.interrs, icontext);
- return reconstruct(this.ct, this.scope, this.block, this.interrs, icontext, getEnv());
- }
-
- @Override
- public Interruptible leaveWFChoiceCheck(WellFormedChoiceChecker checker) throws ScribbleException
- {
- checker.getEnv().leave(this, checker);
- return this;
-
- /*Role src = this.src.toName();
- for (Message msg : this.msgs.stream().map((mn) -> mn.toMessage()).collect(Collectors.toList()))
- {
- for (Role dest : ((GlobalInterruptContext) getContext()).getDestinations())
- {
- //checker.getEnv().addInterrupt(src, dest, msg); // No: src must be enabled, and if receiver may be enabled by this interrupt then it must also be receiving normally inside the interruptible block
-
- System.out.println("2a: " + src + ", " + dest + ", " + msg);
-
- checker.getEnv().addMessage(src, dest, msg);
- }
- }* /
- }
-
- @Override
- public Interruptible leaveReachabilityCheck(ReachabilityChecker checker) throws ScribbleException
- {
- checker.getEnv().leave(this, checker);
- return this;
- }
-
- @Override
- public Interruptible visitChildren(NodeVisitor nv) throws ScribbleException
- {
- ScopeNode scope = this.scope;
- if (scope != null)
- {
- scope = (ScopeNode) visitChild(this.scope, nv);
- }
- //ProtocolBlock extends InteractionSequence extends InteractionNode>> block = (ProtocolBlock extends InteractionSequence extends InteractionNode>>) nv.visit(this.block);
- T1 block = visitChildWithClassCheck(this, this.block, nv);
- List interrs = visitChildListWithClassCheck(this, this.interrs, nv);
- //return new Interruptible<>(this.ct, scope, block, interrs, getContext(), getEnv());
- return reconstruct(this.ct, scope, block, interrs, getContext(), getEnv());
- }
-
- @Override
- public boolean isEmptyScope()
- {
- return false;
- }
-
- @Override
- //public Scope getScope()
- public SimpleName getScopeElement()
- {
- return this.scope.toName();
- }*/
-
- public boolean isScopeNodeImplicit()
- {
- return this.scope == null;
- }
-
- @Override
- public String toString()
- {
- String s = Constants.INTERRUPTIBLE_KW + " ";
- if (!isScopeNodeImplicit())
- {
- s += this.scope + ": ";
- }
- s += this.block + " " + Constants.WITH_KW + " {\n";
- s += this.interrs.stream().map((i) -> i.toString()).collect(Collectors.joining("\n")) + "\n";
- return s + "}";
- }
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/MessageNode.java b/modules/core/src/main/java/org/scribble/ast/MessageNode.java
deleted file mode 100644
index c794d814d..000000000
--- a/modules/core/src/main/java/org/scribble/ast/MessageNode.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.scribble.ast;
-
-import org.scribble.sesstype.Message;
-
-// A sig kind node: MessageSignatureNode, MessageSignatureNameNode or NonRoleParamNode
-public interface MessageNode extends NonRoleArgNode
-{
- Message toMessage();
-
- MessageNode clone();
-
- //Arg extends SigKind> toArg(); // Not possible due to "diamond" with PayloadElemNameNode at AmbigNameNode
-
- MessageNode project(); // Not role sensitive // Factor into visitor/env pattern? Currently not
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/MessageSigNameDecl.java b/modules/core/src/main/java/org/scribble/ast/MessageSigNameDecl.java
deleted file mode 100644
index 63aa5e88e..000000000
--- a/modules/core/src/main/java/org/scribble/ast/MessageSigNameDecl.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.scribble.ast;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.ast.name.qualified.MemberNameNode;
-import org.scribble.ast.name.qualified.MessageSigNameNode;
-import org.scribble.del.ScribDel;
-import org.scribble.sesstype.kind.SigKind;
-import org.scribble.sesstype.name.MessageSigName;
-import org.scribble.sesstype.name.ModuleName;
-
-public class MessageSigNameDecl extends NonProtocolDecl
-{
- public MessageSigNameDecl(CommonTree source, String schema, String extName, String extSource, MessageSigNameNode name)
- {
- super(source, schema, extName, extSource, name);
- }
-
- @Override
- protected MessageSigNameDecl copy()
- {
- return new MessageSigNameDecl(this.source, this.schema, this.extName, this.extSource, getNameNode());
- }
-
- @Override
- public MessageSigNameDecl clone()
- {
- MessageSigNameNode name = (MessageSigNameNode) this.name.clone();
- return AstFactoryImpl.FACTORY.MessageSigNameDecl(this.source, this.schema, this.extName, this.extSource, name);
- }
-
- @Override
- public MessageSigNameDecl reconstruct(String schema, String extName, String extSource, MemberNameNode name)
- {
- ScribDel del = del();
- MessageSigNameDecl msnd = new MessageSigNameDecl(this.source, schema, extName, extSource, (MessageSigNameNode) name);
- msnd = (MessageSigNameDecl) msnd.del(del);
- return msnd;
- }
-
- @Override
- public boolean isMessageSigNameDecl()
- {
- return true;
- }
-
- @Override
- public MessageSigNameNode getNameNode()
- {
- return (MessageSigNameNode) super.getNameNode();
- }
-
- @Override
- public MessageSigName getDeclName()
- {
- return (MessageSigName) super.getDeclName();
- }
-
- @Override
- public MessageSigName getFullMemberName(Module mod)
- {
- ModuleName fullmodname = mod.getFullModuleName();
- return new MessageSigName(fullmodname, getDeclName());
- }
-
- @Override
- public String toString()
- {
- return Constants.SIG_KW + " <" + this.schema + "> \"" + this.extName
- + "\" " + Constants.FROM_KW + " \"" + this.extSource + "\" "
- + Constants.AS_KW + " " + this.name + ";";
- }
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/MessageSigNode.java b/modules/core/src/main/java/org/scribble/ast/MessageSigNode.java
deleted file mode 100644
index 146d28ce0..000000000
--- a/modules/core/src/main/java/org/scribble/ast/MessageSigNode.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.scribble.ast;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.ast.name.simple.OpNode;
-import org.scribble.del.ScribDel;
-import org.scribble.main.ScribbleException;
-import org.scribble.sesstype.MessageSig;
-import org.scribble.visit.AstVisitor;
-
-public class MessageSigNode extends ScribNodeBase implements MessageNode
-{
- public final OpNode op;
- public final PayloadElemList payloads;
-
- public MessageSigNode(CommonTree source, OpNode op, PayloadElemList payload)
- {
- super(source);
- this.op = op;
- this.payloads = payload;
- }
-
- @Override
- public MessageNode project() // Currently outside of visitor/env pattern
- {
- return AstFactoryImpl.FACTORY.MessageSigNode(this.source, this.op, this.payloads.project()); // Original del not retained by projection
- }
-
- @Override
- protected MessageSigNode copy()
- {
- return new MessageSigNode(this.source, this.op, this.payloads);
- }
-
- @Override
- public MessageSigNode clone()
- {
- OpNode op = this.op.clone();
- PayloadElemList payload = this.payloads.clone();
- return AstFactoryImpl.FACTORY.MessageSigNode(this.source, op, payload);
- }
-
- public MessageSigNode reconstruct(OpNode op, PayloadElemList payload)
- {
- ScribDel del = del();
- MessageSigNode msn = new MessageSigNode(this.source, op, payload);
- msn = (MessageSigNode) msn.del(del);
- return msn;
- }
-
- @Override
- public MessageSigNode visitChildren(AstVisitor nv) throws ScribbleException
- {
- OpNode op = (OpNode) visitChild(this.op, nv);
- PayloadElemList payload = (PayloadElemList) visitChild(this.payloads, nv);
- return reconstruct(op, payload);
- }
-
-
- @Override
- public boolean isMessageSigNode()
- {
- return true;
- }
-
- // Make a direct scoped version? (taking scope as argument)
- @Override
- public MessageSig toArg()
- {
- return new MessageSig(this.op.toName(), this.payloads.toPayload());
- }
-
- @Override
- public MessageSig toMessage()
- {
- return toArg();
- }
-
- @Override
- public String toString()
- {
- return this.op.toString() + this.payloads.toString();
- }
-}
diff --git a/modules/core/src/main/java/org/scribble/ast/MessageTransfer.java b/modules/core/src/main/java/org/scribble/ast/MessageTransfer.java
deleted file mode 100644
index defed0857..000000000
--- a/modules/core/src/main/java/org/scribble/ast/MessageTransfer.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.scribble.ast;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.scribble.ast.name.simple.RoleNode;
-import org.scribble.main.ScribbleException;
-import org.scribble.sesstype.kind.ProtocolKind;
-import org.scribble.sesstype.name.Role;
-import org.scribble.visit.AstVisitor;
-
-public abstract class MessageTransfer extends SimpleInteractionNode
-{
- public final RoleNode src;
- public final MessageNode msg; // FIXME: ambig may get resolved to an unexpected kind, e.g. DataTypeNode (cf. DoArg, PayloadElem wrappers)
- private final List