void IncludeString(string expression, List <TokenExpression> tokens)
        {
            var sr = new StringReader(expression);
            var tr = new MyTextReader2(sr, "");

            IncludeFile(tr, tokens, "");
        }
        void IncludeFile(string fileName, List <TokenExpression> tokens)
        {
            var encoding = EncodingDetector.DetectEncoding(fileName);
            var trBase   = new StreamReader(fileName, encoding);
            var tr       = new MyTextReader2(trBase, fileName);

            IncludeFile(tr, tokens, fileName);
        }
        private void IncludeFile(MyTextReader2 tr, List <TokenExpression> tokens, string fileName)
        {
            while (true)
            {
                tr.EatWhiteSpace();
                int    row        = tr.Row;
                int    column     = tr.Column;
                string trFileName = tr.FileName;
                var    token      = tr.ReadToken();

                if (token == null)
                {
                    break;
                }
                var tokenExpression = new TokenExpression(token);
                tokenExpression.Row      = row;
                tokenExpression.Column   = column;
                tokenExpression.FileName = trFileName;
                if (tokenExpression.TokenType == TokenType.Pound)
                {
                    var includeToken = tr.PeekToken();
                    if (includeToken.Value.Equals("include", StringComparison.OrdinalIgnoreCase))
                    {
                        includeToken = tr.ReadToken();
                        var fileNameToken = tr.PeekToken();
                        if (fileNameToken.IsQuoted)
                        {
                            fileNameToken = tr.ReadToken();
                            //If it's a .HLL file, load it as an HLL file instead
                            string includeFileName = tr.CanonicalizeFileName(fileNameToken.Value);
                            string includeExt      = Path.GetExtension(includeFileName).ToLowerInvariant();
                            if (includeExt == ".hll")
                            {
                                string alias = Path.GetFileNameWithoutExtension(includeFileName);
                                IncludeHll(includeFileName, alias);
                            }
                            else
                            {
                                try
                                {
                                    tr.IncludeTextReader(includeFileName);
                                }
                                catch (IOException)
                                {
                                    throw;
                                }
                            }
                            continue;
                        }
                        else
                        {
                            tr.PutbackToken(includeToken);
                        }
                    }
                }

                if (tokenExpression.IsMacro())
                {
                    switch (tokenExpression.TokenType)
                    {
                    case TokenType.FileMacro:
                        tokenExpression.Token = new Token(tr.FileName);
                        tokenExpression.Token.QuoteCharacter = '"';
                        tokenExpression.TokenType            = TokenType.StringLiteral;
                        break;

                    case TokenType.LineMacro:
                        tokenExpression.Token = new Token((row + 1).ToString());
                        tokenExpression.Token.QuoteCharacter = '"';
                        tokenExpression.TokenType            = TokenType.StringLiteral;
                        break;

                    case TokenType.FuncMacro:
                        break;

                    case TokenType.DateMacro:
                        StringBuilder dateString = new StringBuilder();
                        dateString.Append(DateTime.Today.ToString("yyyy/MM/dd"));
                        if (dateString[5] == '0')
                        {
                            dateString[5] = ' ';
                        }
                        if (dateString[8] == '0')
                        {
                            dateString[8] = ' ';
                        }
                        tokenExpression.Token = new Token(dateString.ToString());
                        tokenExpression.Token.QuoteCharacter = '"';
                        tokenExpression.TokenType            = TokenType.StringLiteral;
                        break;

                    case TokenType.TimeMacro:
                        tokenExpression.Token = new Token(DateTime.Now.ToString("HH:mm:ss"));
                        tokenExpression.Token.QuoteCharacter = '"';
                        tokenExpression.TokenType            = TokenType.StringLiteral;
                        break;
                    }
                }
                tokens.Add(tokenExpression);
            }
        }