/* * Copyright 1993, 2000 Christopher Seiwald. * * This file is part of Jam - see jam.c for Copyright information. */ # include "jam.h" # include "lists.h" # include "parse.h" # include "scan.h" # include "newstr.h" /* * parse.c - make and destroy parse trees as driven by the parser * * 09/07/00 (seiwald) - ref count on PARSE to avoid freeing when used, * as per Matt Armstrong. * 09/11/00 (seiwald) - structure reworked to reflect that (*func)() * returns a LIST *. */ static PARSE *yypsave; void parse_file( const char *f ) { /* Suspend scan of current file */ /* and push this new file in the stream */ yyfparse(f); /* Now parse each block of rules and execute it. */ /* Execute it outside of the parser so that recursive */ /* calls to yyrun() work (no recursive yyparse's). */ for(;;) { LOL l; PARSE *p; int jmp = 0; /* JMP_NONE */ /* $(<) and $(>) empty in outer scope. */ lol_init( &l ); /* Filled by yyparse() calling parse_save() */ yypsave = 0; /* If parse error or empty parse, outta here */ if( yyparse() || !( p = yypsave ) ) break; /* Run the parse tree. */ list_free( (*(p->func))( p, &l, &jmp ) ); parse_free( p ); } } void parse_save( PARSE *p ) { yypsave = p; } PARSE * parse_make( LIST *(*func)( PARSE *p, LOL *args, int *jmp ), PARSE *left, PARSE *right, PARSE *third, const char *string, const char *string1, int num ) { PARSE *p = (PARSE *)malloc( sizeof( PARSE ) ); p->func = func; p->left = left; p->right = right; p->third = third; p->string = string; p->string1 = string1; p->num = num; p->refs = 1; return p; } void parse_refer( PARSE *p ) { ++p->refs; } void parse_free( PARSE *p ) { if( --p->refs ) return; if( p->string ) freestr( p->string ); if( p->string1 ) freestr( p->string1 ); if( p->left ) parse_free( p->left ); if( p->right ) parse_free( p->right ); if( p->third ) parse_free( p->third ); free( (char *)p ); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#6 | 9903 | Perforce staff |
Jam -dr now reports file/line numbers, at no small effort. New functionality documented in RELNOTES. p4transfer.py: Transferred from production |
||
#5 | 2493 | rmg |
Rewrite the past: update all jam's source with comments to reflect changes since about 2.3, very early 2001. Whitespace only change. === computer:1666: Change 37660 by seiwald@play-seiwald on 2002/11/06 22:41:35 Note: I regenerated jamgram.c on my linux 7.3 system prior to the submit, since patch was so unhappy trying to lay down the changes from Christopher's change. Presumably this is just due to different yacc/bison/whatever particulars on the system where Christopher made the changes originally. - rmg |
||
#4 | 2491 | rmg |
Some consting in jam to make it more compilable by C++ compilers. No functional change. === computer:1666: Change 37433 by perforce@perforce on 2002/10/30 16:08:51 Recreational const-ing of jam, for compilers that don't allow "string" to be passed as a non-const char *. This included a few places where we were modifying what could possibly have been read-only storage, oddly enough. No functional change. === computer:1666: Change 37602 by seiwald@play-seiwald on 2002/11/04 17:25:40 |
||
#3 | 2490 | rmg |
Jam langauge work: make 'return' actually return from the rule, rather than just setting the return value. Introduce new break/continue statements for managing loops. User visible change to be documented in Jam.html. === computer:1666: Change 37200 by seiwald@play-seiwald on 2002/10/22 15:41:28 Gross rework of Jam.html documentation, including: - the description of parameters for rules - description of -g flag - a new description of targets - more about rules and their return values - better separation of rules and updating actions - putting borders around the tables (Undocumented) change to documentation. === computer:1666: Change 37551 by seiwald@waffle-cyg-seiwald on 2002/11/03 23:17:12 Document jam's new and working break/continue/return statements. === computer:1666: Change 37574 by seiwald@play-seiwald on 2002/11/04 13:13:01 |
||
#2 | 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. |
||
#1 | 2 | laura | Add Jam/MR 2.2 source |