Branch: Tag:

2007-03-03

2007-03-03 16:46:13 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Added support for string widths to the type system.

Rev: src/encode.c:1.240
Rev: src/language.yacc:1.373
Rev: src/pike_types.c:1.262

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: language.yacc,v 1.372 2006/08/02 15:02:40 mast Exp $ + || $Id: language.yacc,v 1.373 2007/03/03 16:46:13 grubba Exp $   */      %pure_parser
1294:    TOK_FLOAT_ID { push_type(T_FLOAT); }    | TOK_VOID_ID { push_type(T_VOID); }    | TOK_MIXED_ID { push_type(T_MIXED); } -  | TOK_STRING_ID { push_type(T_STRING); } +  | TOK_STRING_ID opt_string_width {}    | TOK_INT_ID opt_int_range {}    | TOK_MAPPING_ID opt_mapping_type {}    | TOK_FUNCTION_ID opt_function_type {}
1463:    }    ;    + opt_string_width: /* Empty */ +  { +  push_string_type(32); +  } +  | '(' ')' +  { +  push_string_type(32); +  } +  | '(' TOK_NUMBER ')' +  { +  INT_TYPE width = 32; +  +  if($2->token == F_CONSTANT) { +  if ($2->u.sval.type == T_INT) { +  width = $2->u.sval.u.integer; +  } +  } +  +  push_string_type(width); +  +  free_node($2); +  } +  | '(' error ')' +  { +  yyerror("Expected string width value (0..32)."); +  } +  ; +    opt_object_type: /* Empty */ { push_object_type(0, 0); }    | {   #ifdef PIKE_DEBUG