OpenRewrite language module for Pascal
Recursive descent parser with lossless round-trip fidelity for pure Pascal syntax (ISO 7185 / Turbo Pascal). Includes LST node definitions, visitor, printer, remote serialization support, and a standalone LST generator for Moderne CLI integration. 65 parser tests covering programs, units, control flow, expressions, types, and more.
This commit is contained in:
commit
8915c205cd
37 files changed
+12795
No files matched your search
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Downloads and installs the Moderne CLI (mod) for use with rewrite-pascal.
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/install-mod-cli.sh [--version VERSION]
|
||||
#
|
||||
# The CLI will be installed to ./build/mod-cli/
|
||||
#
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
MOD_VERSION="${1:-latest}"
|
||||
INSTALL_DIR="$(cd "$(dirname "$0")/.." && pwd)/build/mod-cli"
|
||||
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
|
||||
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
||||
ARCH="$(uname -m)"
|
||||
|
||||
case "$OS" in
|
||||
linux*) PLATFORM="linux" ;;
|
||||
darwin*) PLATFORM="darwin" ;;
|
||||
mingw*|msys*|cygwin*) PLATFORM="windows" ;;
|
||||
*) echo "Unsupported OS: $OS"; exit 1 ;;
|
||||
esac
|
||||
|
||||
case "$ARCH" in
|
||||
x86_64|amd64) ARCH="amd64" ;;
|
||||
aarch64|arm64) ARCH="arm64" ;;
|
||||
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
|
||||
esac
|
||||
|
||||
EXT=""
|
||||
if [ "$PLATFORM" = "windows" ]; then
|
||||
EXT=".exe"
|
||||
fi
|
||||
|
||||
MOD_BINARY="$INSTALL_DIR/mod${EXT}"
|
||||
|
||||
if [ -f "$MOD_BINARY" ]; then
|
||||
echo "Moderne CLI already installed at: $MOD_BINARY"
|
||||
"$MOD_BINARY" --version 2>/dev/null || true
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Downloading Moderne CLI for ${PLATFORM}/${ARCH}..."
|
||||
|
||||
# Try the official download approach
|
||||
# See: https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro
|
||||
DOWNLOAD_URL="https://repo1.maven.org/maven2/io/moderne/moderne-cli"
|
||||
|
||||
if [ "$MOD_VERSION" = "latest" ]; then
|
||||
echo "Fetching latest version..."
|
||||
# Try to discover the latest version from Maven Central metadata
|
||||
METADATA_URL="${DOWNLOAD_URL}/maven-metadata.xml"
|
||||
MOD_VERSION=$(curl -sL "$METADATA_URL" | grep -oP '(?<=<latest>)[^<]+' || echo "")
|
||||
if [ -z "$MOD_VERSION" ]; then
|
||||
echo "Could not determine latest version. Please specify a version:"
|
||||
echo " ./scripts/install-mod-cli.sh 4.0.0"
|
||||
echo ""
|
||||
echo "Check https://docs.moderne.io/releases/cli-releases/ for available versions."
|
||||
exit 1
|
||||
fi
|
||||
echo "Latest version: $MOD_VERSION"
|
||||
fi
|
||||
|
||||
ARTIFACT_NAME="moderne-cli-${MOD_VERSION}-${PLATFORM}-${ARCH}${EXT}"
|
||||
ARTIFACT_URL="${DOWNLOAD_URL}/${MOD_VERSION}/${ARTIFACT_NAME}"
|
||||
|
||||
echo "Downloading: $ARTIFACT_URL"
|
||||
if curl -fsSL -o "$MOD_BINARY" "$ARTIFACT_URL"; then
|
||||
chmod +x "$MOD_BINARY"
|
||||
echo "Moderne CLI installed to: $MOD_BINARY"
|
||||
"$MOD_BINARY" --version 2>/dev/null || true
|
||||
else
|
||||
echo ""
|
||||
echo "Download failed. The Moderne CLI may require authentication or a different download method."
|
||||
echo ""
|
||||
echo "Alternative installation methods:"
|
||||
echo " - Homebrew (macOS/Linux): brew install moderne/tap/mod"
|
||||
echo " - Chocolatey (Windows): choco install moderne-cli"
|
||||
echo " - Download from: https://app.moderne.io (requires login)"
|
||||
echo ""
|
||||
echo "Once installed, ensure 'mod' is on your PATH and run:"
|
||||
echo " mod build ."
|
||||
exit 1
|
||||
fi
|
||||
Reference in new issue
Block a user