Esempio n. 1
0
		private FunctionDefinition ParseFunctionDefinition ()
		{
			Token start = current;

			Next ();
			Identifier id = null;
			if (CheckSyntaxExpected (Token.Type.Identifier))
				id = ((IdentifierToken)current).Spelling;

			TextPoint NameLocation = new TextPoint (current.StartPosition);

			Next ();
			TextPoint leftParenLocation = new TextPoint();
			CheckSyntaxExpected (Token.Type.LeftParenthesis);
			leftParenLocation = new TextPoint (current.StartPosition);

			Next ();
			List<Parameter> parametters = ParseListParametter ();
			TextPoint rightParenLocation = new TextPoint();
			CheckSyntaxExpected (Token.Type.RightParenthesis);
			rightParenLocation = new TextPoint (current.StartPosition);
			
			Token headerEnd = current;

			Next ();
			BlockStatement body = ParseBlock ();
			TextSpan location = new TextSpan (start, current);
			TextSpan HeaderLocation = new TextSpan (start, headerEnd);

			return new FunctionDefinition (id, parametters, body, location, HeaderLocation, NameLocation, leftParenLocation, rightParenLocation);
		}
Esempio n. 2
0
		private void Error (DiagnosticCode code , TextSpan loc)
		{
			if (current.Kind == Token.Type.Bad)
				code = ((BadToken)current).Diagnostic;
			diagnostics.Add (new Diagnostic (code, loc));
		}
Esempio n. 3
0
		public static SourceSpan GetRowanTextSpan(TextSpan Location)
		{
			return GetRowanTextSpan (Location, Location);
		}
Esempio n. 4
0
		public static SourceSpan GetRowanTextSpan(TextSpan StartLocation, TextSpan EndLocation)
		{
			return new SourceSpan (GetRowanStartLocation (StartLocation), GetRowanEndLocation (EndLocation));
		}
Esempio n. 5
0
		private static SourceLocation GetRowanStartLocation(TextSpan Location)
		{
			return new SourceLocation (Location.StartPosition, Location.StartLine, Location.StartColumn);
		}
Esempio n. 6
0
		private static SourceLocation GetRowanEndLocation(TextSpan Location)
		{
			return new SourceLocation (Location.EndPosition, Location.EndLine, Location.EndColumn);
		}
Esempio n. 7
0
		public Comment (string Spelling, TextSpan Location)
		{
			this.spelling = Spelling;
			this.location = Location;
		}
Esempio n. 8
0
		public void GenerateBlockStatement ()
		{
			DList<MJCP.Statement, MJCP.BlockStatement> Children = new DList<MJCP.Statement, MJCP.BlockStatement> ();
			TextSpan Location = new TextSpan (0, 0, 0, 10, 0, 10);
			MJCP.BlockStatement input = new MJCP.BlockStatement (Children, Location);
			Children.Parent = input;
			
			MSIA.Statement result = gen.Generate (input);
			Assert.IsInstanceOfType(typeof(MSIA.BlockStatement), result, "#1");
		}
Esempio n. 9
0
		public Diagnostic(DiagnosticCode Code, TextSpan Location)
		{
			this.Code = Code;
			this.Location = Location;
		}