Beispiel #1
0
        /// <summary>
        /// Reads TokenText
        /// </summary>
        public virtual TokenText ReadTokenText()
        {
            Start <TokenText>();
            var value = new TokenText(new StringId(ReadInt32()));

            End();
            return(value);
        }
Beispiel #2
0
        /// <summary>
        /// Constructs a token.
        /// </summary>
        /// <param name="line">Line number of the token</param>
        /// <param name="column">Column number of the token</param>
        /// <param name="text">Text in the token.</param>
        public TokenTextData(int line, int column, TokenText text)
        {
            Contract.Requires(text.IsValid);

            Line     = line;
            Position = column;
            Text     = text;
        }
Beispiel #3
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)));
        }
Beispiel #4
0
        /// <summary>
        /// Constructs a token.
        /// </summary>
        /// <param name="path">Path of the token</param>
        /// <param name="line">Line number of the token</param>
        /// <param name="column">Column number of the token</param>
        /// <param name="text">Text in the token.</param>
        public TokenData(AbsolutePath path, int line, int column, TokenText text)
        {
            Contract.Requires(text.IsValid);

            Path     = path;
            Line     = line;
            Position = column;
            Text     = text;
        }
Beispiel #5
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)));
        }
Beispiel #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)));
 }
Beispiel #7
0
 /// <summary>
 /// Writes TokenText
 /// </summary>
 public virtual void Write(TokenText value)
 {
     Start <TokenText>();
     Write(value.Value.Value);
     End();
 }
Beispiel #8
0
 /// <summary>
 /// Writes TokenText using its underlying string representation
 /// </summary>
 public override void Write(TokenText value)
 {
     throw new NotImplementedException();
 }