Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add pascal/fpc #2

Merged
merged 1 commit into from
Mar 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ One of the following languages is set in `lang`.
- `js` JavaScript (Node 10.14.2)
- `py` Python (CPython 3.6.8)
- `hs` Haskell (GHC 8.4.3)
- `pas` Pascal (FPC 3.0.4)

## Options

Expand All @@ -76,6 +77,9 @@ For Python:
For Haskell:
- None

For Pascal:
- None

## Packages

Apart from the standard libraries, some other libraries come pre-installed.
Expand All @@ -100,3 +104,6 @@ For Haskell:
- scientific
- split
- vector

For Pascal:
- None
5 changes: 5 additions & 0 deletions docker/pascal/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM frolvlad/alpine-fpc
LABEL author="SpaceEEC"

COPY run.sh /var/run/
WORKDIR /var/ws
11 changes: 11 additions & 0 deletions docker/pascal/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
echo "$1" > program.pas

# fpc does not use stderr, ld however does, capture both
res="$(fpc program.pas 2>&1)"

if [ $? -eq 0 ]; then
./program
else
echo "$res"
exit 1
fi
12 changes: 12 additions & 0 deletions src/languages/pascal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const Language = require('../struct/Language');

class Pascal extends Language {
constructor() {
super('pascal', {
highlight: 'pas',
aliases: ['pascal', 'pas']
});
}
}

module.exports = Pascal;