dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/JScript/Parser JSParser.cs,1.2,1.3


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/JScript/Parser JSParser.cs,1.2,1.3
Date: Thu, 06 Mar 2003 20:08:40 -0500

Update of /cvsroot/dotgnu-pnet/pnetlib/JScript/Parser
In directory subversions:/tmp/cvs-serv26973/JScript/Parser

Modified Files:
        JSParser.cs 
Log Message:


Implement builtin function invocation support; make Call/Construct re-entrant.


Index: JSParser.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/JScript/Parser/JSParser.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** JSParser.cs 14 Jan 2003 12:37:36 -0000      1.2
--- JSParser.cs 7 Mar 2003 01:08:36 -0000       1.3
***************
*** 1819,1822 ****
--- 1819,1855 ----
                        }
  
+       // Parse the input source to get a function definition.
+       internal JFunction ParseFunctionSource()
+                       {
+                               JNode function;
+                               Context start = context.MakeCopy();
+                               try
+                               {
+                                       // Pre-fetch the first token.
+                                       if(token == JSToken.None)
+                                       {
+                                               NextToken();
+                                       }
+ 
+                                       // Parse the function definition.
+                                       function = Function(false);
+ 
+                                       // We need to be at EOF now.
+                                       Expect(JSToken.EndOfFile, "end of file 
expected");
+                               }
+                               catch(JSScanner.ScannerFailure e)
+                               {
+                                       // The scanner detected an error in the 
input stream.
+                                       throw new 
JScriptException(JSError.SyntaxError,
+                                                                               
           tokenInfo.MakeCopy());
+                               }
+                               catch(ErrorRecovery er)
+                               {
+                                       // No error recovery done, so re-throw 
the syntax error.
+                                       throw er.error;
+                               }
+                               return (JFunction)function;
+                       }
+ 
        // Exception that is used to handle error recovery in the parser.
        private sealed class ErrorRecovery : Exception





reply via email to

[Prev in Thread] Current Thread [Next in Thread]