mirror of
https://github.com/boostorg/build.git
synced 2026-02-13 00:12:11 +00:00
Stylistic changes throughout the Boost Jam source base done while researching the Boost Jam internals. No implementation changes.
[SVN r48532]
This commit is contained in:
@@ -532,7 +532,7 @@ LIST * compile_rule( PARSE * parse, FRAME * frame )
|
||||
frame_init( inner );
|
||||
inner->prev = frame;
|
||||
inner->prev_user = frame->module->user_module ? frame : frame->prev_user;
|
||||
inner->module = frame->module; /* This gets fixed up in evaluate_rule(), below */
|
||||
inner->module = frame->module; /* This gets fixed up in evaluate_rule(), below. */
|
||||
inner->procedure = parse;
|
||||
for ( p = parse->left; p; p = p->left )
|
||||
lol_add( inner->args, parse_evaluate( p->right, frame ) );
|
||||
|
||||
@@ -4,36 +4,34 @@
|
||||
* (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef FRAMES_DWA20011021_H
|
||||
# define FRAMES_DWA20011021_H
|
||||
#define FRAMES_DWA20011021_H
|
||||
|
||||
# include "lists.h"
|
||||
# include "modules.h"
|
||||
#include "lists.h"
|
||||
#include "modules.h"
|
||||
|
||||
typedef struct _PARSE PARSE;
|
||||
typedef struct frame FRAME;
|
||||
|
||||
struct frame
|
||||
{
|
||||
FRAME* prev;
|
||||
/** The nearest enclosing frame for which module->user_module is
|
||||
true. */
|
||||
FRAME* prev_user;
|
||||
LOL args[1];
|
||||
module_t* module;
|
||||
PARSE* procedure;
|
||||
char* rulename;
|
||||
FRAME * prev;
|
||||
/* The nearest enclosing frame for which module->user_module is true. */
|
||||
FRAME * prev_user;
|
||||
LOL args[ 1 ];
|
||||
module_t * module;
|
||||
PARSE * procedure;
|
||||
char * rulename;
|
||||
};
|
||||
|
||||
/* When call into Python is in progress, this
|
||||
variable points to the bjam frame that
|
||||
was current at the moment of call. When the call
|
||||
completes, the variable is not defined. Further,
|
||||
if Jam calls Python which calls Jam and so on,
|
||||
this variable only keeps the most recent Jam frame. */
|
||||
extern struct frame *frame_before_python_call;
|
||||
|
||||
void frame_init( FRAME* ); /* implemented in compile.c */
|
||||
void frame_free( FRAME* ); /* implemented in compile.c */
|
||||
/* When call into Python is in progress, this variable points to the bjam frame
|
||||
* that was current at the moment of call. When the call completes, the variable
|
||||
* is not defined. Further, if Jam calls Python which calls Jam and so on, this
|
||||
* variable only keeps the most recent Jam frame.
|
||||
*/
|
||||
extern struct frame * frame_before_python_call;
|
||||
|
||||
void frame_init( FRAME * ); /* implemented in compile.c */
|
||||
void frame_free( FRAME * ); /* implemented in compile.c */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
* (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
# include "jam.h"
|
||||
# include "lists.h"
|
||||
# include "parse.h"
|
||||
# include "scan.h"
|
||||
# include "newstr.h"
|
||||
# include "modules.h"
|
||||
# include "frames.h"
|
||||
#include "jam.h"
|
||||
#include "lists.h"
|
||||
#include "parse.h"
|
||||
#include "scan.h"
|
||||
#include "newstr.h"
|
||||
#include "modules.h"
|
||||
#include "frames.h"
|
||||
|
||||
/*
|
||||
* parse.c - make and destroy parse trees as driven by the parser
|
||||
@@ -27,23 +27,20 @@
|
||||
* returns a LIST *.
|
||||
*/
|
||||
|
||||
static PARSE *yypsave;
|
||||
static PARSE * yypsave;
|
||||
|
||||
void
|
||||
parse_file( char *f, FRAME* frame )
|
||||
void parse_file( char * f, FRAME * frame )
|
||||
{
|
||||
/* Suspend scan of current file */
|
||||
/* and push this new file in the stream */
|
||||
|
||||
/* 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). */
|
||||
/* 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 ( ; ; )
|
||||
{
|
||||
PARSE *p;
|
||||
PARSE * p;
|
||||
|
||||
/* Filled by yyparse() calling parse_save(). */
|
||||
yypsave = 0;
|
||||
@@ -66,15 +63,15 @@ void parse_save( PARSE * p )
|
||||
|
||||
|
||||
PARSE * parse_make(
|
||||
LIST *(*func)( PARSE *p, FRAME *args ),
|
||||
PARSE *left,
|
||||
PARSE *right,
|
||||
PARSE *third,
|
||||
char *string,
|
||||
char *string1,
|
||||
int num )
|
||||
LIST * (* func)( PARSE *, FRAME * ),
|
||||
PARSE * left,
|
||||
PARSE * right,
|
||||
PARSE * third,
|
||||
char * string,
|
||||
char * string1,
|
||||
int num )
|
||||
{
|
||||
PARSE *p = (PARSE *)BJAM_MALLOC( sizeof( PARSE ) );
|
||||
PARSE * p = (PARSE *)BJAM_MALLOC( sizeof( PARSE ) );
|
||||
|
||||
p->func = func;
|
||||
p->left = left;
|
||||
@@ -84,23 +81,23 @@ PARSE * parse_make(
|
||||
p->string1 = string1;
|
||||
p->num = num;
|
||||
p->refs = 1;
|
||||
p->rulename = 0;
|
||||
p->rulename = 0;
|
||||
|
||||
if ( left )
|
||||
{
|
||||
p->file = left->file;
|
||||
p->line = left->line;
|
||||
}
|
||||
else
|
||||
{
|
||||
yyinput_stream( &p->file, &p->line );
|
||||
}
|
||||
if ( left )
|
||||
{
|
||||
p->file = left->file;
|
||||
p->line = left->line;
|
||||
}
|
||||
else
|
||||
{
|
||||
yyinput_stream( &p->file, &p->line );
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void
|
||||
parse_refer( PARSE *p )
|
||||
|
||||
void parse_refer( PARSE * p )
|
||||
{
|
||||
++p->refs;
|
||||
}
|
||||
|
||||
@@ -4,56 +4,56 @@
|
||||
* This file is part of Jam - see jam.c for Copyright information.
|
||||
*/
|
||||
|
||||
/* This file is ALSO:
|
||||
* Copyright 2001-2004 David Abrahams.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
||||
/* This file is ALSO:
|
||||
* Copyright 2001-2004 David Abrahams.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef PARSE_DWA20011020_H
|
||||
# define PARSE_DWA20011020_H
|
||||
# include "frames.h"
|
||||
# include "modules.h"
|
||||
# include "lists.h"
|
||||
#define PARSE_DWA20011020_H
|
||||
|
||||
#include "frames.h"
|
||||
#include "modules.h"
|
||||
#include "lists.h"
|
||||
|
||||
/*
|
||||
* parse.h - make and destroy parse trees as driven by the parser
|
||||
* parse.h - make and destroy parse trees as driven by the parser.
|
||||
*/
|
||||
|
||||
/*
|
||||
* parse tree node
|
||||
* Parse tree node.
|
||||
*/
|
||||
|
||||
struct _PARSE {
|
||||
LIST *(*func)( PARSE *p, FRAME *frame );
|
||||
PARSE *left;
|
||||
PARSE *right;
|
||||
PARSE *third;
|
||||
char *string;
|
||||
char *string1;
|
||||
LIST * (* func)( PARSE *, FRAME * );
|
||||
PARSE * left;
|
||||
PARSE * right;
|
||||
PARSE * third;
|
||||
char * string;
|
||||
char * string1;
|
||||
int num;
|
||||
int refs;
|
||||
/* module* module; */
|
||||
char* rulename;
|
||||
char* file;
|
||||
/* module * module; */
|
||||
char * rulename;
|
||||
char * file;
|
||||
int line;
|
||||
};
|
||||
|
||||
void parse_file( char *f, FRAME* frame );
|
||||
void parse_save( PARSE *p );
|
||||
void parse_file( char *, FRAME * );
|
||||
void parse_save( PARSE * );
|
||||
|
||||
PARSE * parse_make(
|
||||
LIST *(*func)( PARSE *p, FRAME* frame ),
|
||||
PARSE *left,
|
||||
PARSE *right,
|
||||
PARSE *third,
|
||||
char *string,
|
||||
char *string1,
|
||||
int num );
|
||||
LIST * (* func)( PARSE *, FRAME * ),
|
||||
PARSE * left,
|
||||
PARSE * right,
|
||||
PARSE * third,
|
||||
char * string,
|
||||
char * string1,
|
||||
int num );
|
||||
|
||||
void parse_refer( PARSE *p );
|
||||
void parse_free( PARSE *p );
|
||||
LIST* parse_evaluate( PARSE *p, FRAME* frame );
|
||||
void parse_refer ( PARSE * );
|
||||
void parse_free ( PARSE * );
|
||||
LIST * parse_evaluate( PARSE *, FRAME * );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
* 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 "jamgram.h"
|
||||
# include "jambase.h"
|
||||
# include "newstr.h"
|
||||
#include "jam.h"
|
||||
#include "lists.h"
|
||||
#include "parse.h"
|
||||
#include "scan.h"
|
||||
#include "jamgram.h"
|
||||
#include "jambase.h"
|
||||
#include "newstr.h"
|
||||
|
||||
/*
|
||||
* scan.c - the jam yacc scanner
|
||||
@@ -50,13 +50,15 @@ static struct include * incp = 0; /* current file; head of chain */
|
||||
|
||||
static int scanmode = SCAN_NORMAL;
|
||||
static int anyerrors = 0;
|
||||
|
||||
|
||||
static char * symdump( YYSTYPE * );
|
||||
|
||||
# define BIGGEST_TOKEN 10240 /* no single token can be larger */
|
||||
#define BIGGEST_TOKEN 10240 /* no single token can be larger */
|
||||
|
||||
|
||||
/*
|
||||
* Set parser mode: normal, string, or keyword
|
||||
* Set parser mode: normal, string, or keyword.
|
||||
*/
|
||||
|
||||
void yymode( int n )
|
||||
@@ -64,8 +66,8 @@ void yymode( int n )
|
||||
scanmode = n;
|
||||
}
|
||||
|
||||
void
|
||||
yyerror( char *s )
|
||||
|
||||
void yyerror( char * s )
|
||||
{
|
||||
if ( incp )
|
||||
printf( "%s:%d: ", incp->fname, incp->line );
|
||||
@@ -75,19 +77,18 @@ yyerror( char *s )
|
||||
++anyerrors;
|
||||
}
|
||||
|
||||
int
|
||||
yyanyerrors()
|
||||
|
||||
int yyanyerrors()
|
||||
{
|
||||
return anyerrors != 0;
|
||||
}
|
||||
|
||||
void
|
||||
yyfparse( char *s )
|
||||
|
||||
void yyfparse( char * s )
|
||||
{
|
||||
struct include *i = (struct include *)BJAM_MALLOC( sizeof( *i ) );
|
||||
struct include * i = (struct include *)BJAM_MALLOC( sizeof( *i ) );
|
||||
|
||||
/* Push this onto the incp chain. */
|
||||
|
||||
i->string = "";
|
||||
i->strings = 0;
|
||||
i->file = 0;
|
||||
@@ -97,76 +98,72 @@ yyfparse( char *s )
|
||||
incp = i;
|
||||
|
||||
/* If the filename is "+", it means use the internal jambase. */
|
||||
|
||||
if ( !strcmp( s, "+" ) )
|
||||
i->strings = jambase;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* yyline() - read new line and return first character
|
||||
* yyline() - read new line and return first character.
|
||||
*
|
||||
* Fabricates a continuous stream of characters across include files,
|
||||
* returning EOF at the bitter end.
|
||||
* Fabricates a continuous stream of characters across include files, returning
|
||||
* EOF at the bitter end.
|
||||
*/
|
||||
|
||||
int
|
||||
yyline()
|
||||
int yyline()
|
||||
{
|
||||
struct include *i = incp;
|
||||
struct include * i = incp;
|
||||
|
||||
if ( !incp )
|
||||
return EOF;
|
||||
|
||||
/* Once we start reading from the input stream, we reset the */
|
||||
/* include insertion point so that the next include file becomes */
|
||||
/* the head of the list. */
|
||||
/* Once we start reading from the input stream, we reset the include
|
||||
* insertion point so that the next include file becomes the head of the
|
||||
* list.
|
||||
*/
|
||||
|
||||
/* If there is more data in this line, return it. */
|
||||
|
||||
if ( *i->string )
|
||||
return *i->string++;
|
||||
|
||||
/* If we're reading from an internal string list, go to the */
|
||||
/* next string. */
|
||||
|
||||
/* If we are reading from an internal string list, go to the next string. */
|
||||
if ( i->strings )
|
||||
{
|
||||
if ( !*i->strings )
|
||||
goto next;
|
||||
|
||||
i->line++;
|
||||
++i->line;
|
||||
i->string = *(i->strings++);
|
||||
return *i->string++;
|
||||
}
|
||||
|
||||
/* If necessary, open the file */
|
||||
|
||||
/* If necessary, open the file. */
|
||||
if ( !i->file )
|
||||
{
|
||||
FILE * f = stdin;
|
||||
if ( strcmp( i->fname, "-" ) && !( f = fopen( i->fname, "r" ) ) )
|
||||
perror( i->fname );
|
||||
perror( i->fname );
|
||||
i->file = f;
|
||||
}
|
||||
|
||||
/* If there's another line in this file, start it. */
|
||||
|
||||
/* If there is another line in this file, start it. */
|
||||
if ( i->file && fgets( i->buf, sizeof( i->buf ), i->file ) )
|
||||
{
|
||||
i->line++;
|
||||
++i->line;
|
||||
i->string = i->buf;
|
||||
return *i->string++;
|
||||
}
|
||||
|
||||
next:
|
||||
/* This include is done. */
|
||||
/* Free it up and return EOF so yyparse() returns to parse_file(). */
|
||||
|
||||
/* This include is done. Free it up and return EOF so yyparse() returns to
|
||||
* parse_file().
|
||||
*/
|
||||
|
||||
incp = i->next;
|
||||
|
||||
/* Close file, free name */
|
||||
|
||||
if ( i->file && i->file != stdin )
|
||||
/* Close file, free name. */
|
||||
if ( i->file && ( i->file != stdin ) )
|
||||
fclose( i->file );
|
||||
freestr( i->fname );
|
||||
BJAM_FREE( (char *)i );
|
||||
@@ -174,20 +171,21 @@ yyline()
|
||||
return EOF;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* yylex() - set yylval to current token; return its type
|
||||
* yylex() - set yylval to current token; return its type.
|
||||
*
|
||||
* Macros to move things along:
|
||||
*
|
||||
* yychar() - return and advance character; invalid after EOF
|
||||
* yyprev() - back up one character; invalid before yychar()
|
||||
* yychar() - return and advance character; invalid after EOF.
|
||||
* yyprev() - back up one character; invalid before yychar().
|
||||
*
|
||||
* yychar() returns a continuous stream of characters, until it hits
|
||||
* the EOF of the current include file.
|
||||
* yychar() returns a continuous stream of characters, until it hits the EOF of
|
||||
* the current include file.
|
||||
*/
|
||||
|
||||
# define yychar() ( *incp->string ? *incp->string++ : yyline() )
|
||||
# define yyprev() ( incp->string-- )
|
||||
#define yychar() ( *incp->string ? *incp->string++ : yyline() )
|
||||
#define yyprev() ( incp->string-- )
|
||||
|
||||
int yylex()
|
||||
{
|
||||
@@ -198,21 +196,21 @@ int yylex()
|
||||
if ( !incp )
|
||||
goto eof;
|
||||
|
||||
/* Get first character (whitespace or of token) */
|
||||
|
||||
/* Get first character (whitespace or of token). */
|
||||
c = yychar();
|
||||
|
||||
if ( scanmode == SCAN_STRING )
|
||||
{
|
||||
/* If scanning for a string (action's {}'s), look for the */
|
||||
/* closing brace. We handle matching braces, if they match! */
|
||||
/* If scanning for a string (action's {}'s), look for the closing brace.
|
||||
* We handle matching braces, if they match.
|
||||
*/
|
||||
|
||||
int nest = 1;
|
||||
|
||||
while ( c != EOF && b < ( buf + sizeof( buf ) ) )
|
||||
while ( ( c != EOF ) && ( b < buf + sizeof( buf ) ) )
|
||||
{
|
||||
if ( c == '{' )
|
||||
nest++;
|
||||
++nest;
|
||||
|
||||
if ( ( c == '}' ) && !--nest )
|
||||
break;
|
||||
@@ -230,8 +228,7 @@ int yylex()
|
||||
if ( c != EOF )
|
||||
yyprev();
|
||||
|
||||
/* Check obvious errors. */
|
||||
|
||||
/* Check for obvious errors. */
|
||||
if ( b == buf + sizeof( buf ) )
|
||||
{
|
||||
yyerror( "action block too big" );
|
||||
@@ -244,12 +241,11 @@ int yylex()
|
||||
goto eof;
|
||||
}
|
||||
|
||||
* b = 0;
|
||||
*b = 0;
|
||||
yylval.type = STRING;
|
||||
yylval.string = newstr( buf );
|
||||
yylval.file = incp->fname;
|
||||
yylval.line = incp->line;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -258,37 +254,36 @@ int yylex()
|
||||
int inquote = 0;
|
||||
int notkeyword;
|
||||
|
||||
/* Eat white space */
|
||||
|
||||
/* Eat white space. */
|
||||
for ( ;; )
|
||||
{
|
||||
/* Skip past white space. */
|
||||
while ( ( c != EOF ) && isspace( c ) )
|
||||
c = yychar();
|
||||
|
||||
/* Not a comment? Swallow up comment line. */
|
||||
/* Not a comment? */
|
||||
if ( c != '#' )
|
||||
break;
|
||||
|
||||
/* Swallow up comment line. */
|
||||
while ( ( ( c = yychar() ) != EOF ) && ( c != '\n' ) ) ;
|
||||
}
|
||||
|
||||
/* c now points to the first character of a token. */
|
||||
|
||||
if ( c == EOF )
|
||||
goto eof;
|
||||
|
||||
yylval.file = incp->fname;
|
||||
yylval.line = incp->line;
|
||||
|
||||
/* While scanning the word, disqualify it for (expensive) */
|
||||
/* keyword lookup when we can: $anything, "anything", \anything */
|
||||
|
||||
/* While scanning the word, disqualify it for (expensive) keyword lookup
|
||||
* when we can: $anything, "anything", \anything
|
||||
*/
|
||||
notkeyword = c == '$';
|
||||
|
||||
/* look for white space to delimit word */
|
||||
/* "'s get stripped but preserve white space */
|
||||
/* \ protects next character */
|
||||
|
||||
/* Look for white space to delimit word. "'s get stripped but preserve
|
||||
* white space. \ protects next character.
|
||||
*/
|
||||
while
|
||||
(
|
||||
( c != EOF ) &&
|
||||
@@ -307,7 +302,7 @@ int yylex()
|
||||
/* normal char */
|
||||
*b++ = c;
|
||||
}
|
||||
else if ( ( c = yychar()) != EOF )
|
||||
else if ( ( c = yychar() ) != EOF )
|
||||
{
|
||||
/* \c */
|
||||
*b++ = c;
|
||||
@@ -323,44 +318,40 @@ int yylex()
|
||||
}
|
||||
|
||||
/* Check obvious errors. */
|
||||
|
||||
if ( b == buf + sizeof( buf ) )
|
||||
{
|
||||
yyerror( "string too big" );
|
||||
goto eof;
|
||||
yyerror( "string too big" );
|
||||
goto eof;
|
||||
}
|
||||
|
||||
if ( inquote )
|
||||
{
|
||||
yyerror( "unmatched \" in string" );
|
||||
goto eof;
|
||||
yyerror( "unmatched \" in string" );
|
||||
goto eof;
|
||||
}
|
||||
|
||||
/* We looked ahead a character - back up. */
|
||||
|
||||
if ( c != EOF )
|
||||
yyprev();
|
||||
yyprev();
|
||||
|
||||
/* scan token table */
|
||||
/* don't scan if it's obviously not a keyword or if its */
|
||||
/* an alphabetic when were looking for punctuation */
|
||||
/* Scan token table. Do not scan if it is obviously not a keyword or if
|
||||
* it is an alphabetic when were looking for punctuation.
|
||||
*/
|
||||
|
||||
*b = 0;
|
||||
yylval.type = ARG;
|
||||
|
||||
if ( !notkeyword && !( isalpha( *buf ) && scanmode == SCAN_PUNCT ) )
|
||||
{
|
||||
if ( !notkeyword && !( isalpha( *buf ) && ( scanmode == SCAN_PUNCT ) ) )
|
||||
for ( k = keywords; k->word; ++k )
|
||||
if ( ( *buf == *k->word ) && !strcmp( k->word, buf ) )
|
||||
{
|
||||
{
|
||||
yylval.type = k->type;
|
||||
yylval.string = k->word; /* used by symdump */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( yylval.type == ARG )
|
||||
yylval.string = newstr( buf );
|
||||
yylval.string = newstr( buf );
|
||||
}
|
||||
|
||||
if ( DEBUG_SCAN )
|
||||
@@ -376,8 +367,8 @@ eof:
|
||||
return yylval.type;
|
||||
}
|
||||
|
||||
static char *
|
||||
symdump( YYSTYPE *s )
|
||||
|
||||
static char * symdump( YYSTYPE * s )
|
||||
{
|
||||
static char buf[ BIGGEST_TOKEN + 20 ];
|
||||
switch ( s->type )
|
||||
@@ -392,9 +383,11 @@ symdump( YYSTYPE *s )
|
||||
}
|
||||
|
||||
|
||||
/* Get information about the current file and line, for those epsilon
|
||||
* transitions that produce a parse.
|
||||
/*
|
||||
* Get information about the current file and line, for those epsilon
|
||||
* transitions that produce a parse.
|
||||
*/
|
||||
|
||||
void yyinput_stream( char * * name, int * line )
|
||||
{
|
||||
if ( incp )
|
||||
|
||||
@@ -9,47 +9,48 @@
|
||||
*
|
||||
* External functions:
|
||||
*
|
||||
* yyerror( char *s ) - print a parsing error message
|
||||
* yyfparse( char *s ) - scan include file s
|
||||
* yylex() - parse the next token, returning its type
|
||||
* yymode() - adjust lexicon of scanner
|
||||
* yyparse() - declaration for yacc parser
|
||||
* yyanyerrors() - indicate if any parsing errors occured
|
||||
* yyerror( char *s ) - print a parsing error message.
|
||||
* yyfparse( char *s ) - scan include file s.
|
||||
* yylex() - parse the next token, returning its type.
|
||||
* yymode() - adjust lexicon of scanner.
|
||||
* yyparse() - declaration for yacc parser.
|
||||
* yyanyerrors() - indicate if any parsing errors occured.
|
||||
*
|
||||
* The yymode() function is for the parser to adjust the lexicon of the
|
||||
* scanner. Aside from normal keyword scanning, there is a mode to
|
||||
* handle action strings (look only for the closing }) and a mode to
|
||||
* ignore most keywords when looking for a punctuation keyword. This
|
||||
* allows non-punctuation keywords to be used in lists without quoting.
|
||||
* The yymode() function is for the parser to adjust the lexicon of the scanner.
|
||||
* Aside from normal keyword scanning, there is a mode to handle action strings
|
||||
* (look only for the closing }) and a mode to ignore most keywords when looking
|
||||
* for a punctuation keyword. This allows non-punctuation keywords to be used in
|
||||
* lists without quoting.
|
||||
*/
|
||||
|
||||
/*
|
||||
* YYSTYPE - value of a lexical token
|
||||
*/
|
||||
|
||||
# define YYSTYPE YYSYMBOL
|
||||
#define YYSTYPE YYSYMBOL
|
||||
|
||||
typedef struct _YYSTYPE {
|
||||
typedef struct _YYSTYPE
|
||||
{
|
||||
int type;
|
||||
char *string;
|
||||
PARSE *parse;
|
||||
LIST *list;
|
||||
char * string;
|
||||
PARSE * parse;
|
||||
LIST * list;
|
||||
int number;
|
||||
char *file;
|
||||
char * file;
|
||||
int line;
|
||||
} YYSTYPE;
|
||||
|
||||
extern YYSTYPE yylval;
|
||||
|
||||
void yymode( int n );
|
||||
void yyerror( char *s );
|
||||
void yyerror( char * s );
|
||||
int yyanyerrors();
|
||||
void yyfparse( char *s );
|
||||
void yyfparse( char * s );
|
||||
int yyline();
|
||||
int yylex();
|
||||
int yyparse();
|
||||
void yyinput_stream( char** name, int* line );
|
||||
void yyinput_stream( char * * name, int * line );
|
||||
|
||||
# define SCAN_NORMAL 0 /* normal parsing */
|
||||
# define SCAN_STRING 1 /* look only for matching } */
|
||||
# define SCAN_PUNCT 2 /* only punctuation keywords */
|
||||
# define SCAN_NORMAL 0 /* normal parsing */
|
||||
# define SCAN_STRING 1 /* look only for matching } */
|
||||
# define SCAN_PUNCT 2 /* only punctuation keywords */
|
||||
|
||||
Reference in New Issue
Block a user