Exemplo n.º 1
0
 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
     });
 }
Exemplo n.º 2
0
        /// <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)));
        }
Exemplo n.º 3
0
        /// <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)));
        }
Exemplo n.º 4
0
 /// <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));
 }
Exemplo n.º 5
0
 /// <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);
 }
Exemplo n.º 6
0
 /// <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)));
 }
Exemplo n.º 7
0
        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);
        }