[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/JScript/Parser EndOfFile.cs,NONE,1.1
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/JScript/Parser EndOfFile.cs,NONE,1.1 JSParser.cs,NONE,1.1 JSParserTest.cs,NONE,1.1 JSScanner.cs,NONE,1.1 JSScannerTest.cs,NONE,1.1 JSToken.cs,NONE,1.1 Makefile,NONE,1.1 ParserException.cs,NONE,1.1 |
Date: |
Mon, 13 Jan 2003 05:53:23 -0500 |
Update of /cvsroot/dotgnu-pnet/pnetlib/JScript/Parser
In directory subversions:/tmp/cvs-serv3129/JScript/Parser
Added Files:
EndOfFile.cs JSParser.cs JSParserTest.cs JSScanner.cs
JSScannerTest.cs JSToken.cs Makefile ParserException.cs
Log Message:
Perform the initial check-in of the JScript implementation (requires
treecc 0.2.0 or higher).
--- NEW FILE ---
/*
* EndOfFile.cs - Exception that is thrown at end of file.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace Microsoft.JScript
{
using System;
public class EndOfFile : ParserException
{
// Constructor.
internal EndOfFile() : base() {}
}; // class EndOfFile
}; // namespace Microsoft.JScript
--- NEW FILE ---
/*
* JSParser.cs - Main interface to the JScript parsing routines.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
[...1778 lines suppressed...]
}
}
// Exception that is used to handle error recovery in the parser.
private sealed class ErrorRecovery : Exception
{
// Accessible internal state.
public JScriptException error;
// Constructor.
public ErrorRecovery(JScriptException error)
{
this.error = error;
}
}; // class ErrorRecovery
}; // class JSParser
}; // namespace Microsoft.JScript
--- NEW FILE ---
/*
* JSParserTest.cs - Test support routines for JSParser.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace Microsoft.JScript
{
using System;
using System.Reflection;
#if TEST
// This class is provided for the benefit of the test suite, which
// needs to access the internal details of "JSParser". This class
// MUST NOT be used in application code as it is unique to this
// implementation and will not exist elsewhere. It is also subject
// to change without notice. You have been warned!
public sealed class JSParserTest
{
// Create a parser from a string.
public static JSParser TestCreateParser(String source)
{
return new JSParser(new Context(source));
}
// Get the JNode associated with an AST object.
public static Object TestJNodeGet(AST ast)
{
return ast.jnode;
}
// Get the kind of a JNode.
public static String TestJNodeGetKind(Object node)
{
return ((JNode)node).getKindName();
}
// Get a field within a JNode.
public static Object TestJNodeGetField(Object node, String name)
{
if(node == null)
{
return null;
}
FieldInfo field = node.GetType().GetField(name);
if(field == null)
{
return null;
}
return field.GetValue(node);
}
// Get the context associated with a JNode.
public static Context TestJNodeGetContext(Object node)
{
return ((JNode)node).context;
}
}; // class JSParserTest
#endif // TEST
}; // namespace Microsoft.JScript
--- NEW FILE ---
/*
* JSScanner.cs - Main interface to the JScript scanning routines.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
[...1550 lines suppressed...]
}
// Exception that is thrown from inside the scanner in exceptional
// conditions (e.g. EOF inside a comment, invalid character).
internal class ScannerFailure : Exception
{
// Accessible internal state.
public JSError error;
// Constructor.
public ScannerFailure(JSError error)
{
this.error = error;
}
}; // class ScannerFailure
}; // class JSScanner
}; // namespace Microsoft.JScript
--- NEW FILE ---
/*
* JSScannerTest.cs - Test support routines for JSScanner.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace Microsoft.JScript
{
using System;
#if TEST
// This class is provided for the benefit of the test suite, which
// needs to access the internal details of "JSScanner". This class
// MUST NOT be used in application code as it is unique to this
// implementation and will not exist elsewhere. It is also subject
// to change without notice. You have been warned!
public sealed class JSScannerTest
{
// Create a scanner from a string.
public static JSScanner TestCreateScanner(String source)
{
return new JSScanner(new Context(source));
}
// Get the last-parsed identifier name from a scanner.
public static String TestGetIdentifierName(JSScanner scanner)
{
return scanner.GetIdentifierName();
}
// Extract token information from a scanner.
public static Context TestGetTokenContext(JSScanner scanner)
{
return scanner.GetTokenContext();
}
// Parse a regular expression from a scanner.
public static bool TestParseRegex(JSScanner scanner, out String regex)
{
return scanner.ParseRegex(out regex);
}
// Extract an error code from a "ScannerFailure" exception.
public static JSError TestExtractError(Exception e)
{
if(e is JSScanner.ScannerFailure)
{
return
((JSScanner.ScannerFailure)e).error;
}
else
{
return JSError.NoError;
}
}
}; // class JSScannerTest
#endif // TEST
}; // namespace Microsoft.JScript
--- NEW FILE ---
/*
* JSToken.cs - Token codes for JScript constructs.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace Microsoft.JScript
{
public enum JSToken
{
None = -1,
EndOfFile = 0,
If = 1,
For = 2,
Do = 3,
While = 4,
Continue = 5,
Break = 6,
Return = 7,
Import = 8,
With = 9,
Switch = 10,
Throw = 11,
Try = 12,
Package = 13,
Internal = 14,
Abstract = 15,
Public = 16,
Static = 17,
Private = 18,
Protected = 19,
Final = 20,
Event = 21,
Var = 22,
Const = 23,
Class = 24,
Function = 25,
LeftCurly = 26,
Semicolon = 27,
Null = 28,
True = 29,
False = 30,
This = 31,
Identifier = 32,
StringLiteral = 33,
IntegerLiteral = 34,
NumericLiteral = 35,
LeftParen = 36,
LeftBracket = 37,
AccessField = 38,
LogicalNot = 39,
BitwiseNot = 40,
Delete = 41,
Void = 42,
Typeof = 43,
Increment = 44,
Decrement = 45,
Plus = 46,
Minus = 47,
LogicalOr = 48,
LogicalAnd = 49,
BitwiseOr = 50,
BitwiseXor = 51,
BitwiseAnd = 52,
Equal = 53,
NotEqual = 54,
StrictEqual = 55,
StrictNotEqual = 56,
GreaterThan = 57,
LessThan = 58,
LessThanEqual = 59,
GreaterThanEqual = 60,
LeftShift = 61,
RightShift = 62,
UnsignedRightShift = 63,
Multiply = 64,
Divide = 65,
Modulo = 66,
Instanceof = 67,
In = 68,
Assign = 69,
PlusAssign = 70,
MinusAssign = 71,
MultiplyAssign = 72,
DivideAssign = 73,
BitwiseAndAssign = 74,
BitwiseOrAssign = 75,
BitwiseXorAssign = 76,
ModuloAssign = 77,
LeftShiftAssign = 78,
RightShiftAssign = 79,
UnsignedRightShiftAssign = 80,
ConditionalIf = 81,
Colon = 82,
Comma = 83,
Case = 84,
Catch = 85,
Debugger = 86,
Default = 87,
Else = 88,
Export = 89,
Extends = 90,
Finally = 91,
Get = 92,
Implements = 93,
Interface = 94,
New = 95,
Set = 96,
Super = 97,
RightParen = 98,
RightCurly = 99,
RightBracket = 100,
PreProcessorConstant = 101,
Comment = 102,
UnterminatedComment = 103,
Assert = 104,
Boolean = 105,
Byte = 106,
Char = 107,
Decimal = 108,
Double = 109,
DoubleColon = 110,
Enum = 111,
Ensure = 112,
Float = 113,
Goto = 114,
Int = 115,
Invariant = 116,
Long = 117,
Namespace = 118,
Native = 119,
Require = 120,
Sbyte = 121,
Short = 122,
Synchronized = 123,
Transient = 124,
Throws = 125,
ParamArray = 126,
Volatile = 127,
Ushort = 128,
Uint = 129,
Ulong = 130,
Use = 131,
EndOfLine = 132,
PreProcessDirective = 133,
FirstOp = LogicalNot,
FirstBinaryOp = Plus,
LastPPOperator = Modulo,
LastAssign =
UnsignedRightShiftAssign,
LastBinaryOp = UnsignedRightShiftAssign,
LastOp = Comma
}; // enum JSToken
}; // namespace Microsoft.JScript
--- NEW FILE ---
# The build is done in "runtime", so cd up and use that Makefile.
all:
(cd ..;make)
clean:
(cd ..;make clean)
--- NEW FILE ---
/*
* ParserException.cs - Exception that is thrown by the JScript parser.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace Microsoft.JScript
{
using System;
public class ParserException : Exception
{
// Constructor.
internal ParserException()
: base("JScript parser failed")
{
// Nothing to do here.
}
}; // class ParserException
}; // namespace Microsoft.JScript
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/JScript/Parser EndOfFile.cs,NONE,1.1 JSParser.cs,NONE,1.1 JSParserTest.cs,NONE,1.1 JSScanner.cs,NONE,1.1 JSScannerTest.cs,NONE,1.1 JSToken.cs,NONE,1.1 Makefile,NONE,1.1 ParserException.cs,NONE,1.1,
Rhys Weatherley <address@hidden> <=