Exemple #1
0
        public void CanCreateInstance()
        {
            var l = new LexInfo("t", 1, 2, 3, 4);

            Assert.AreEqual("t", l.File);
            Assert.AreEqual(1, l.Line);
            Assert.AreEqual(2, l.Column);
            Assert.AreEqual(3, l.CharIndex);
            Assert.AreEqual(4, l.Length);
        }
Exemple #2
0
        public void CanCreateCopy()
        {
            var l  = new LexInfo("t", 1, 2, 3, 4);
            var l2 = l.Clone();

            Assert.AreNotSame(l, l2);
            Assert.AreEqual("t", l2.File);
            Assert.AreEqual(1, l2.Line);
            Assert.AreEqual(2, l2.Column);
            Assert.AreEqual(3, l2.CharIndex);
            Assert.AreEqual(4, l2.Length);
        }
Exemple #3
0
        private void init(string filename, BxlParserOptions options)
        {
            _options = options;
            _info    = new LexInfo(filename, 1);
            _expStack.Clear();
            DEFAULT_NS_PREFIX = NAMESPACE + filename + "_";
            string __ = "";

            if (_options.HasFlag(BxlParserOptions.SafeAttributeNames))
            {
                __ = "__";
            }
            ANON_CODE = __ + CODE;
            ANON_ID   = __ + ID;
            ANON_NAME = __ + NAME;
            _skip     = 0;
            _level    = -1;
            _anon     = new List <Stats>()
            {
                new Stats()
            };
            _symbolCount  = 0;
            _tabIgnore    = 0;
            _tabs         = 0;
            _defNsCount   = 0;
            _value        = "";
            _prefix       = "";
            _isString     = false;
            _isExpression = false;
            _buf.Clear();
            _stack.Clear();
            _next = '\0';

            _root    = new XElement(ROOT_NAME);
            _current = _root;
            _mode    = ReadMode.Start;
        }
Exemple #4
0
        /// <summary>
        ///     Создает новый экземпляр ошибки
        /// </summary>
        /// <param name="message"> Пользовательское сообщение </param>
        /// <param name="inner"> inner wrapped exception </param>
        /// <param name="lexinfo"> Позиция исходного файла вызвавшего ошибку </param>
        public BxlException(string message = "", LexInfo lexinfo = null, Exception inner = null)

            : base(message + (lexinfo ?? new LexInfo()), inner)
        {
            LexInfo = lexinfo ?? new LexInfo();
        }
Exemple #5
0
        public void GeneratesValidString()
        {
            var l = new LexInfo("t", 1, 2, 3, 4);

            Assert.AreEqual(" at t : 1:2", l.ToString());
        }