The antlr-format tool has a bug in reaching a fixed point (i.e., if I take version "before" which is outputed by the tool and rerun the tool on it, the tool should return exactly the same file). In addition it removed a comment that should not have been removed. It's essential that the antlr-format tool outputs a format that reliably follows the coding standard.
Here is a grammar that takes five applications of antlr-format to get to a fixed point PlSqlLexer.g4.txt. You will also need a file for the antlr-format options. repo_coding_style.json
The script I can use to check this is here:
#
rm -rf foo
mkdir foo
pushd foo
cp ../PlSqlLexer.g4.txt PlSqlLexer.g4
i=1
while :
do
echo Iteration $i
cp PlSqlLexer.g4 PlSqlLexer.g4.before
cp PlSqlLexer.g4 PlSqlLexer.g4.after
dos2unix *.g4
antlr-format -c ../repo_coding_style.json PlSqlLexer.g4.after 2>&1 1> /dev/null
dos2unix *.g4
diff PlSqlLexer.g4.before PlSqlLexer.g4.after
if [ $? -ne 0 ]
then
echo No fixed point yet.
else
echo Fixed point achieved.
break
fi
cp PlSqlLexer.g4.after PlSqlLexer.g4
i=`expr $i + 1`
done
Note, the script includes a call to dos2unix because antlr-format outputs raw '\n's regardless of the host operating system. (On Windows, the newline is '\n\r'.)
The first concern is that there are several comments removed in the START_CMD rule depending on the iteration of antlr-format.
The second concern is whether there are grammars that may not ever converge to a fixed point.
The antlr-format tool has a bug in reaching a fixed point (i.e., if I take version "before" which is outputed by the tool and rerun the tool on it, the tool should return exactly the same file). In addition it removed a comment that should not have been removed. It's essential that the antlr-format tool outputs a format that reliably follows the coding standard.
Here is a grammar that takes five applications of antlr-format to get to a fixed point PlSqlLexer.g4.txt. You will also need a file for the antlr-format options. repo_coding_style.json
The script I can use to check this is here:
Note, the script includes a call to
dos2unix
because antlr-format outputs raw '\n's regardless of the host operating system. (On Windows, the newline is '\n\r'.)The first concern is that there are several comments removed in the START_CMD rule depending on the iteration of antlr-format.
The second concern is whether there are grammars that may not ever converge to a fixed point.