/*;-*-C-*-;
-** Copyright (c) Massachusetts Institute of Technology 1994-1998.
-** All Rights Reserved.
-** Unpublished rights reserved under the copyright laws of
-** the United States.
+** Splint - annotation-assisted static program checker
+** Copyright (C) 1994-2003 University of Virginia,
+** Massachusetts Institute of Technology
**
-** THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-** OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
-**
-** This code is distributed freely and may be used freely under the
-** following conditions:
-**
-** 1. This notice may not be removed or altered.
+** This program is free software; you can redistribute it and/or modify it
+** under the terms of the GNU General Public License as published by the
+** Free Software Foundation; either version 2 of the License, or (at your
+** option) any later version.
+**
+** This program is distributed in the hope that it will be useful, but
+** WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** General Public License for more details.
+**
+** The GNU General Public License is available from http://www.gnu.org/ or
+** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+** MA 02111-1307, USA.
**
-** 2. Works derived from this code are not distributed for
-** commercial gain without explicit permission from MIT
-** (for permission contact lclint-request@sds.lcs.mit.edu).
+** For information on splint: splint@cs.virginia.edu
+** To report a bug: splint-bug@cs.virginia.edu
+** For more information: http://www.splint.org
*/
/*
-** Copyright (c) Massachusetts Institute of Technology, 1993
-** All Rights Reserved. Unpublished rights reserved
-** under the copyright laws of the United States.
-**++
-** FACILITY: LSLC
-**
-** MODULE DESCRIPTION:
+** signature.y
**
-** FILENAME: signature.y
+** Grammar for parsing LSL signatures.
**
-** PURPOSE: bison grammar for LSL signatures.
-**
-** AUTHOR:
-** Yang Meng Tan, Massachusetts Institute of Technology
+** Original author: Yang Meng Tan, Massachusetts Institute of Technology
*/
%{
-# include "bison.reset"
-
# include <stdio.h>
-# include "lclintMacros.nf"
+# include "splintMacros.nf"
# include "llbasic.h"
# include "lslparse.h"
# include "signature.h"
-void lslerror (char *);
+static void lslerror (char *);
+extern int lsllex ();
+
/*@dependent@*/ /*@null@*/ lslOp importedlslOp;
/*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */
# define YYDEBUG 1
-# include "bison.head"
+/*@-redef@*/
+/*@-readonlytrans@*/
+/*@-nullassign@*/
%}
/*@only@*/ nameNode name;
/*@owned@*/ lslOp operator;
/*@only@*/ lslOpList operators;
-}
+ /*@-redef@*/ /*@-matchfields@*/
+}
+/*@=redef@*/ /*@=matchfields@*/
%token <ltok> LST_SIMPLEID
%token <ltok> LST_LOGICALOP /* \implies, \and, \not, \or */
%%
top: operatorList { lslOpList_free ($1); }
+ ;
operatorList: operator
{ lslOpList x = lslOpList_new ();
| operatorList operator
{ lslOpList_add ($1, $2);
$$ = $1; }
+;
operator: name LST_COLON signature
{ $$ = makelslOpNode ($1, $3); }
/* The next production is never used in the output of lsl -syms
| name
{ $$ = makelslOpNode ($1, (sigNode)0); } */
+;
name: opId /* check for the case of if_then_else */
{ $$ = makeNameNodeId ($1); }
| opForm
{ $$ = makeNameNodeForm ($1); }
+;
opForm
: LST_ifTOKEN LST_MARKERSYM LST_thenTOKEN LST_MARKERSYM LST_elseTOKEN LST_MARKERSYM
| LST_MARKERSYM LST_FIELDMAPSYM LST_SIMPLEID
{ $$ = makeOpFormNode ($1, OPF_MMAP,
opFormUnion_createAnyOp ($3), ltoken_undefined); }
-
+;
anyOp: LST_SIMPLEOP
{ $$ = $1; }
{ $$ = $1; }
| LST_EQOP
{ $$ = $1; }
+;
middle: /* empty */
{ $$ = 0; }
| placeList
{ $$ = $1; }
+;
placeList: LST_MARKERSYM
{ $$ = 1; }
| placeList separator LST_MARKERSYM
{ $$ = $1 + 1; }
+;
separator: LST_COMMA
{ $$ = $1; }
| LST_SEPSYM
{ $$ = $1; }
+;
signature: domain LST_MAPSYM sortId
{ $$ = makesigNode ($2, $1, $3); }
+;
domain: /* empty */
{ $$ = ltokenList_new (); }
| sortList
{ $$ = $1; }
+;
sortList: sortId
{ $$ = ltokenList_singleton ($1); }
| sortList LST_COMMA sortId
{ $$ = ltokenList_push ($1, $3); }
+;
sortId: LST_SIMPLEID
{
$$ = $1;
ltoken_setText ($$, processTraitSortId (ltoken_getText ($1)));
}
+;
opId: LST_SIMPLEID
{ $$ = $1; }
+;
+
%%
# include "bison.reset"
void lslerror (char *s)
{
- lclplainerror
- (message ("An error has occurred in parsing LSL signature: %s",
- cstring_fromChars (s)));
+ llfatalbug
+ (cstring_makeLiteral
+ ("There has been a problem in the parser with LSL signatures. This is believed to result "
+ "from a problem with bison v. 1.25. Please try rebuidling Splint "
+ "using the pre-compiled grammar files by commenting out the "
+ "BISON= line in the top-level Makefile."));
}
static void yyprint (FILE *file, int type, YYSTYPE value)