public static BuildXLContext CreateInstanceForTestingWithCancellationToken(BuildXLContext context, CancellationToken cancellationToken) { return(new BuildXLTestContext(context.StringTable, context.PathTable, context.SymbolTable, context.QualifierTable, context.TokenTextTable, cancellationToken) { TestHooks = context.TestHooks }); }
/// <summary> /// Helper to create instances of tokens. /// </summary> public static Token Create(BuildXLContext context, AbsolutePath path, string text = "", int line = 0, int column = 0) { Contract.RequiresNotNull(context); Contract.Requires(path.IsValid); Contract.RequiresNotNull(text); return(new Token(path, line, column, TokenText.Create(context.TokenTextTable, text))); }
/// <summary> /// Helper to create instances of tokens from xml reader. /// </summary> public static Token Create(BuildXLContext context, XmlReader reader, AbsolutePath path) { Contract.RequiresNotNull(context); Contract.RequiresNotNull(reader); var xmlInfo = (IXmlLineInfo)reader; return(new Token(path, xmlInfo.LineNumber, xmlInfo.LinePosition, TokenText.Create(context.TokenTextTable, reader.Value))); }
/// <summary> /// Parses a dotted identifier. All error logging is the responsibility of the caller /// </summary> /// <param name="token">The token to parse</param> /// <param name="context">Context with tables.</param> /// <param name="identifier">The parsed identifier if successful, null if not.</param> public static ParseResult TryParse( TokenData token, BuildXLContext context, out DottedIdentifier identifier) { return(TryParse( token.Expand(context.TokenTextTable), context, out identifier)); }
/// <summary> /// protected constructor /// </summary> protected BuildXLContext(BuildXLContext context) : this( context.CancellationToken, context.StringTable, context.PathTable, context.SymbolTable, context.QualifierTable, context.TokenTextTable) { Contract.Requires(context != null); }
/// <summary> /// Helper to create instances of tokens. /// </summary> public static Token Create(BuildXLContext context, Type type, string text = "", int line = 0, int column = 0) { Contract.RequiresNotNull(context); Contract.RequiresNotNull(type); Contract.RequiresNotNull(text); return(new Token( AbsolutePath.Create(context.PathTable, AssemblyHelper.GetAssemblyLocation(type.GetTypeInfo().Assembly)), line, column, TokenText.Create(context.TokenTextTable, text))); }
public static ParseResult TryParseIdentifier( TokenData token, BuildXLContext context, ref int position, out string identifier) { StringSegment identifierSegment; var parseResult = TryParseIdentifier( token.Expand(context.TokenTextTable), context, ref position, out identifierSegment); identifier = parseResult.Status == ParseStatus.Success ? identifierSegment.ToString() : null; return(parseResult); }