GET DATA: Add error message on incorrect syntax
authorJohn Darrington <john@darrington.wattle.id.au>
Sun, 6 Jan 2013 15:52:58 +0000 (16:52 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 6 Jan 2013 15:52:58 +0000 (16:52 +0100)
Previously, when an incorrect syntax reading a spreadsheet file was used, the procedure
would silently fail.  Now it fails with an error message.

src/language/data-io/get-data.c

index 789300015e8243ce2170224ecb8c3762d64bf835..3ae426c84aa1f3e5516e9f2f0840af6c54360d2a 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
 
    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
@@ -230,7 +230,11 @@ parse_spreadsheet (struct lexer *lexer)
              lex_get (lexer);
            }
          else
-           goto error;
+           {
+             msg (SE, _("%s must be followed by either \"%s\" or \"%s\"."),
+                  "/SHEET", "NAME", "INDEX");
+             goto error;
+           }
        }
       else if (lex_match_id (lexer, "CELLRANGE"))
        {
@@ -249,7 +253,11 @@ parse_spreadsheet (struct lexer *lexer)
              lex_get (lexer);
            }
          else
-           goto error;
+           {
+             msg (SE, _("%s must be followed by either \"%s\" or \"%s\"."),
+                  "/CELLRANGE", "FULL", "RANGE");
+             goto error;
+           }
        }
       else if (lex_match_id (lexer, "READNAMES"))
        {
@@ -264,7 +272,11 @@ parse_spreadsheet (struct lexer *lexer)
              sri->read_names = false;
            }
          else
-           goto error;
+           {
+             msg (SE, _("%s must be followed by either \"%s\" or \"%s\"."),
+                  "/READNAMES", "ON", "OFF");
+             goto error;
+           }
        }
       else
        {