diff --git a/entrypoint.sh b/entrypoint.sh index ba9cdd5da5b1647d2214ed2a727249b320ae60f1..6c678cb36668e8aba2468d54a8688ca17ed85275 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,8 +2,15 @@ # # Entrypoint for the xle Docker image. # -# - /grammar.lfg contains the grammar -# - $1 contains the sentence to be parsed (passed as parameter) +# You need to provide the following information: +# 1. A sentence to parse as first (and only) command line argument ($1) +# 2. A grammar to parse with. The grammar is searched first at /grammar.lfg. If no such file exists, the grammar is read from stdin. + +if [[ ! -f /grammar.lfg ]] +then + # Use "cat" to read everything stdin has to offer and then use Bash to write it to a file + cat > /grammar.lfg +fi # Write xlerc containing instructions to parse echo "create-parser /grammar.lfg" > xlerc