%token _BANG
%token _BANG_EQUALS
%token _AMPERAMPER
%token _LPAREN
%token _RPAREN
%token _PLUS_EQUALS
%token _COLON
%token _SEMIC
%token _LANGLE
%token _LANGLE_EQUALS
%token _EQUALS
%token _RANGLE
%token _RANGLE_EQUALS
%token _QUESTION_EQUALS
%token ACTIONS
%token BIND
%token CASE
%token DEFAULT
%token ELSE
%token EXISTING
%token FOR
%token IF
%token IGNORE
%token IN
%token INCLUDE
%token LOCAL
%token ON
%token PIECEMEAL
%token QUIETLY
%token RULE
%token SWITCH
%token TOGETHER
%token UPDATED
%token _LBRACE
%token _BARBAR
%token _RBRACE
/*
* Copyright 1993, 1995 Christopher Seiwald.
*
* This file is part of Jam - see jam.c for Copyright information.
*/
/*
* jamgram.yy - jam grammar
*
* 04/13/94 (seiwald) - added shorthand L0 for null list pointer
* 06/01/94 (seiwald) - new 'actions existing' does existing sources
* 08/23/94 (seiwald) - Support for '+=' (append to variable)
* 08/31/94 (seiwald) - Allow ?= as alias for "default =".
* 09/15/94 (seiwald) - if conditionals take only single arguments, so
* that 'if foo == bar' gives syntax error (use =).
* 02/11/95 (seiwald) - when scanning arguments to rules, only treat
* punctuation keywords as keywords. All arg lists
* are terminated with punctuation keywords.
*/
%token ARG STRING
%left _BARBAR
%left _AMPERAMPER
%left _BANG
%{
#include "jam.h"
#include "lists.h"
#include "parse.h"
#include "scan.h"
#include "compile.h"
#include "newstr.h"
# define F0 (void (*)())0
# define P0 (PARSE *)0
# define S0 (char *)0
# define pset( l,r,a ) parse_make( compile_set,P0,P0,S0,S0,l,r,a )
# define pset1( l,p,a ) parse_make( compile_settings,p,P0,S0,S0,l,L0,a )
# define pstng( p,l,r,a ) pset1( p, parse_make( F0,P0,P0,S0,S0,l,r,0 ), a )
# define prule( s,p ) parse_make( compile_rule,p,P0,s,S0,L0,L0,0 )
# define prules( l,r ) parse_make( compile_rules,l,r,S0,S0,L0,L0,0 )
# define pfor( s,p,l ) parse_make( compile_foreach,p,P0,s,S0,l,L0,0 )
# define psetc( s,p ) parse_make( compile_setcomp,p,P0,s,S0,L0,L0,0 )
# define psete( s,l,s1,f ) parse_make( compile_setexec,P0,P0,s,s1,l,L0,f )
# define pincl( l ) parse_make( compile_include,P0,P0,S0,S0,l,L0,0 )
# define pswitch( l,p ) parse_make( compile_switch,p,P0,S0,S0,l,L0,0 )
# define plocal( l,r,p ) parse_make( compile_local,p,P0,S0,S0,l,r,0 )
# define pnull() parse_make( compile_null,P0,P0,S0,S0,L0,L0,0 )
# define pcases( l,r ) parse_make( F0,l,r,S0,S0,L0,L0,0 )
# define pcase( s,p ) parse_make( F0,p,P0,s,S0,L0,L0,0 )
# define pif( l,r ) parse_make( compile_if,l,r,S0,S0,L0,L0,0 )
# define pthen( l,r ) parse_make( F0,l,r,S0,S0,L0,L0,0 )
# define pcond( c,l,r ) parse_make( F0,l,r,S0,S0,L0,L0,c )
# define pcomp( c,l,r ) parse_make( F0,P0,P0,S0,S0,l,r,c )
# define plol( p,l ) parse_make( F0,p,P0,S0,S0,l,L0,0 )
%}
%%
run : block
{
if( $1.parse->func == compile_null )
{
parse_free( $1.parse );
parse_save( P0 );
}
else
{
parse_save( $1.parse );
}
}
;
/*
* block - one or more rules
* rule - any one of jam's rules
*/
block : /* empty */
{ $$.parse = pnull(); }
| rule block
{ $$.parse = prules( $1.parse, $2.parse ); }
| LOCAL args _SEMIC block
{ $$.parse = plocal( $2.list, L0, $4.parse ); }
| LOCAL args _EQUALS args _SEMIC block
{ $$.parse = plocal( $2.list, $4.list, $6.parse ); }
;
rule : _LBRACE block _RBRACE
{ $$.parse = $2.parse; }
| INCLUDE args _SEMIC
{ $$.parse = pincl( $2.list ); }
| ARG lol _SEMIC
{ $$.parse = prule( $1.string, $2.parse ); }
| arg1 assign args _SEMIC
{ $$.parse = pset( $1.list, $3.list, $2.number ); }
| arg1 ON args assign args _SEMIC
{ $$.parse = pstng( $3.list, $1.list, $5.list, $4.number ); }
| arg1 DEFAULT _EQUALS args _SEMIC
{ $$.parse = pset( $1.list, $4.list, ASSIGN_DEFAULT ); }
| FOR ARG IN args _LBRACE block _RBRACE
{ $$.parse = pfor( $2.string, $6.parse, $4.list ); }
| SWITCH args _LBRACE cases _RBRACE
{ $$.parse = pswitch( $2.list, $4.parse ); }
| IF cond _LBRACE block _RBRACE
{ $$.parse = pif( $2.parse, pthen( $4.parse, pnull() ) ); }
| IF cond _LBRACE block _RBRACE ELSE rule
{ $$.parse = pif( $2.parse, pthen( $4.parse, $7.parse ) ); }
| RULE ARG rule
{ $$.parse = psetc( $2.string, $3.parse ); }
| ACTIONS eflags ARG bindlist _LBRACE
{ yymode( SCAN_STRING ); }
STRING
{ yymode( SCAN_NORMAL ); }
_RBRACE
{ $$.parse = psete( $3.string,$4.list,$7.string,$2.number ); }
;
/*
* assign - = or +=
*/
assign : _EQUALS
{ $$.number = ASSIGN_SET; }
| _PLUS_EQUALS
{ $$.number = ASSIGN_APPEND; }
| _QUESTION_EQUALS
{ $$.number = ASSIGN_DEFAULT; }
;
/*
* cond - a conditional for 'if'
*/
cond : arg1
{ $$.parse = pcomp( COND_EXISTS, $1.list, L0 ); }
| arg1 _EQUALS arg1
{ $$.parse = pcomp( COND_EQUALS, $1.list, $3.list ); }
| arg1 _BANG_EQUALS arg1
{ $$.parse = pcomp( COND_NOTEQ, $1.list, $3.list ); }
| arg1 _LANGLE arg1
{ $$.parse = pcomp( COND_LESS, $1.list, $3.list ); }
| arg1 _LANGLE_EQUALS arg1
{ $$.parse = pcomp( COND_LESSEQ, $1.list, $3.list ); }
| arg1 _RANGLE arg1
{ $$.parse = pcomp( COND_MORE, $1.list, $3.list ); }
| arg1 _RANGLE_EQUALS arg1
{ $$.parse = pcomp( COND_MOREEQ, $1.list, $3.list ); }
| arg1 IN args
{ $$.parse = pcomp( COND_IN, $1.list, $3.list ); }
| _BANG cond
{ $$.parse = pcond( COND_NOT, $2.parse, P0 ); }
| cond _AMPERAMPER cond
{ $$.parse = pcond( COND_AND, $1.parse, $3.parse ); }
| cond _BARBAR cond
{ $$.parse = pcond( COND_OR, $1.parse, $3.parse ); }
| _LPAREN cond _RPAREN
{ $$.parse = $2.parse; }
;
/*
* cases - action elements inside a 'switch'
* case - a single action element inside a 'switch'
*
* Unfortunately, a right-recursive rule.
*/
cases : /* empty */
{ $$.parse = P0; }
| case cases
{ $$.parse = pcases( $1.parse, $2.parse ); }
;
case : CASE ARG _COLON block
{ $$.parse = pcase( $2.string, $4.parse ); }
;
/*
* lol - list of lists
*/
lol : args
{ $$.parse = plol( P0, $1.list ); }
| args _COLON lol
{ $$.parse = plol( $3.parse, $1.list ); }
;
/*
* args - zero or more ARGs in a LIST
* arg1 - exactly one ARG in a LIST
*/
args : argsany
{ yymode( SCAN_NORMAL ); }
;
argsany : /* empty */
{ $$.list = L0; yymode( SCAN_PUNCT ); }
| argsany ARG
{ $$.list = list_new( $1.list, copystr( $2.string ) ); }
;
arg1 : ARG
{ $$.list = list_new( L0, copystr( $1.string ) ); }
;
/*
* eflags - zero or more modifiers to 'executes'
* eflag - a single modifier to 'executes'
*/
eflags : /* empty */
{ $$.number = 0; }
| eflags eflag
{ $$.number = $1.number | $2.number; }
;
eflag : UPDATED
{ $$.number = EXEC_UPDATED; }
| TOGETHER
{ $$.number = EXEC_TOGETHER; }
| IGNORE
{ $$.number = EXEC_IGNORE; }
| QUIETLY
{ $$.number = EXEC_QUIETLY; }
| PIECEMEAL
{ $$.number = EXEC_PIECEMEAL; }
| EXISTING
{ $$.number = EXEC_EXISTING; }
;
/*
* bindlist - list of variable to bind for an action
*/
bindlist : /* empty */
{ $$.list = L0; }
| BIND args
{ $$.list = $2.list; }
;
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #10 | 3065 | Perforce staff |
Support for 'actions ... maxline value', to set a command specific maxline (rather than the OS-specific maximum). Undocumented. |
||
| #9 | 2559 | rmg |
Fix 'var on target ?= value' so that var is only set if it did not have a target-specific value. Previously, it would just overwrite the var's value. Bug fix documented in RELNOTES. === computer:1666: Change 39566 by seiwald@play-seiwald on 2002/12/27 14:44:01 |
||
| #8 | 2514 | rmg | Update derived files that are included in the source distro. | ||
| #7 | 1580 | rmg |
Changes for 2.4beta. Yes, Christopher, I brashly said "2.4-dev WAS the beta" at tea yesterday, but I've since come to my better instincts (got chicken?), so this one will say rmg $ jam -v Jam 2.4beta. OS=LINUX. Copyright 1993-2002 Christopher Seiwald. for a week or two, at least. |
||
| #6 | 1535 | Perforce staff | Define YYMAXDEPTH to 10000 to handle right-recursive rules. | ||
| #5 | 1532 | Perforce staff |
Submit up-to-date built source files for bootstrapping. Previously, you needed jam to build jam because the built source files, which make(1) doesn't make, were out of date. |
||
| #4 | 1319 | rmg |
Jam 2.3 + Perforce's internal changes. This change is a drop of the Perforce internal Jam changes since the 2.3 public release. The individual changes represented herein are preserved in the //guest/richard_geiger/intjam/ branch. The intent of this drop is to provide a base, from which other contributors' Jam branches may be integrated into. It is not intended to become a packaged release in this state. We will be integrating changes from other users prior to creating the next packaged release. Please refer to the src/RELNOTES file for an overview of the changes present in this integration. - Richard Geiger Open Source Engineer at Perforce |
||
| #3 | 486 | Perforce staff |
Jam 2.3. See RELNOTES for a list of changes from 2.2.x. Just about every source file was touched when jam got ANSI-fied. |
||
| #2 | 3 | Perforce maintenance | Jam/MR 2.2.1 (fix for NT handle leak) | ||
| #1 | 2 | laura | Add Jam/MR 2.2 source |