Skip to content

Commit a109dd2

Browse files
committed
Initial commit
0 parents  commit a109dd2

File tree

21 files changed

+828
-0
lines changed

21 files changed

+828
-0
lines changed

.classpath

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
10+
<attributes>
11+
<attribute name="optional" value="true"/>
12+
<attribute name="maven.pomderived" value="true"/>
13+
<attribute name="test" value="true"/>
14+
</attributes>
15+
</classpathentry>
16+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
17+
<attributes>
18+
<attribute name="maven.pomderived" value="true"/>
19+
</attributes>
20+
</classpathentry>
21+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
22+
<attributes>
23+
<attribute name="maven.pomderived" value="true"/>
24+
</attributes>
25+
</classpathentry>
26+
<classpathentry kind="src" output="target/classes" path="target/generated-sources/antlr4">
27+
<attributes>
28+
<attribute name="optional" value="true"/>
29+
<attribute name="maven.pomderived" value="true"/>
30+
</attributes>
31+
</classpathentry>
32+
<classpathentry kind="src" path="target/generated-sources/annotations">
33+
<attributes>
34+
<attribute name="optional" value="true"/>
35+
<attribute name="maven.pomderived" value="true"/>
36+
<attribute name="ignore_optional_problems" value="true"/>
37+
<attribute name="m2e-apt" value="true"/>
38+
</attributes>
39+
</classpathentry>
40+
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
41+
<attributes>
42+
<attribute name="optional" value="true"/>
43+
<attribute name="maven.pomderived" value="true"/>
44+
<attribute name="ignore_optional_problems" value="true"/>
45+
<attribute name="m2e-apt" value="true"/>
46+
<attribute name="test" value="true"/>
47+
</attributes>
48+
</classpathentry>
49+
<classpathentry kind="output" path="target/classes"/>
50+
</classpath>

.devcontainer/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM maven:3.6-jdk-11
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
RUN apt-get update \
5+
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
6+
#
7+
# Install git, process tools, lsb-release (common in install instructions for CLIs)
8+
&& apt-get -y install git procps lsb-release \
9+
#
10+
# Allow for a consistant java home location for settings - image is changing over time
11+
&& if [ ! -d "/docker-java-home" ]; then ln -s "${JAVA_HOME}" /docker-java-home; fi
12+
13+
ENV DEBIAN_FRONTEND=

.devcontainer/devcontainer.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "JSH",
3+
"dockerFile": "Dockerfile",
4+
5+
// Comment out the next line to run as root instead. Linux users,
6+
// update Dockerfile with your user's UID/GID if not 1000.
7+
//"runArgs": ["-u", "vscode"],
8+
9+
// Use 'settings' to set *default* container specific settings.json values on container create.
10+
// You can edit these settings after create using File > Preferences > Settings > Remote.
11+
"settings":{
12+
"java.home": "/docker-java-home",
13+
"terminal.integrated.shell.linux": "/bin/bash"
14+
},
15+
16+
// Uncomment the next line if you want to publish any ports.
17+
// "appPort": [],
18+
19+
// Uncomment the next line to run commands after the container is created.
20+
// "postCreateCommand": "java -version",
21+
22+
"extensions": [
23+
"vscjava.vscode-java-pack",
24+
"redhat.vscode-xml",
25+
"mike-lischke.vscode-antlr4"
26+
],
27+
}

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git
2+
/target

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
target/
2+
.antlr/
3+
.factorypath

.project

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>jsh</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
<filteredResources>
24+
<filter>
25+
<id>1601258636196</id>
26+
<name></name>
27+
<type>30</type>
28+
<matcher>
29+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
30+
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
31+
</matcher>
32+
</filter>
33+
</filteredResources>
34+
</projectDescription>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.apt.aptEnabled=false
3+
org.eclipse.jdt.apt.genSrcDir=target/generated-sources/annotations
4+
org.eclipse.jdt.apt.genTestSrcDir=target/generated-test-sources/test-annotations

.settings/org.eclipse.jdt.core.prefs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
3+
org.eclipse.jdt.core.compiler.compliance=11
4+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
5+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
6+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
7+
org.eclipse.jdt.core.compiler.processAnnotations=disabled
8+
org.eclipse.jdt.core.compiler.release=disabled
9+
org.eclipse.jdt.core.compiler.source=11

.settings/org.eclipse.m2e.core.prefs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

.vscode/launch.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"configurations": [
3+
{
4+
"type": "java",
5+
"name": "Launch App",
6+
"request": "launch",
7+
"cwd": "${workspaceFolder}",
8+
"console": "internalConsole",
9+
"stopOnEntry": false,
10+
"mainClass": "uk.ac.ucl.jsh.Jsh",
11+
"args": ["-c","echo hello world"],
12+
"projectName": "jsh"
13+
}
14+
]
15+
}

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"java.configuration.updateBuildConfiguration": "automatic"
3+
}

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM maven:3.6-jdk-11
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
5+
RUN apt-get update \
6+
&& apt-get -y install --no-install-recommends python3 2>&1 \
7+
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
8+
&& apt-get -y install git procps lsb-release \
9+
&& apt-get autoremove -y \
10+
&& apt-get clean -y \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
COPY . /jsh
14+
15+
RUN cd /jsh && mvn package -DskipTests
16+
17+
ENV DEBIAN_FRONTEND=
18+
19+
EXPOSE 8000
20+

