pike.git/
src/
language.yacc
Branch:
Tag:
Non-build tags
All tags
No tags
2004-10-23
2004-10-23 02:25:11 by Martin Nilsson <mani@lysator.liu.se>
1fb2defab2378dc24b85832db709306720f3a106 (
102
lines) (+
55
/-
47
)
[
Show
|
Annotate
]
Branch:
7.9
Save 1K
Rev: src/language.yacc:1.345
Rev: src/las.h:1.66
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.
344
2004/10/
22
23:
23
:
20
nilsson Exp $
+
|| $Id: language.yacc,v 1.
345
2004/10/
23
02
:
25
:
11
nilsson Exp $
*/ %pure_parser
436:
struct object *o; if (Pike_compiler->compiler_pass == 1) { if (Pike_compiler->new_program->facet_class == PROGRAM_IS_FACET_CLASS) {
-
yyerror("A class can only belong to one facet");
+
yyerror("A class can only belong to one facet
.
");
} else { resolv_constant($4);
446:
push_int(Pike_compiler->new_program->id); push_int(Pike_compiler->new_program->facet_class); safe_apply_low3(o, find_identifier("add_facet_class",o->prog), 3,
-
"Failed to add facet class to system");
+
"Failed to add facet class to system
.
");
if (Pike_sp[-1].type == T_INT && Pike_sp[-1].u.integer >= 0) { Pike_compiler->new_program->facet_class = PROGRAM_IS_FACET_CLASS;
3859:
/* FIXME: Should probably set Pike_compiler->last_identifier. */ bad_identifier: bad_expr_ident | TOK_ARRAY_ID
-
{ yyerror("array
is a reserved word.
"); }
+
{ yyerror
_reserved
("array"); }
| TOK_CLASS
-
{ yyerror("class
is a reserved word.
"); }
+
{ yyerror
_reserved
("class"); }
| TOK_ENUM
-
{ yyerror("enum
is a reserved word.
"); }
+
{ yyerror
_reserved
("enum"); }
| TOK_FLOAT_ID
-
{ yyerror("float
is a reserved word.
");}
+
{ yyerror
_reserved
("float");}
| TOK_FUNCTION_ID
-
{ yyerror("function
is a reserved word.
");}
+
{ yyerror
_reserved
("function");}
| TOK_INT_ID
-
{ yyerror("int
is a reserved word.
"); }
+
{ yyerror
_reserved
("int"); }
| TOK_MAPPING_ID
-
{ yyerror("mapping
is a reserved word.
"); }
+
{ yyerror
_reserved
("mapping"); }
| TOK_MIXED_ID
-
{ yyerror("mixed
is a reserved word.
"); }
+
{ yyerror
_reserved
("mixed"); }
| TOK_MULTISET_ID
-
{ yyerror("multiset
is a reserved word.
"); }
+
{ yyerror
_reserved
("multiset"); }
| TOK_OBJECT_ID
-
{ yyerror("object
is a reserved word.
"); }
+
{ yyerror
_reserved
("object"); }
| TOK_PROGRAM_ID
-
{ yyerror("program
is a reserved word.
"); }
+
{ yyerror
_reserved
("program"); }
| TOK_STRING_ID
-
{ yyerror("string
is a reserved word.
"); }
+
{ yyerror
_reserved
("string"); }
| TOK_TYPEDEF
-
{ yyerror("typedef
is a reserved word.
"); }
+
{ yyerror
_reserved
("typedef"); }
| TOK_VOID_ID
-
{ yyerror("void
is a reserved word.
"); }
+
{ yyerror
_reserved
("void"); }
; bad_expr_ident: TOK_INLINE
-
{ yyerror("inline
is a reserved word.
"); }
+
{ yyerror
_reserved
("inline"); }
| TOK_LOCAL_ID
-
{ yyerror("local
is a reserved word.
"); }
+
{ yyerror
_reserved
("local"); }
| TOK_NO_MASK
-
{ yyerror("nomask
is a reserved word.
"); }
+
{ yyerror
_reserved
("nomask"); }
| TOK_PREDEF
-
{ yyerror("predef
is a reserved word.
"); }
+
{ yyerror
_reserved
("predef"); }
| TOK_PRIVATE
-
{ yyerror("private
is a reserved word.
"); }
+
{ yyerror
_reserved
("private"); }
| TOK_PROTECTED
-
{ yyerror("protected
is a reserved word.
"); }
+
{ yyerror
_reserved
("protected"); }
| TOK_PUBLIC
-
{ yyerror("public
is a reserved word.
"); }
+
{ yyerror
_reserved
("public"); }
| TOK_OPTIONAL
-
{ yyerror("optional
is a reserved word.
"); }
+
{ yyerror
_reserved
("optional"); }
| TOK_VARIANT
-
{ yyerror("variant
is a reserved word.
"); }
+
{ yyerror
_reserved
("variant"); }
| TOK_STATIC
-
{ yyerror("static
is a reserved word.
"); }
+
{ yyerror
_reserved
("static"); }
| TOK_EXTERN
-
{ yyerror("extern
is a reserved word.
"); }
+
{ yyerror
_reserved
("extern"); }
| TOK_FINAL_ID
-
{ yyerror("final
is a reserved word.
");}
+
{ yyerror
_reserved
("final");}
| TOK_DO
-
{ yyerror("do
is a reserved word.
"); }
+
{ yyerror
_reserved
("do"); }
| TOK_ELSE { yyerror("else without if."); } | TOK_RETURN
-
{ yyerror("return
is a reserved word.
"); }
+
{ yyerror
_reserved
("return"); }
| TOK_IMPORT
-
{ yyerror("import
is a reserved word.
"); }
+
{ yyerror
_reserved
("import"); }
| TOK_FACET
-
{ yyerror("facet
is a reserved word.
"); }
+
{ yyerror
_reserved
("facet"); }
| TOK_INHERIT
-
{ yyerror("inherit
is a reserved word.
"); }
+
{ yyerror
_reserved
("inherit"); }
| TOK_CATCH
-
{ yyerror("catch
is a reserved word.
"); }
+
{ yyerror
_reserved
("catch"); }
| TOK_GAUGE
-
{ yyerror("gauge
is a reserved word.
"); }
+
{ yyerror
_reserved
("gauge"); }
| TOK_LAMBDA
-
{ yyerror("lambda
is a reserved word.
"); }
+
{ yyerror
_reserved
("lambda"); }
| TOK_SSCANF
-
{ yyerror("sscanf
is a reserved word.
"); }
+
{ yyerror
_reserved
("sscanf"); }
| TOK_SWITCH
-
{ yyerror("switch
is a reserved word.
"); }
+
{ yyerror
_reserved
("switch"); }
| TOK_TYPEOF
-
{ yyerror("typeof
is a reserved word.
"); }
+
{ yyerror
_reserved
("typeof"); }
| TOK_BREAK
-
{ yyerror("break
is a reserved word.
"); }
+
{ yyerror
_reserved
("break"); }
| TOK_CASE
-
{ yyerror("case
is a reserved word.
"); }
+
{ yyerror
_reserved
("case"); }
| TOK_CONTINUE
-
{ yyerror("continue
is a reserved word.
"); }
+
{ yyerror
_reserved
("continue"); }
| TOK_DEFAULT
-
{ yyerror("default
is a reserved word.
"); }
+
{ yyerror
_reserved
("default"); }
| TOK_FOR
-
{ yyerror("for
is a reserved word.
"); }
+
{ yyerror
_reserved
("for"); }
| TOK_FOREACH
-
{ yyerror("foreach
is a reserved word.
"); }
+
{ yyerror
_reserved
("foreach"); }
| TOK_IF
-
{ yyerror("if
is a reserved word.
"); }
+
{ yyerror
_reserved
("if"); }
; /*
4011:
STACK_LEVEL_DONE(0); }
+
static void yyerror_reserved(char *keyword)
+
{
+
char fmt[100];
+
snprintf(fmt, sizeof(fmt), "%s is a reserved word.", keyword);
+
yyerror(fmt);
+
}
+
static int low_islocal(struct compiler_frame *f, struct pike_string *str) {