| 1 | #!/bin/bash -eu |
| 2 | # |
| 3 | # Copyright 2018 Google LLC |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # To regenerate the CEL lexer/parser statically do the following: |
| 18 | # 1. Download the latest anltr tool from https://www.antlr.org/download.html |
| 19 | # 2. Copy the downloaded jar to the gen directory. It will have a name |
| 20 | # like antlr-<version>-complete.jar. |
| 21 | # 3. Modify the script below to refer to the current ANTLR version. |
| 22 | # 4. Execute the generation script from the gen directory. |
| 23 | # 5. Delete the jar and commit the regenerated sources. |
| 24 | |
| 25 | #!/bin/sh |
| 26 | |
| 27 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 28 | |
| 29 | # Generate AntLR artifacts. |
| 30 | java -Xmx500M -cp ${DIR}/antlr-4.13.1-complete.jar org.antlr.v4.Tool \ |
| 31 | -Dlanguage=Go \ |
| 32 | -package gen \ |
| 33 | -o ${DIR} \ |
| 34 | -visitor ${DIR}/CEL.g4 |
| 35 |