예제 #1
0
        public void ReadHeader(DfmObject dfmObject)
        {
            _dfmLexer.CheckToken(DfmTokens.Symbol);

            var className  = _dfmLexer.TokenString();
            var objectName = string.Empty;

            if (_dfmLexer.NextToken() == ':')
            {
                _dfmLexer.NextToken();
                _dfmLexer.CheckToken(DfmTokens.Symbol);

                objectName = className;
                className  = _dfmLexer.TokenString();

                _dfmLexer.NextToken();
            }

            if (_dfmLexer.Token == '[')
            {
                _dfmLexer.NextTokenUntil(']');
                _dfmLexer.NextToken();
            }

            dfmObject.ClassName  = className;
            dfmObject.ObjectName = objectName;
        }
예제 #2
0
        public DfmObject ReadObject()
        {
            var result = new DfmObject();

            // Inherited, Inline, Object
            _dfmLexer.CheckToken(DfmTokens.Symbol);

            _dfmLexer.NextToken();

            ReadHeader(result);

            while (!_dfmLexer.TokenSymbolIs("END") && !_dfmLexer.TokenSymbolIs("OBJECT") && !_dfmLexer.TokenSymbolIs("INHERITED") && !_dfmLexer.TokenSymbolIs("INLINE"))
            {
                result.Properties.Add(ReadProperty());
            }

            while (!_dfmLexer.TokenSymbolIs("END"))
            {
                result.Children.Add(ReadObject());
            }

            _dfmLexer.NextToken();

            return(result);
        }