svn commit: samba r7214 - in branches/SAMBA_4_0/source/lib/ejs: .

tpot at samba.org tpot at samba.org
Fri Jun 3 07:56:42 GMT 2005


Author: tpot
Date: 2005-06-03 07:56:41 +0000 (Fri, 03 Jun 2005)
New Revision: 7214

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7214

Log:
Undo my interpreter patch.  Tridge thought of a much better way to do it
that doesn't involve any changes to ejs at all.

Modified:
   branches/SAMBA_4_0/source/lib/ejs/ejs.c
   branches/SAMBA_4_0/source/lib/ejs/ejsInternal.h
   branches/SAMBA_4_0/source/lib/ejs/ejsLex.c
   branches/SAMBA_4_0/source/lib/ejs/ejsParser.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ejs/ejs.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ejs/ejs.c	2005-06-03 07:47:06 UTC (rev 7213)
+++ branches/SAMBA_4_0/source/lib/ejs/ejs.c	2005-06-03 07:56:41 UTC (rev 7214)
@@ -418,10 +418,8 @@
 	endlessLoopTest = NULL;
 	ep->exitStatus = 0;
 
-	ejsParse(ep, EJS_STATE_BEGIN, EJS_FLAGS_EXE); /* Skip over #! */
-
 	do {
-		state = ejsParse(ep, EJS_STATE_STMT, EJS_FLAGS_EXE);
+		state = ejsParse(ep, EJS_STATE_BEGIN, EJS_FLAGS_EXE);
 
 		if (state == EJS_STATE_RET) {
 			state = EJS_STATE_EOF;

Modified: branches/SAMBA_4_0/source/lib/ejs/ejsInternal.h
===================================================================
--- branches/SAMBA_4_0/source/lib/ejs/ejsInternal.h	2005-06-03 07:47:06 UTC (rev 7213)
+++ branches/SAMBA_4_0/source/lib/ejs/ejsInternal.h	2005-06-03 07:56:41 UTC (rev 7214)
@@ -100,7 +100,7 @@
 #define EJS_TOK_IN					26		/* in */
 #define EJS_TOK_FUNCTION			27		/* function */
 #define EJS_TOK_NUMBER				28		/* Number */
-#define EJS_TOK_HASHBANG            29      /* #!/path/to/interpreter */
+
 /*
  *	Expression operators
  */
@@ -150,8 +150,9 @@
 #define EJS_STATE_DEC				18		/* Declaration statement */
 #define EJS_STATE_DEC_DONE			19
 #define EJS_STATE_RET				20		/* Return statement */
-#define EJS_STATE_BEGIN             21      /* Start of script */
 
+#define EJS_STATE_BEGIN				EJS_STATE_STMT
+
 /*
  *	General parsing flags.
  */

Modified: branches/SAMBA_4_0/source/lib/ejs/ejsLex.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ejs/ejsLex.c	2005-06-03 07:47:06 UTC (rev 7213)
+++ branches/SAMBA_4_0/source/lib/ejs/ejsLex.c	2005-06-03 07:56:41 UTC (rev 7214)
@@ -674,26 +674,6 @@
 			inputPutback(ep, c);
 			return EJS_TOK_NUMBER;
 
-		case '#':
-			if (ip->lineNumber == 1) {
-				if ((c = inputGetc(ep)) < 0) {
-					ejsError(ep, "Syntax Error");
-					return EJS_TOK_ERR;
-				}
-				if (c != '!') {
-					ejsError(ep, "Syntax Error");
-					return EJS_TOK_ERR;
-				}
-				while ((c = inputGetc(ep)) != -1) {
-					if (c == '\r' || c == '\n')
-						break;
-					tokenAddChar(ep, c);
-				}
-				return EJS_TOK_HASHBANG;
-			}
-
-			/* Fall through to default handling */
-
 		default:
 			/*
 			 *	Identifiers or a function names

Modified: branches/SAMBA_4_0/source/lib/ejs/ejsParser.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ejs/ejsParser.c	2005-06-03 07:47:06 UTC (rev 7213)
+++ branches/SAMBA_4_0/source/lib/ejs/ejsParser.c	2005-06-03 07:56:41 UTC (rev 7214)
@@ -67,7 +67,6 @@
 static int 		parseInc(Ejs *ep, int state, int flags);
 static int 		parseIf(Ejs *ep, int state, int flags, int *done);
 static int		parseStmt(Ejs *ep, int state, int flags);
-static int		parseHashBang(Ejs *ep, int state, int flags);
 static void 	removeNewlines(Ejs *ep, int state);
 static void 	updateResult(Ejs *ep, int state, int flags, MprVar *vp);
 
@@ -82,12 +81,6 @@
 
 	switch (state) {
 	/*
-	 *	The very start of a script.
-	 */
-	case EJS_STATE_BEGIN:
-		state = parseHashBang(ep, state, flags);
-		break;
-	/*
 	 *	Any statement, function arguments or conditional expressions
 	 */
 	case EJS_STATE_STMT:
@@ -149,26 +142,6 @@
 
 /******************************************************************************/
 /*
- *	Parse a #!/path/to/interpreter line which we just throw away.
- */
-
-static int parseHashBang(Ejs *ep, int state, int flags)
-{
-	int tid;
-
-	/* Look for #! */
-
-	tid = ejsLexGetToken(ep, state);
-
-	if (tid != EJS_TOK_HASHBANG) {
-		ejsLexPutbackToken(ep, tid, ep->token);
-	}
-
-	return EJS_STATE_STMT;
-}
-
-/******************************************************************************/
-/*
  *	Parse any statement including functions and simple relational operations
  */
 



More information about the samba-cvs mailing list