Todd Wang | 232d649 | 2015-02-25 18:04:54 -0800 | [diff] [blame] | 1 | #!/bin/bash |
Jiri Simsa | d7616c9 | 2015-03-24 23:44:30 -0700 | [diff] [blame] | 2 | # Copyright 2015 The Vanadium Authors. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style |
| 4 | # license that can be found in the LICENSE file. |
Todd Wang | 232d649 | 2015-02-25 18:04:54 -0800 | [diff] [blame] | 5 | |
| 6 | # Generate the grammar.go source file, which contains the parser, by running |
| 7 | # this shell script in the same directory, or by running go generate. This also |
| 8 | # generates grammar.y.debug, which contains a list of all states produced for |
| 9 | # the parser, and some stats. |
| 10 | |
| 11 | set -e |
| 12 | |
Jiri Simsa | d7616c9 | 2015-03-24 23:44:30 -0700 | [diff] [blame] | 13 | go tool yacc -o grammar.y.tmp.go -v grammar.y.debug.tmp grammar.y |
| 14 | gofmt -l -w grammar.y.tmp.go |
Todd Wang | b90b8de | 2015-03-31 20:04:13 -0700 | [diff] [blame] | 15 | cat - grammar.y.tmp.go > grammar.y.go <<EOF |
| 16 | // Copyright 2015 The Vanadium Authors. All rights reserved. |
| 17 | // Use of this source code is governed by a BSD-style |
| 18 | // license that can be found in the LICENSE file. |
| 19 | |
| 20 | EOF |
Todd Wang | 232d649 | 2015-02-25 18:04:54 -0800 | [diff] [blame] | 21 | cat - grammar.y.debug.tmp > grammar.y.debug <<EOF |
| 22 | ***** PLEASE READ THIS! DO NOT DELETE THIS BLOCK! ***** |
| 23 | * The main reason this file has been generated and submitted is to try to ensure |
| 24 | * we never submit changes that cause shift/reduce or reduce/reduce conflicts. |
| 25 | * The Go yacc tool doesn't support the %expect directive, and will happily |
| 26 | * generate a parser even if such conflicts exist; it's up to the developer |
| 27 | * running the tool to notice that an error message is reported. The bottom of |
| 28 | * this file contains stats, including the number of conflicts. If you're |
| 29 | * reviewing a change make sure it says 0 conflicts. |
| 30 | * |
| 31 | * If you're updating the grammar, just cut-and-paste this message from the old |
| 32 | * file to the new one, so that this comment block persists. |
| 33 | ***** PLEASE READ THIS! DO NOT DELETE THIS BLOCK! ***** |
| 34 | EOF |
| 35 | |
Jiri Simsa | d7616c9 | 2015-03-24 23:44:30 -0700 | [diff] [blame] | 36 | rm grammar.y.debug.tmp grammar.y.tmp.go |