示例#1
0
		public Parser (char[] Input, IdentifierTable IDTable, bool ECMA3Mode)
		{
			this.ECMA3Mode = ECMA3Mode;
			lexer = new Tokenizer (Input, IDTable);
			diagnostics = new List<Diagnostic> ();
			Next (); // innit on first token 
		}
示例#2
0
		public void init ()
		{
			idtable = new IdentifierTable ();
			maptable = new IdentifierMappingTable ();
			gen = new RowanGenerator (maptable,
									idtable.InsertIdentifier ("this"),
									idtable.InsertIdentifier ("_"),
									idtable.InsertIdentifier ("arguments"),
									idtable.InsertIdentifier ("eval"));
		}
示例#3
0
		public Tokenizer (char[] Input, IdentifierTable IDTable)
		{
			this.source = Input;
			this.IDTable = IDTable;
			this.position = 0;
			this.row = 1;
			this.lineStartPosition = 0;
			this.comments = new List<Comment> ();
			// move that to static ctor?
			InitKeywords();
		}
示例#4
0
 public Tokenizer(char[] Input, IdentifierTable IDTable)
 {
     this.source            = Input;
     this.IDTable           = IDTable;
     this.position          = 0;
     this.row               = 1;
     this.lineStartPosition = 0;
     this.comments          = new List <Comment> ();
     // move that to static ctor?
     InitKeywords();
 }
示例#5
0
		public SLE.LambdaExpression CompileExpression (char[] Input, ref List<Diagnostic> Diagnostics)
		{
			IdentifierMappingTable idmtable = new IdentifierMappingTable ();
			IdentifierTable idtable = new IdentifierTable ();
			Parser parser = new Parser (Input, idtable, true);
			List<Comment> comments = null;
			BindingInfo bindinginfo = null;
			Expression expr = parser.ParseExpression (ref comments, ref bindinginfo);
			Diagnostics = parser.Diagnostics;
			RowanGenerator gen = new RowanGenerator (idmtable, idtable.InsertIdentifier("this"),  idtable.InsertIdentifier("arguments"));
			return gen.BindAndTransform (expr, bindinginfo);
		}
示例#6
0
		public SLE.LambdaExpression CompileProgram (char[] Input, ref List<Diagnostic> Diagnostics, ref bool IncompleteInput, bool PrintExpressions)
		{
			IdentifierMappingTable idmtable = new IdentifierMappingTable ();
			IdentifierTable idtable = new IdentifierTable ();
			Parser parser = new Parser (Input, new IdentifierTable (), true);//tode get ecma from somewhere
			List<Comment> comments = null;
			BindingInfo bindinginfo = null;
			DList<Statement, BlockStatement> list = parser.ParseProgram (ref comments, ref bindinginfo);
			Diagnostics = parser.Diagnostics;
			IncompleteInput = parser.SyntaxIncomplete();
			RowanGenerator gen = new RowanGenerator (idmtable, idtable.InsertIdentifier ("this"), idtable.InsertIdentifier ("arguments"));
			return gen.BindAndTransform (list, bindinginfo, PrintExpressions);
		}
示例#7
0
        public SLE.LambdaExpression CompileExpression(char[] Input, ref List <Diagnostic> Diagnostics)
        {
            IdentifierMappingTable idmtable = new IdentifierMappingTable();
            IdentifierTable        idtable  = new IdentifierTable();
            Parser         parser           = new Parser(Input, idtable, true);
            List <Comment> comments         = null;
            BindingInfo    bindinginfo      = null;
            Expression     expr             = parser.ParseExpression(ref comments, ref bindinginfo);

            Diagnostics = parser.Diagnostics;
            RowanGenerator gen = new RowanGenerator(idmtable, idtable.InsertIdentifier("this"), idtable.InsertIdentifier("arguments"));

            return(gen.BindAndTransform(expr, bindinginfo));
        }
示例#8
0
        public SLE.LambdaExpression CompileProgram(char[] Input, ref List <Diagnostic> Diagnostics, ref bool IncompleteInput, bool PrintExpressions)
        {
            IdentifierMappingTable idmtable        = new IdentifierMappingTable();
            IdentifierTable        idtable         = new IdentifierTable();
            Parser         parser                  = new Parser(Input, new IdentifierTable(), true);//tode get ecma from somewhere
            List <Comment> comments                = null;
            BindingInfo    bindinginfo             = null;
            DList <Statement, BlockStatement> list = parser.ParseProgram(ref comments, ref bindinginfo);

            Diagnostics     = parser.Diagnostics;
            IncompleteInput = parser.SyntaxIncomplete();
            RowanGenerator gen = new RowanGenerator(idmtable, idtable.InsertIdentifier("this"), idtable.InsertIdentifier("arguments"));

            return(gen.BindAndTransform(list, bindinginfo, PrintExpressions));
        }
示例#9
0
 public Identifier(string Spelling, Token.Type KeywordValue, IdentifierTable IDTable)
 {
     this.Spelling     = Spelling;
     this.KeywordValue = KeywordValue;
     identifierID      = IDTable.NextIdentifierID;
 }
示例#10
0
 public Identifier(string Spelling, IdentifierTable IDTable)
     : this(Spelling, Token.Type.Identifier, IDTable)
 {
 }