From 46c1e71e1f2baf460d1da5b310790c8cf6e8e80b Mon Sep 17 00:00:00 2001 From: Jakob Moser <moser@cl.uni-heidelberg.de> Date: Tue, 12 Apr 2022 21:44:35 +0200 Subject: [PATCH] Also accept grammar from stdin --- entrypoint.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index ba9cdd5..6c678cb 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 -- GitLab