Skip to content
Snippets Groups Projects
Commit e0e6ee3e authored by James K. Lowden's avatar James K. Lowden :anchor:
Browse files

message cleanup

parent fc457ba1
No related branches found
No related tags found
No related merge requests found
...@@ -244,7 +244,7 @@ is_numeric_edited( const char picture[] ) { ...@@ -244,7 +244,7 @@ is_numeric_edited( const char picture[] ) {
assert(picture); assert(picture);
if( strstr(picture, "(0)") ) { if( strstr(picture, "(0)") ) {
numed_message = "error: '(0)' invalid in PICTURE (ISO 2023 13.18.40.3)"; numed_message = "'(0)' invalid in PICTURE (ISO 2023 13.18.40.3)";
return false; return false;
} }
...@@ -255,11 +255,11 @@ is_numeric_edited( const char picture[] ) { ...@@ -255,11 +255,11 @@ is_numeric_edited( const char picture[] ) {
numed_message = NULL; numed_message = NULL;
if( n == -1 ) { if( n == -1 ) {
numed_message = "error: invalid repeat-count in PICTURE"; numed_message = "invalid repeat-count in PICTURE";
} else if( n == 0 ) { } else if( n == 0 ) {
numed_message = "error: invalid repeat-count in PICTURE"; numed_message = "invalid repeat-count in PICTURE";
} else if( p[pos] != ')' ) { } else if( p[pos] != ')' ) {
numed_message = "error: unbalanced parentheses in PICTURE"; numed_message = "unbalanced parentheses in PICTURE";
} }
if( numed_message ) return false; if( numed_message ) return false;
} }
...@@ -269,13 +269,13 @@ is_numeric_edited( const char picture[] ) { ...@@ -269,13 +269,13 @@ is_numeric_edited( const char picture[] ) {
while( picture < prior-- ) { while( picture < prior-- ) {
if( ISDIGIT(*prior) ) continue; if( ISDIGIT(*prior) ) continue;
if( *prior == '(' ) break; if( *prior == '(' ) break;
numed_message = "error: unbalanced parentheses in PICTURE"; numed_message = "unbalanced parentheses in PICTURE";
return false; return false;
} }
} }
if( (strchr(picture, 'Z') || strchr(picture, 'z')) && strchr(picture, '*') ) { if( (strchr(picture, 'Z') || strchr(picture, 'z')) && strchr(picture, '*') ) {
numed_message = "error: Z and * are mutually exclusive"; numed_message = "Z and * are mutually exclusive";
return false; return false;
} }
...@@ -288,24 +288,23 @@ is_numeric_edited( const char picture[] ) { ...@@ -288,24 +288,23 @@ is_numeric_edited( const char picture[] ) {
switch(*p) { // test for CR or DB switch(*p) { // test for CR or DB
case 'C': case 'c': case 'C': case 'c':
if( TOUPPER(*++p) == 'R' ) continue; if( TOUPPER(*++p) == 'R' ) continue;
numed_message = "error: expected CR in PICTURE"; numed_message = "expected CR in PICTURE";
break; break;
case 'D': case 'd': case 'D': case 'd':
if( TOUPPER(*++p) == 'B' ) continue; if( TOUPPER(*++p) == 'B' ) continue;
numed_message = "error: expected DB in PICTURE"; numed_message = "expected DB in PICTURE";
break; break;
default: default:
asprintf(&s, "error: invalid PICTURE character " asprintf(&s, "invalid PICTURE character "
"'%c' at offset %zu in '%s'", "'%c' at offset %zu in '%s'",
*p, p - picture, picture); *p, p - picture, picture);
numed_message = s; numed_message = s;
break; break;
} }
if( yydebug ) { dbgmsg( "%s: no, because '%c' at %.*s<-- in '%s'",
yywarn( "%s: no, because '%c' at %.*s<-- in '%s'", __func__, *p, int(p - picture) + 1, picture, picture );
__func__, *p, int(p - picture) + 1, picture, picture );
}
return false; return false;
} }
return true; return true;
...@@ -2158,7 +2157,7 @@ class temp_loc_t : protected YYLTYPE { ...@@ -2158,7 +2157,7 @@ class temp_loc_t : protected YYLTYPE {
temp_loc_t() : orig(token_location) { temp_loc_t() : orig(token_location) {
if( yychar < 3 ) return; if( yychar < 3 ) return;
gcc_location_set(yylloc); gcc_location_set(yylloc); // use lookahead location
} }
temp_loc_t( const YYLTYPE& loc) : orig(token_location) { temp_loc_t( const YYLTYPE& loc) : orig(token_location) {
gcc_location_set(loc); gcc_location_set(loc);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment