Author: olivier
Date: 2007-05-26 18:52:46 -0400 (Sat, 26 May 2007)
New Revision: 77993
Added:
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.ParseTree/BlockStatement.cs
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.ParseTree/Expression.cs
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.ParseTree/Statement.cs
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/BadToken.cs
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Compiler.cs
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/DList.cs
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Identifier.cs
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/JavaScriptCompiler.cs
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/NumericLiteralToken.cs
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Parser.cs
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/StringLiteralToken.cs
Modified:
trunk/olive/class/Mono.JScript.Compiler/ChangeLog
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.csproj
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.suo
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/IdentifierTable.cs
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/SourceLocation.cs
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/TextSpan.cs
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Token.cs
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Tokenizer.cs
trunk/olive/class/Mono.JScript.Compiler/test/LexerTest.cs
Log:
2007-05-27 Olivier Dufour <[EMAIL PROTECTED]>
* Add a lof of stubs :BlockStatement, Expression, Statement, BadToken,
Compiler, DList, Identifier, JavaScriptCompiler, NumericLiteralToken, Parser,
StringLiteralToken
* Start to done the manual parser
Modified: trunk/olive/class/Mono.JScript.Compiler/ChangeLog
===================================================================
--- trunk/olive/class/Mono.JScript.Compiler/ChangeLog 2007-05-26 19:20:35 UTC
(rev 77992)
+++ trunk/olive/class/Mono.JScript.Compiler/ChangeLog 2007-05-26 22:52:46 UTC
(rev 77993)
@@ -1,3 +1,9 @@
+2007-05-27 Olivier Dufour <[EMAIL PROTECTED]>
+
+ * Add a lof of stubs :BlockStatement, Expression, Statement, BadToken,
Compiler, DList, Identifier, JavaScriptCompiler, NumericLiteralToken, Parser,
StringLiteralToken
+ * Start to done the manual parser
+
+
2007-05-26 Olivier Dufour <[EMAIL PROTECTED]>
* initial commit
\ No newline at end of file
Added: trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/BadToken.cs
===================================================================
--- trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/BadToken.cs
2007-05-26 19:20:35 UTC (rev 77992)
+++ trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/BadToken.cs
2007-05-26 22:52:46 UTC (rev 77993)
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Mono.JScript.Compiler
+{
+ public class BadToken
+ {
+ }
+}
Added: trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Compiler.cs
===================================================================
--- trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Compiler.cs
2007-05-26 19:20:35 UTC (rev 77992)
+++ trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Compiler.cs
2007-05-26 22:52:46 UTC (rev 77993)
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Mono.JScript.Compiler
+{
+ public class Compiler
+ {
+ }
+}
Added: trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/DList.cs
===================================================================
--- trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/DList.cs
2007-05-26 19:20:35 UTC (rev 77992)
+++ trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/DList.cs
2007-05-26 22:52:46 UTC (rev 77993)
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Mono.JScript.Compiler
+{
+ public class DList<ElementType, ParentType>
+ {
+ public DList ()
+ {
+ throw new NotImplementedException ();
+ }
+ public void Append (ElementType Item)
+ {
+ throw new NotImplementedException ();
+ }
+ public DList<ElementType, ParentType> Copy ()
+ {
+ throw new NotImplementedException ();
+ }
+ public ElementType Last ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public ParentType Parent {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public class Iterator
+ {
+ public Iterator (DList<ElementType, ParentType> DL)
+ {
+ throw new NotImplementedException ();
+ }
+ public void Advance ()
+ {
+ throw new NotImplementedException ();
+ }
+ public void Insert (ElementType Item)
+ {
+ throw new NotImplementedException ();
+ }
+ public void Remove ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public ElementType Element {
+ get { throw new NotImplementedException (); }
+ }
+ public bool ElementAvailable {
+ get { throw new NotImplementedException (); }
+ }
+ }
+ }
+}
Added:
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Identifier.cs
===================================================================
--- trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Identifier.cs
2007-05-26 19:20:35 UTC (rev 77992)
+++ trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Identifier.cs
2007-05-26 22:52:46 UTC (rev 77993)
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Mono.JScript.Compiler
+{
+ public class Identifier
+ {
+ }
+}
Modified:
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/IdentifierTable.cs
===================================================================
---
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/IdentifierTable.cs
2007-05-26 19:20:35 UTC (rev 77992)
+++
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/IdentifierTable.cs
2007-05-26 22:52:46 UTC (rev 77993)
@@ -6,6 +6,25 @@
{
public class IdentifierTable
{
+ public IdentifierTable ()
+ {
+ throw new NotImplementedException ();
+ }
+ public Identifier InsertIdentifier (string Spelling)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Identifier InsertIdentifier (char[] Text, int
StartIndex, int Count)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ public int NextIdentifierID {
+ get { throw new NotImplementedException (); }
+ }
+
}
}
Added:
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/JavaScriptCompiler.cs
===================================================================
---
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/JavaScriptCompiler.cs
2007-05-26 19:20:35 UTC (rev 77992)
+++
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/JavaScriptCompiler.cs
2007-05-26 22:52:46 UTC (rev 77993)
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Mono.JScript.Compiler
+{
+ public class JavaScriptCompiler
+ {
+ }
+}
Added:
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/NumericLiteralToken.cs
===================================================================
---
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/NumericLiteralToken.cs
2007-05-26 19:20:35 UTC (rev 77992)
+++
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/NumericLiteralToken.cs
2007-05-26 22:52:46 UTC (rev 77993)
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Mono.JScript.Compiler
+{
+ public class NumericLiteralToken
+ {
+ }
+}
Added: trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Parser.cs
===================================================================
--- trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Parser.cs
2007-05-26 19:20:35 UTC (rev 77992)
+++ trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Parser.cs
2007-05-26 22:52:46 UTC (rev 77993)
@@ -0,0 +1,136 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Mono.JScript.Compiler.ParseTree;
+
+namespace Mono.JScript.Compiler
+{
+ public class Parser
+ {
+ public Parser (char[] Input) : this(Input,new IdentifierTable())
+ {
+ }
+
+ public Parser (char[] Input, IdentifierTable IDTable)
+ {
+ lexer = new Tokenizer (Input, IDTable);
+ }
+
+ private Tokenizer lexer;
+ private Token current;
+ private List<String> SyntaxError = new List<string>();
+ private bool syntaxIncomplete = false;
+
+ public DList<Statement, BlockStatement> ParseProgram (ref
List<Comment> Comments)
+ {
+ DList<Statement, BlockStatement> result = new
DList<Statement, BlockStatement> ();
+
+ while (current.Kind != Token.Type.EndOfInput) {
+ Next ();
+ if (current.Kind == Token.Type.Function)
+ result.Append (ParseFunctionDeclaration
());
+ else
+ result.Append (ParseStatement ());
+ }
+ Comments = lexer.Comments;
+ return result;
+ }
+
+ public Statement ParseFunctionDeclaration()
+ {
+ Token start = current;
+ Next ();
+ CheckSyntaxExpected (Token.Type.Identifier);
+ Next ();
+ CheckSyntaxExpected(Token.Type.LeftParenthesis);
+ Next ();
+ ParseListParametter ();
+ CheckSyntaxExpected (Token.Type.RightParenthesis);
+ Next ();
+ ParseBlock ();
+ return new Statement (Statement.Operation.Function, new
TextSpan
(start.StartLine,start.StartColumn,lexer.Position.Line,lexer.Position.Column,
start.StartPosition,lexer.Position.Index));
+ }
+
+ private void ParseListParametter ()
+ {
+ CheckSyntaxExpected (Token.Type.Identifier);
+ Next ();
+ while (current.Kind == Token.Type.Coma) {
+ Next ();
+ CheckSyntaxExpected (Token.Type.Identifier);
+ Next ();
+ }
+ }
+
+ private void ParseBlock ()
+ {
+ CheckSyntaxExpected (Token.Type.LeftBrace);
+ Next ();
+ ParseListStatement ();
+ CheckSyntaxExpected (Token.Type.RightBrace);
+ }
+
+ private void ParseListStatement ()
+ {
+ while (current.Kind != Token.Type.RightBrace &&
current.Kind != Token.Type.EndOfInput) {
+ ParseStatement ();
+ }
+ }
+
+ public Expression ParseExpression (ref List<Comment> Comments)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Statement ParseStatement (ref List<Comment> Comments)
+ {
+ return ParseStatement ();
+ }
+
+ private Statement ParseStatement ()
+ {
+ //TODO
+ /*
+ block { $$ = $1; }
+ | decl_var { $$ = $1; }
+ | setvar { $$ = $1; }
+ | if_else { $$ = $1; }
+ | while { $$ = $1; }
+ | do { $$ = $1; }
+ | for { $$ = $1; }
+ | continue { $$ = $1; }
+ | with { $$ = $1; }
+ | switch { $$ = $1; }
+ | throw { $$ = $1; }
+ | try { $$ = $1; }
+ | proc_call { $$ = $1; }
+ | return { $$ = $1; }
+ | function_decl
+ | inner_call
+ | increment_or_decremente
+ */
+ throw new Exception ("The method or operation is not
implemented.");
+ }
+
+ private void Next ()
+ {
+ current = lexer.GetNext ();
+ }
+ private void CheckSyntaxExpected (Token.Type type)
+ {
+ if (current.Kind != type)
+ SyntaxError.Add (Enum.GetName
(typeof(Token.Type), type) + " expected.");
+ }
+
+ public bool SyntaxIncomplete ()
+ {
+ return syntaxIncomplete;
+ }
+
+ public bool SyntaxOK ()
+ {
+ return (SyntaxError.Count > 0);
+ }
+
+ }
+}
Modified:
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/SourceLocation.cs
===================================================================
---
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/SourceLocation.cs
2007-05-26 19:20:35 UTC (rev 77992)
+++
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/SourceLocation.cs
2007-05-26 22:52:46 UTC (rev 77993)
@@ -1,10 +1,85 @@
using System;
using System.Collections.Generic;
using System.Text;
-
+//TODO move to Mono.Scripting
namespace Mono.JScript.Compiler
{
public class SourceLocation
{
+ public static readonly SourceLocation None;
+ public static readonly SourceLocation Invalid;
+ public static readonly SourceLocation MinValue;
+
+ public SourceLocation (int index, int line, int column)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public int Index {
+ get { throw new NotImplementedException (); }
+ }
+
+ public int Line {
+ get { throw new NotImplementedException (); }
+ }
+
+ public int Column {
+ get { throw new NotImplementedException (); }
+ }
+
+ public static bool operator == (SourceLocation left,
SourceLocation right)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static bool operator != (SourceLocation left,
SourceLocation right)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static bool operator < (SourceLocation left,
SourceLocation right)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static bool operator > (SourceLocation left,
SourceLocation right)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static bool operator <= (SourceLocation left,
SourceLocation right)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static bool operator >= (SourceLocation left,
SourceLocation right)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static int Compare (SourceLocation left, SourceLocation
right)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public bool IsValid {
+ get { throw new NotImplementedException (); }
+ }
+
+ public override bool Equals (object obj)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override int GetHashCode ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+
}
}
Added:
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/StringLiteralToken.cs
===================================================================
---
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/StringLiteralToken.cs
2007-05-26 19:20:35 UTC (rev 77992)
+++
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/StringLiteralToken.cs
2007-05-26 22:52:46 UTC (rev 77993)
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Mono.JScript.Compiler
+{
+ public class StringLiteralToken
+ {
+ }
+}
Modified:
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/TextSpan.cs
===================================================================
--- trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/TextSpan.cs
2007-05-26 19:20:35 UTC (rev 77992)
+++ trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/TextSpan.cs
2007-05-26 22:52:46 UTC (rev 77993)
@@ -6,5 +6,31 @@
{
public class TextSpan
{
+ public TextSpan (int StartLine, int StartColumn, int EndLine,
int EndColumn, int StartPosition, int EndPosition)
+ {
+ this.startLine = StartLine;
+ this.startColumn = StartColumn;
+ this.endLine = EndLine;
+ this.endColumn = EndColumn;
+ this.startPosition = StartPosition;
+ this.endPosition = EndPosition;
+ }
+
+
+ private int startLine;
+ private int startColumn;
+ private int endLine;
+ private int endColumn;
+ private int startPosition;
+ private int endPosition;
+
+ public int StartLine { get { return startLine; } }
+ public int StartColumn { get { return startColumn; } }
+ public int EndLine { get { return endLine; } }
+ public int EndColumn { get { return endColumn; } }
+ public int StartPosition { get { return startPosition; } }
+ public int EndPosition { get { return endPosition; } }
+ public int Width { get { return endPosition - startPosition; } }
+
}
}
Modified: trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Token.cs
===================================================================
--- trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Token.cs
2007-05-26 19:20:35 UTC (rev 77992)
+++ trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Token.cs
2007-05-26 22:52:46 UTC (rev 77993)
@@ -11,7 +11,8 @@
/// </summary>
public enum Type
{
- EOF = 0,
+ None = 0,
+ EndOfInput = 0,
//Punctuator
LeftBrace,// {
@@ -40,12 +41,12 @@
LessLess,// <<
GreaterGreater,// >>
GreaterGreaterGreater,// >>>
- And,// &
+ Ampersand,// &
Bar,// |
Circumflex,// ^
Bang,// !
Tilda,// ~
- AndAnd,// &&
+ AmpersandAmpersand,// &&
BarBar,// ||
Question,// ?
Colon,// :
@@ -57,11 +58,11 @@
LessLessEqual,// <<=
GreaterGreaterEqual,// >>=
GreaterGreaterGreaterEqual,// >>>=
- AndEqual,// &=
+ AmpersandEqual,// &=
BarEqual,// |=
CircumflexEqual,// ^=
- Slash,// /
- SlashEqual,// /=
+ Divide,// /
+ DivideEqual,// /=
//Keywords
Break,
@@ -129,12 +130,14 @@
False,
NumericLiteral,
HexIntegerLiteral,
+ OctalIntegerLiteral,
StringLiteral,
RegularExpressionLiteral,
Identifier,
- Error
+ Bad,
+ Comment
}
public Token(Token.Type Kind, int StartPosition, int StartLine,
int StartColumn, bool FirstOnLine)
Modified:
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Tokenizer.cs
===================================================================
--- trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Tokenizer.cs
2007-05-26 19:20:35 UTC (rev 77992)
+++ trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler/Tokenizer.cs
2007-05-26 22:52:46 UTC (rev 77993)
@@ -36,12 +36,12 @@
//whereas we already know it here
if (!Advance())
- return new Token (Token.Type.EOF, position,
row, position - lineStartPosition, position == lineStartPosition);
+ return new Token (Token.Type.EndOfInput,
position, row, position - lineStartPosition, position == lineStartPosition);
StripWhiteSpace();
if (!Advance())
- return new Token (Token.Type.EOF, position,
row, position - lineStartPosition, position == lineStartPosition);
+ return new Token (Token.Type.EndOfInput,
position, row, position - lineStartPosition, position == lineStartPosition);
char next = source[position];
int nextPos;
@@ -172,13 +172,13 @@
nextPos = position + 1;
if (nextPos < source.Length &&
source[nextPos] == '&') {
position++;
- return
CreateToken(Token.Type.AndAnd);
+ return
CreateToken(Token.Type.AmpersandAmpersand);
}
else if (nextPos < source.Length &&
source[nextPos] == '=') {
position++;
- return
CreateToken(Token.Type.AndEqual);
+ return
CreateToken(Token.Type.AmpersandEqual);
}
- return CreateToken(Token.Type.And);
+ return CreateToken
(Token.Type.Ampersand);
case '|':
nextPos = position + 1;
if (nextPos < source.Length &&
source[nextPos] == '|') {
@@ -207,7 +207,7 @@
nextPos = position + 1;
if (nextPos < source.Length &&
source[nextPos] == '=') {
position++;
- return
CreateToken(Token.Type.SlashEqual);
+ return
CreateToken(Token.Type.DivideEqual);
}
else if (nextPos < source.Length &&
source[nextPos] == '/') {
position++;
@@ -219,7 +219,7 @@
CreateBlockComment();
return GetNext ();
}
- return CreateToken(Token.Type.Slash);
+ return CreateToken(Token.Type.Divide);
case '0':
case '1':
case '2':
@@ -288,7 +288,7 @@
case '_':
return this.CreateIdentOrKeyword();
}
- return CreateToken(Token.Type.Error);
+ return CreateToken(Token.Type.Bad);
}
public RegularExpressionLiteralToken ScanRegularExpression
(Token Divide)
@@ -412,6 +412,7 @@
current = new Token (type, position, row,
position - lineStartPosition, position == lineStartPosition);
return current;
}
+ this.IDTable.InsertIdentifier (result);
current = new Token (Token.Type.Identifier, position,
row, position - lineStartPosition, position == lineStartPosition);
return current;
}
@@ -441,7 +442,7 @@
case '.': {
dot++;
if (dot > 1) {
- current = new
Token (Token.Type.Error, position, row, position - lineStartPosition, position
== lineStartPosition);
+ current = new
Token (Token.Type.Bad, position, row, position - lineStartPosition, position ==
lineStartPosition);
return current;
}
builder.Append(next);
Added:
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.ParseTree/BlockStatement.cs
===================================================================
---
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.ParseTree/BlockStatement.cs
2007-05-26 19:20:35 UTC (rev 77992)
+++
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.ParseTree/BlockStatement.cs
2007-05-26 22:52:46 UTC (rev 77993)
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Mono.JScript.Compiler.ParseTree
+{
+ public class BlockStatement : Statement
+ {
+ public readonly DList<Statement, BlockStatement> Children;
+
+ public BlockStatement (DList<Statement, BlockStatement>
Children, TextSpan Location) : base(Statement.Operation.Block, Location)
+ {
+ throw new NotImplementedException ();
+ }
+
+ }
+}
Added:
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.ParseTree/Expression.cs
===================================================================
---
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.ParseTree/Expression.cs
2007-05-26 19:20:35 UTC (rev 77992)
+++
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.ParseTree/Expression.cs
2007-05-26 22:52:46 UTC (rev 77993)
@@ -0,0 +1,87 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Mono.JScript.Compiler.ParseTree
+{
+ public class Expression
+ {
+ public readonly TextSpan Location;
+ public readonly Operation Opcode;
+
+ public Expression (Operation Opcode, TextSpan Location)
+ {
+ }
+
+ public enum Operation
+ {
+ SyntaxError,
+ This,
+ False,
+ True,
+ Identifier,
+ NumericLiteral,
+ HexLiteral,
+ OctalLiteral,
+ RegularExpressionLiteral,
+ StringLiteral,
+ ArrayLiteral,
+ ObjectLiteral,
+ Parenthesized,
+ Invocation,
+ Subscript,
+ Qualified,
+ New,
+ Function,
+ Delete,
+ Void,
+ Typeof,
+ PrefixPlusPlus,
+ PrefixMinusMinus,
+ PrefixPlus,
+ PrefixMinus,
+ Tilda,
+ Bang,
+ PostfixPlusPlus,
+ PostfixMinusMinus,
+ Comma,
+ Equal,
+ StarEqual,
+ DivideEqual,
+ PercentEqual,
+ PlusEqual,
+ MinusEqual,
+ LessLessEqual,
+ GreaterGreaterEqual,
+ GreaterGreaterGreaterEqual,
+ AmpersandEqual,
+ CircumflexEqual,
+ BarEqual,
+ BarBar,
+ AmpersandAmpersand,
+ Bar,
+ Circumflex,
+ Ampersand,
+ EqualEqual,
+ BangEqual,
+ EqualEqualEqual,
+ BangEqualEqual,
+ Less,
+ Greater,
+ LessEqual,
+ GreaterEqual,
+ Instanceof,
+ In,
+ LessLess,
+ GreaterGreater,
+ GreaterGreaterGreater,
+ Plus,
+ Minus,
+ Star,
+ Divide,
+ Percent,
+ Question,
+ Null
+ }
+ }
+}
Added:
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.ParseTree/Statement.cs
===================================================================
---
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.ParseTree/Statement.cs
2007-05-26 19:20:35 UTC (rev 77992)
+++
trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.ParseTree/Statement.cs
2007-05-26 22:52:46 UTC (rev 77993)
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Mono.JScript.Compiler.ParseTree
+{
+ public class Statement
+ {
+ public readonly TextSpan Location;
+ public readonly Operation Opcode;
+
+ public Statement (Operation Opcode, TextSpan Location)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public enum Operation
+ {
+ Block,
+ VariableDeclaration,
+ Empty,
+ Expression,
+ If,
+ Do,
+ While,
+ ExpressionFor,
+ DeclarationFor,
+ ExpressionForIn,
+ DeclarationForIn,
+ Break,
+ Continue,
+ Return,
+ With,
+ Label,
+ Switch,
+ Throw,
+ Try,
+ Function,
+ SyntaxError
+ }
+ }
+}
Modified: trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.csproj
===================================================================
--- trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.csproj
2007-05-26 19:20:35 UTC (rev 77992)
+++ trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.csproj
2007-05-26 22:52:46 UTC (rev 77993)
@@ -39,10 +39,21 @@
</Target>
-->
<ItemGroup>
+ <Compile Include="Mono.JScript.Compiler.ParseTree\BlockStatement.cs" />
+ <Compile Include="Mono.JScript.Compiler.ParseTree\Expression.cs" />
+ <Compile Include="Mono.JScript.Compiler.ParseTree\Statement.cs" />
+ <Compile Include="Mono.JScript.Compiler\BadToken.cs" />
<Compile Include="Mono.JScript.Compiler\Comment.cs" />
+ <Compile Include="Mono.JScript.Compiler\Compiler.cs" />
+ <Compile Include="Mono.JScript.Compiler\DList.cs" />
+ <Compile Include="Mono.JScript.Compiler\Identifier.cs" />
<Compile Include="Mono.JScript.Compiler\IdentifierTable.cs" />
+ <Compile Include="Mono.JScript.Compiler\JavaScriptCompiler.cs" />
+ <Compile Include="Mono.JScript.Compiler\NumericLiteralToken.cs" />
+ <Compile Include="Mono.JScript.Compiler\Parser.cs" />
<Compile Include="Mono.JScript.Compiler\RegularExpressionLiteralToken.cs"
/>
<Compile Include="Mono.JScript.Compiler\SourceLocation.cs" />
+ <Compile Include="Mono.JScript.Compiler\StringLiteralToken.cs" />
<Compile Include="Mono.JScript.Compiler\TextSpan.cs" />
<Compile Include="Mono.JScript.Compiler\Tokenizer.cs" />
<Compile Include="Mono.JScript.Compiler\Token.cs" />
@@ -54,7 +65,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Mono.JScript.Compiler.Hosting\" />
- <Folder Include="Mono.JScript.Compiler.ParseTree\" />
<Folder Include="Mono.JScript.Compiler.Shell\" />
</ItemGroup>
</Project>
\ No newline at end of file
Modified: trunk/olive/class/Mono.JScript.Compiler/Mono.JScript.Compiler.suo
===================================================================
(Binary files differ)
Modified: trunk/olive/class/Mono.JScript.Compiler/test/LexerTest.cs
===================================================================
--- trunk/olive/class/Mono.JScript.Compiler/test/LexerTest.cs 2007-05-26
19:20:35 UTC (rev 77992)
+++ trunk/olive/class/Mono.JScript.Compiler/test/LexerTest.cs 2007-05-26
22:52:46 UTC (rev 77993)
@@ -19,7 +19,7 @@
//Assert.AreEqual("10", l1.Value());
Assert.AreEqual (Token.Type.SemiColon,
l1.GetNext().Kind);
//Assert.IsFalse(l1.Advance());
- Assert.AreEqual (Token.Type.EOF, l1.GetNext().Kind);
+ Assert.AreEqual (Token.Type.EndOfInput,
l1.GetNext().Kind);
}
[Test]
@@ -31,7 +31,7 @@
Assert.AreEqual (Token.Type.PlusPlus,
l1.GetNext().Kind);
Assert.AreEqual (Token.Type.SemiColon,
l1.GetNext().Kind);
//Assert.IsFalse(l1.Advance());
- Assert.AreEqual (Token.Type.EOF, l1.GetNext().Kind);
+ Assert.AreEqual (Token.Type.EndOfInput, l1.GetNext
().Kind);
}
[Test]
@@ -43,7 +43,7 @@
Assert.AreEqual (Token.Type.MinusMinus,
l1.GetNext().Kind);
Assert.AreEqual (Token.Type.SemiColon,
l1.GetNext().Kind);
//Assert.IsFalse(l1.Advance());
- Assert.AreEqual (Token.Type.EOF, l1.GetNext().Kind);
+ Assert.AreEqual (Token.Type.EndOfInput, l1.GetNext
().Kind);
}
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches