BlaiseV.sh 818 B

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. # BlaiseV: Blaise Pascal syntax validator front-end.
  3. # Filters TEXT_BLOCK literals to plain strings (length-preserving, so
  4. # diagnostics keep exact positions), then runs the Coco/R validator.
  5. HERE="$(dirname "$0")"
  6. SRC="$1"
  7. if [ -z "$SRC" ]; then
  8. echo "No input file specified"
  9. exit 1
  10. fi
  11. TMP="$(mktemp /tmp/blaisev.XXXXXX.pas)"
  12. "$HERE/BlaiseTF" "$SRC" "$TMP" 2>/dev/null || { echo "Could not filter input file"; rm -f "$TMP"; exit 1; }
  13. "$HERE/BlaiseParse" "$TMP"
  14. RC=$?
  15. # move the listing next to the original source under its basename
  16. DIR="$(dirname "$SRC")"
  17. BASE="$(basename "$SRC")"
  18. BASE="${BASE%.*}"
  19. if [ -f "$TMP.LST" ] || [ -f "${TMP%.pas}.LST" ]; then
  20. for L in "$TMP.LST" "${TMP%.pas}.LST"; do
  21. if [ -f "$L" ]; then mv "$L" "$DIR/$BASE.LST"; fi
  22. done
  23. fi
  24. rm -f "$TMP" "${TMP%.pas}".*
  25. exit $RC