Skip to content

Commit fe0ff43

Browse files
authored
Refactor preprocessing (#770)
* Refactor preprocessing * Refactor preprocessing * Add tests * Simplification * Workflow
1 parent 32a2da8 commit fe0ff43

26 files changed

+1864
-926
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Preprocessor Tests
2+
3+
on:
4+
pull_request:
5+
types: [assigned, opened, synchronize, reopened, ready_for_review]
6+
paths:
7+
- preprocessor/**
8+
- compiler/parser/**
9+
- pa.sh
10+
push:
11+
branches:
12+
- main
13+
- future
14+
paths:
15+
- preprocessor/**
16+
- compiler/parser/**
17+
- pa.sh
18+
19+
jobs:
20+
preprocessor-tests:
21+
runs-on: ubuntu-24.04
22+
if: github.event.pull_request.draft == false
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
with:
28+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
29+
30+
- name: Set up Python
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: "3.12"
34+
35+
- name: Install system dependencies
36+
run: |
37+
sudo apt-get update
38+
sudo apt-get install -y libffi-dev pkg-config
39+
40+
- name: Install PaSh dependencies
41+
run: |
42+
sudo touch /.githubenv
43+
sudo -E bash scripts/distro-deps.sh -o
44+
sudo -E bash scripts/setup-pash.sh -o
45+
46+
- name: Run preprocessor tests
47+
run: |
48+
export PASH_TOP=$PWD
49+
export PASH_TMP_PREFIX=$(mktemp -d)/
50+
export PASH_BASH_VERSION="5 2 21"
51+
export PYTHONPATH="$PASH_TOP/preprocessor:$PASH_TOP/compiler:$PYTHONPATH"
52+
53+
cd preprocessor
54+
./run_tests.sh
55+
56+
- name: Verify pa.sh integration
57+
run: |
58+
export PASH_TOP=$PWD
59+
export PATH=$PATH:$PASH_TOP
60+
61+
# Test that preprocessing works end-to-end
62+
$PASH_TOP/pa.sh -c 'echo hello'
63+
$PASH_TOP/pa.sh -c 'echo hello | cat'

compiler/pash_preprocessor.py

Lines changed: 0 additions & 127 deletions
This file was deleted.

compiler/preprocessor/__init__.py

Whitespace-only changes.

compiler/preprocessor/preprocessor

Lines changed: 0 additions & 18 deletions
This file was deleted.

compiler/preprocessor/preprocessor.py

Lines changed: 0 additions & 100 deletions
This file was deleted.

compiler/shell_ast/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""
2+
Shell AST utilities for the compiler.
3+
"""

0 commit comments

Comments
 (0)