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); }
private void Error (DiagnosticCode code , TextSpan loc) { if (current.Kind == Token.Type.Bad) code = ((BadToken)current).Diagnostic; diagnostics.Add (new Diagnostic (code, loc)); }
public static SourceSpan GetRowanTextSpan(TextSpan Location) { return GetRowanTextSpan (Location, Location); }
public static SourceSpan GetRowanTextSpan(TextSpan StartLocation, TextSpan EndLocation) { return new SourceSpan (GetRowanStartLocation (StartLocation), GetRowanEndLocation (EndLocation)); }
private static SourceLocation GetRowanStartLocation(TextSpan Location) { return new SourceLocation (Location.StartPosition, Location.StartLine, Location.StartColumn); }
private static SourceLocation GetRowanEndLocation(TextSpan Location) { return new SourceLocation (Location.EndPosition, Location.EndLine, Location.EndColumn); }
public Comment (string Spelling, TextSpan Location) { this.spelling = Spelling; this.location = Location; }
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"); }
public Diagnostic(DiagnosticCode Code, TextSpan Location) { this.Code = Code; this.Location = Location; }