jsh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
JSH_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
4+
5+
JSH_JAR="$JSH_ROOT/target/jsh-1.0-SNAPSHOT-jar-with-dependencies.jar"
6+
7+
if [ ! -f "$JSH_JAR" ]; then
8+
echo JSH is not built && exit 1
9+
fi
10+
11+
java -jar "$JSH_JAR" "$@"

pom.xml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>uk.ac.ucl.jsh</groupId>
4+
<artifactId>jsh</artifactId>
5+
<packaging>jar</packaging>
6+
<version>1.0-SNAPSHOT</version>
7+
<name>jsh</name>
8+
<url>http://maven.apache.org</url>
9+
<dependencies>
10+
<dependency>
11+
<groupId>junit</groupId>
12+
<artifactId>junit</artifactId>
13+
<version>4.12</version>
14+
<scope>test</scope>
15+
</dependency>
16+
<dependency>
17+
<groupId>org.antlr</groupId>
18+
<artifactId>antlr4-runtime</artifactId>
19+
<version>4.7</version>
20+
<scope>compile</scope>
21+
</dependency>
22+
</dependencies>
23+
<properties>
24+
<maven.compiler.source>11</maven.compiler.source>
25+
<maven.compiler.target>11</maven.compiler.target>
26+
<argLine>-XX:MaxPermSize=512m</argLine>
27+
<antlr4.visitor>true</antlr4.visitor>
28+
<antlr4.listener>false</antlr4.listener>
29+
</properties>
30+
<build>
31+
<plugins>
32+
<plugin>
33+
<groupId>org.apache.maven.plugins</groupId>
34+
<artifactId>maven-surefire-plugin</artifactId>
35+
<version>3.0.0-M3</version>
36+
</plugin>
37+
<plugin>
38+
<groupId>org.jacoco</groupId>
39+
<artifactId>jacoco-maven-plugin</artifactId>
40+
<version>0.8.4</version>
41+
<configuration>
42+
<excludes>
43+
<exclude>**/JshGrammar*</exclude>
44+
</excludes>
45+
</configuration>
46+
</plugin>
47+
<plugin>
48+
<groupId>org.apache.maven.plugins</groupId>
49+
<artifactId>maven-jar-plugin</artifactId>
50+
<configuration>
51+
<archive>
52+
<manifest>
53+
<mainClass>uk.ac.ucl.jsh.Jsh</mainClass>
54+
</manifest>
55+
</archive>
56+
</configuration>
57+
</plugin>
58+
<plugin>
59+
<artifactId>maven-assembly-plugin</artifactId>
60+
<configuration>
61+
<archive>
62+
<manifest>
63+
<mainClass>uk.ac.ucl.jsh.Jsh</mainClass>
64+
</manifest>
65+
</archive>
66+
<descriptorRefs>
67+
<descriptorRef>jar-with-dependencies</descriptorRef>
68+
</descriptorRefs>
69+
</configuration>
70+
<executions>
71+
<execution>
72+
<id>make-assembly</id> <!-- this is used for inheritance merges -->
73+
<phase>package</phase> <!-- bind to the packaging phase -->
74+
<goals>
75+
<goal>single</goal>
76+
</goals>
77+
</execution>
78+
</executions>
79+
</plugin>
80+
<plugin>
81+
<groupId>org.antlr</groupId>
82+
<artifactId>antlr4-maven-plugin</artifactId>
83+
<version>4.7</version>
84+
<executions>
85+
<execution>
86+
<id>antlr</id>
87+
<goals>
88+
<goal>antlr4</goal>
89+
</goals>
90+
</execution>
91+
</executions>
92+
</plugin>
93+
</plugins>
94+
</build>
95+
<reporting>
96+
<plugins>
97+
<plugin>
98+
<groupId>org.apache.maven.plugins</groupId>
99+
<artifactId>maven-pmd-plugin</artifactId>
100+
</plugin>
101+
<plugin>
102+
<groupId>org.jacoco</groupId>
103+
<artifactId>jacoco-maven-plugin</artifactId>
104+
<reportSets>
105+
<reportSet>
106+
<reports>
107+
<!-- select non-aggregate reports -->
108+
<report>report</report>
109+
</reports>
110+
</reportSet>
111+
</reportSets>
112+
</plugin>
113+
</plugins>
114+
</reporting>
115+
</project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
grammar JshGrammar;
2+
3+
/*
4+
* Parser Rules
5+
*/
6+
7+
command : atomicCommand (';' atomicCommand)*;
8+
9+
atomicCommand : (NONSPECIAL | DOUBLEQUOTED | SINGLEQUOTED)+;
10+
11+
/*
12+
* Lexer Rules
13+
*/
14+
15+
NONSPECIAL : ~['";]+;
16+
DOUBLEQUOTED : '"' (~'"')* '"';
17+
SINGLEQUOTED : '\'' (~'\'')* '\'';

0 commit comments

Comments
 (0)