11556Srgrimes#!/bin/sh - 2139969Simp 3139969Simp#- 41556Srgrimes# Copyright (c) 1991, 1993 51556Srgrimes# The Regents of the University of California. All rights reserved. 61556Srgrimes# 71556Srgrimes# This code is derived from software contributed to Berkeley by 81556Srgrimes# Kenneth Almquist. 91556Srgrimes# 101556Srgrimes# Redistribution and use in source and binary forms, with or without 111556Srgrimes# modification, are permitted provided that the following conditions 121556Srgrimes# are met: 131556Srgrimes# 1. Redistributions of source code must retain the above copyright 141556Srgrimes# notice, this list of conditions and the following disclaimer. 151556Srgrimes# 2. Redistributions in binary form must reproduce the above copyright 161556Srgrimes# notice, this list of conditions and the following disclaimer in the 171556Srgrimes# documentation and/or other materials provided with the distribution. 181556Srgrimes# 4. Neither the name of the University nor the names of its contributors 191556Srgrimes# may be used to endorse or promote products derived from this software 201556Srgrimes# without specific prior written permission. 211556Srgrimes# 221556Srgrimes# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 231556Srgrimes# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 241556Srgrimes# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 251556Srgrimes# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 261556Srgrimes# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 271556Srgrimes# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 281556Srgrimes# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 291556Srgrimes# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 301556Srgrimes# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 311556Srgrimes# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 321556Srgrimes# SUCH DAMAGE. 331556Srgrimes# 341556Srgrimes# @(#)mktokens 8.1 (Berkeley) 5/31/93 3550471Speter# $FreeBSD$ 361556Srgrimes 371556Srgrimes# The following is a list of tokens. The second column is nonzero if the 381556Srgrimes# token marks the end of a list. The third column is the name to print in 391556Srgrimes# error messages. 401556Srgrimes 4169029Skristemp=`/usr/bin/mktemp -t ka` 4269029Skriscat > $temp <<\! 431556SrgrimesTEOF 1 end of file 441556SrgrimesTNL 0 newline 451556SrgrimesTSEMI 0 ";" 461556SrgrimesTBACKGND 0 "&" 471556SrgrimesTAND 0 "&&" 481556SrgrimesTOR 0 "||" 491556SrgrimesTPIPE 0 "|" 501556SrgrimesTLP 0 "(" 511556SrgrimesTRP 1 ")" 521556SrgrimesTENDCASE 1 ";;" 53223186SjillesTFALLTHRU 1 ";&" 541556SrgrimesTREDIR 0 redirection 551556SrgrimesTWORD 0 word 561556SrgrimesTIF 0 "if" 571556SrgrimesTTHEN 1 "then" 581556SrgrimesTELSE 1 "else" 591556SrgrimesTELIF 1 "elif" 601556SrgrimesTFI 1 "fi" 611556SrgrimesTWHILE 0 "while" 621556SrgrimesTUNTIL 0 "until" 631556SrgrimesTFOR 0 "for" 641556SrgrimesTDO 1 "do" 651556SrgrimesTDONE 1 "done" 661556SrgrimesTBEGIN 0 "{" 671556SrgrimesTEND 1 "}" 681556SrgrimesTCASE 0 "case" 691556SrgrimesTESAC 1 "esac" 701556SrgrimesTNOT 0 "!" 711556Srgrimes! 7269029Skrisnl=`wc -l $temp` 7317987Speterexec > token.h 7469029Skrisawk '{print "#define " $1 " " NR-1}' $temp 751556Srgrimesecho ' 761556Srgrimes/* Array indicating which tokens mark the end of a list */ 77279503Sjillesstatic const char tokendlist[] = {' 7869029Skrisawk '{print "\t" $2 ","}' $temp 791556Srgrimesecho '}; 801556Srgrimes 81279503Sjillesstatic const char *const tokname[] = {' 821556Srgrimessed -e 's/"/\\"/g' \ 831556Srgrimes -e 's/[^ ]*[ ][ ]*[^ ]*[ ][ ]*\(.*\)/ "\1",/' \ 8469029Skris $temp 851556Srgrimesecho '}; 861556Srgrimes' 8769029Skrissed 's/"//g' $temp | awk ' 8898463Sjmallett/TIF/{print "#define KWDOFFSET " NR-1; print ""; print "const char *const parsekwd[] = {"} 891556Srgrimes/TIF/,/neverfound/{print " \"" $3 "\","}' 901556Srgrimesecho ' 0 911556Srgrimes};' 921556Srgrimes 9369029Skrisrm $temp 94