]> andersk Git - splint.git/blobdiff - src/mtgrammar.y
Added splint.spec file contributed by Heiko Abraham
[splint.git] / src / mtgrammar.y
index 2281ece016fc1c2c18263a4735ddbc12bfbdf76e..4ccf1f9a9f258f7c757ef381f187fc797aea2dd4 100644 (file)
@@ -1,20 +1,25 @@
 /*;-*-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-2002 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 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.
 **
-** This code is distributed freely and may be used freely under the 
-** following conditions:
-**
-**     1. This notice may not be removed or altered.
-**
-**     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
 */
 /*
 ** mtgrammar.y
 %{
 
 # include "bison.reset"
-# include "lclintMacros.nf"
+# include "splintMacros.nf"
 # include "llbasic.h"
-# include "mtincludes.h"
 
-static /*@exits@*/ void mterror (char *);
+# ifndef S_SPLINT_S
+extern ctype mtscanner_lookupType (mttok p_tok) /*@modifies p_tok@*/ ;
+# endif
+
+  /*@i523@*/ /* can't include these here
+    # include "mtgrammar.h"
+    # include "mtscanner.h"
+  */
+
+static /*@noreturn@*/ void mterror (char *);
 
 /*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */
+extern int mtlex () ;
 static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */);
 /*@=noparams@*/
 
@@ -83,7 +97,7 @@ static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */);
 %token <tok> MT_ONEOF
 
 %token <tok> MT_DEFAULTS MT_DEFAULT
-%token <tok> MT_REFERENCE MT_PARAMETER MT_CLAUSE
+%token <tok> MT_REFERENCE MT_PARAMETER MT_RESULT MT_CLAUSE MT_LITERAL MT_NULL
 
 %token <tok> MT_ANNOTATIONS
 %token <tok> MT_ARROW
@@ -182,7 +196,10 @@ optContextSelection
 contextSelection
 : MT_PARAMETER optType { $$ = mtContextNode_createParameter ($2); }
 | MT_REFERENCE optType { $$ = mtContextNode_createReference ($2); }
+| MT_RESULT optType    { $$ = mtContextNode_createResult ($2); } 
 | MT_CLAUSE optType    { $$ = mtContextNode_createClause ($2); } 
+| MT_LITERAL optType   { $$ = mtContextNode_createLiteral ($2); }
+| MT_NULL optType      { $$ = mtContextNode_createNull ($2); }
 
 /*
 ** Wish I could share the C grammar here...cut-and-paste instead.
@@ -338,7 +355,7 @@ errorAction
 | MT_ERROR MT_STRINGLIT { $$ = mtTransferAction_createErrorMessage ($2); }
 
 valueChoice
- : MT_IDENT { $$ = $1; }
+ : MT_IDENT 
 
 %%
 
@@ -348,9 +365,18 @@ extern char *yytext;
 
 static void mterror (char *s) 
 {
-  llfatalbug 
-    (cstring_makeLiteral 
-     ("There has been a problem in the .mts parser."));
+  
+  if (s != NULL)
+    {
+      llparseerror
+       (message ("Parse error in meta-state file: %s", cstring_fromChars (s)));
+    }
+  else
+    {
+      llparseerror
+       (message ("Parse error in meta-state file"));
+    }
+
 }
 
 static void yyprint (FILE *file, int type, YYSTYPE value)
This page took 0.029662 seconds and 4 git commands to generate.