Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
1d73ef63
Commit
1d73ef63
authored
Nov 23, 1999
by
Henrik (Grubba) Grubbström
Browse files
Options
Downloads
Patches
Plain Diff
Added soft casts.
Rev: src/language.yacc:1.136
parent
af37761e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/language.yacc
+23
-7
23 additions, 7 deletions
src/language.yacc
with
23 additions
and
7 deletions
src/language.yacc
+
23
−
7
View file @
1d73ef63
...
...
@@ -75,6 +75,7 @@
%token F_SWITCH F_SSCANF F_CATCH
%token F_CAST
%token F_SOFT_CAST
%token F_FOREACH
%token F_SIZEOF F_SIZEOF_LOCAL
...
...
@@ -183,7 +184,7 @@
/* This is the grammar definition of Pike. */
#include "global.h"
RCSID("$Id: language.yacc,v 1.13
5
1999/11/2
1 18:52:12
grubba Exp $");
RCSID("$Id: language.yacc,v 1.13
6
1999/11/2
3 03:06:35
grubba Exp $");
#ifdef HAVE_MEMORY_H
#include <memory.h>
#endif
...
...
@@ -307,6 +308,7 @@ int yylex(YYSTYPE *yylval);
%type <n> number_or_minint
%type <n> number_or_maxint
%type <n> cast
%type <n> soft_cast
%type <n> simple_type
%type <n> simple_type2
%type <n> simple_identifier_type
...
...
@@ -776,7 +778,11 @@ modifier: F_NO_MASK { $$ = ID_NOMASK; }
| F_INLINE { $$ = ID_INLINE; }
;
modifiers: modifier_list { $$=current_modifiers=$1 | lex.pragmas; } ;
modifiers: modifier_list
{
$$=current_modifiers=$1 | (lex.pragmas & ID_MODIFIER_MASK);
}
;
modifier_list: /* empty */ { $$ = 0; }
| modifier modifier_list { $$ = $1 | $2; }
...
...
@@ -794,6 +800,14 @@ cast: '(' type ')'
}
;
soft_cast: '[' type ']'
{
struct pike_string *s=compiler_pop_type();
$$=mkstrnode(s);
free_string(s);
}
;
type6: type | identifier_type ;
type: type '*' { push_type(T_ARRAY); }
...
...
@@ -1666,6 +1680,11 @@ expr2: expr3
$$=mkcastnode($1->u.sval.u.string,$2);
free_node($1);
}
| soft_cast expr2
{
$$=mksoftcastnode($1->u.sval.u.string,$2);
free_node($1);
}
| F_INC expr4 { $$=mknode(F_INC,$2,0); }
| F_DEC expr4 { $$=mknode(F_DEC,$2,0); }
| F_NOT expr2 { $$=mkopernode("`!",$2,0); }
...
...
@@ -2040,7 +2059,7 @@ lvalue: expr4
$$=mklocalnode(islocal($2->u.sval.u.string),0);
free_node($2);
}
| bad_
lvalue
| bad_
expr_ident
{ $$=mknewintnode(0); }
;
low_lvalue_list: lvalue lvalue_list { $$=mknode(F_LVALUE_LIST,$1,$2); }
...
...
@@ -2069,12 +2088,9 @@ string: F_STRING
*/
/* FIXME: Should probably set last_identifier. */
bad_identifier: bad_
lvalue
bad_identifier: bad_
expr_ident
| F_CLASS
{ yyerror("class is a reserved word."); }
;
bad_lvalue: bad_expr_ident
| F_ARRAY_ID
{ yyerror("array is a reserved word."); }
| F_FLOAT_ID
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment