<commit_before>﻿using System;
using CppSharp.Parser.AST;
using System.Reflection;
using LanguageVersion = CppSharp.Parser.LanguageVersion;
using System.Globalization;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text.RegularExpressions;
using System.IO;

namespace CppSharp.Parser
{
    public enum LanguageVersion
    {
        /// <summary>
        /// C programming language (year 1999).
        /// </summary>
        C99,
        /// <summary>
        /// C programming language (year 1999, GNU variant).
        /// </summary>
        C99_GNU,
        /// <summary>
        /// C++ programming language (year 1998).
        /// </summary>
        CPP98,
        /// <summary>
        /// C++ programming language (year 1998, GNU variant).
        /// </summary>
        CPP98_GNU,
        /// <summary>
        /// C++ programming language (year 2011).
        /// </summary>
        CPP11,
        /// <summary>
        /// C++ programming language (year 2011, GNU variant).
        /// </summary>
        CPP11_GNU,
        /// <summary>
        /// C++ programming language (year 2014).
        /// </summary>
        CPP14,
        /// <summary>
        /// C++ programming language (year 2014, GNU variant).
        /// </summary>
        CPP14_GNU,
        /// <summary>
        /// C++ programming language (year 2017).
        /// </summary>
        CPP17,
        /// <summary>
        /// C++ programming language (year 2017, GNU variant).
        /// </summary>
        CPP17_GNU,
    }

    public class ParserOptions : CppParserOptions
    {
        public ParserOptions()
        {
            Abi = Platform.IsUnixPlatform ? CppAbi.Itanium : CppAbi.Microsoft;
            MicrosoftMode = !Platform.IsUnixPlatform;
            CurrentDir = Assembly.GetExecutingAssembly().Location;
        }

        public ParserOptions(ParserOptions options)
        {
            Abi = options.Abi;
            ToolSetToUse = options.ToolSetToUse;
            TargetTriple = options.TargetTriple;
            NoStandardIncludes = options.NoStandardIncludes;
            NoBuiltinIncludes = options.NoBuiltinIncludes;
            MicrosoftMode = options.MicrosoftMode;
            Verbose = options.Verbose;
            LanguageVersion = options.LanguageVersion;
            UnityBuild = options.UnityBuild;
            ForceClangToolchainLookup = options.ForceClangToolchainLookup;
        }

        public bool IsItaniumLikeAbi => Abi != CppAbi.Microsoft;
        public bool IsMicrosoftAbi => Abi == CppAbi.Microsoft;

        public bool EnableRTTI { get; set; }
        public LanguageVersion? LanguageVersion { get; set; }

        /// <summary>
        /// This option forces the driver code to use Clang's toolchain code
        /// to lookup the location of system headers and library locations.
        /// At the moment, it only makes a difference for MSVC targets.
        /// If its true, then we opt to use Clang's MSVC lookup logic.
        /// </summary>
        public bool ForceClangToolchainLookup = false;

        public ParserOptions BuildForSourceFile(
            IEnumerable<CppSharp.AST.Module> modules, string file = null)
        {
            var options = new ParserOptions(this);

            // This eventually gets passed to Clang's MSCompatibilityVersion, which
            // is in turn used to derive the value of the built-in define _MSC_VER.
            // It used to receive a 4-digit based identifier but now expects a full
            // version MSVC digit, so check if we still have the old version and
            // convert to the right format.

            if (ToolSetToUse.ToString(CultureInfo.InvariantCulture).Length == 4)<commit_msg>Fixed missing options copy in ParserOptions copy constructor.<commit_after>﻿using System;
using CppSharp.Parser.AST;
using System.Reflection;
using LanguageVersion = CppSharp.Parser.LanguageVersion;
using System.Globalization;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text.RegularExpressions;
using System.IO;

namespace CppSharp.Parser
{
    public enum LanguageVersion
    {
        /// <summary>
        /// C programming language (year 1999).
        /// </summary>
        C99,
        /// <summary>
        /// C programming language (year 1999, GNU variant).
        /// </summary>
        C99_GNU,
        /// <summary>
        /// C++ programming language (year 1998).
        /// </summary>
        CPP98,
        /// <summary>
        /// C++ programming language (year 1998, GNU variant).
        /// </summary>
        CPP98_GNU,
        /// <summary>
        /// C++ programming language (year 2011).
        /// </summary>
        CPP11,
        /// <summary>
        /// C++ programming language (year 2011, GNU variant).
        /// </summary>
        CPP11_GNU,
        /// <summary>
        /// C++ programming language (year 2014).
        /// </summary>
        CPP14,
        /// <summary>
        /// C++ programming language (year 2014, GNU variant).
        /// </summary>
        CPP14_GNU,
        /// <summary>
        /// C++ programming language (year 2017).
        /// </summary>
        CPP17,
        /// <summary>
        /// C++ programming language (year 2017, GNU variant).
        /// </summary>
        CPP17_GNU,
    }

    public class ParserOptions : CppParserOptions
    {
        public ParserOptions()
        {
            Abi = Platform.IsUnixPlatform ? CppAbi.Itanium : CppAbi.Microsoft;
            MicrosoftMode = !Platform.IsUnixPlatform;
            CurrentDir = Assembly.GetExecutingAssembly().Location;
        }

        public ParserOptions(ParserOptions options)
        {
            Abi = options.Abi;
            ToolSetToUse = options.ToolSetToUse;
            TargetTriple = options.TargetTriple;
            NoStandardIncludes = options.NoStandardIncludes;
            NoBuiltinIncludes = options.NoBuiltinIncludes;
            MicrosoftMode = options.MicrosoftMode;
            Verbose = options.Verbose;
            EnableRTTI = options.EnableRTTI;
            LanguageVersion = options.LanguageVersion;
            UnityBuild = options.UnityBuild;
            SkipPrivateDeclarations = options.SkipPrivateDeclarations;
            SkipFunctionBodies = options.SkipFunctionBodies;
            SkipLayoutInfo = options.SkipLayoutInfo;
            ForceClangToolchainLookup = options.ForceClangToolchainLookup;
        }

        public bool IsItaniumLikeAbi => Abi != CppAbi.Microsoft;
        public bool IsMicrosoftAbi => Abi == CppAbi.Microsoft;

        public bool EnableRTTI { get; set; }
        public LanguageVersion? LanguageVersion { get; set; }

        /// <summary>
        /// This option forces the driver code to use Clang's toolchain code
        /// to lookup the location of system headers and library locations.
        /// At the moment, it only makes a difference for MSVC targets.
        /// If its true, then we opt to use Clang's MSVC lookup logic.
        /// </summary>
        public bool ForceClangToolchainLookup = false;

        public ParserOptions BuildForSourceFile(
            IEnumerable<CppSharp.AST.Module> modules, string file = null)
        {
            var options = new ParserOptions(this);

            // This eventually gets passed to Clang's MSCompatibilityVersion, which
            // is in turn used to derive the value of the built-in define _MSC_VER.
            // It used to receive a 4-digit based identifier but now expects a full
            // version MSVC digit, so check if we still have the old version and
            // convert to the right format.

            if (ToolSetToUse.ToString(CultureInfo.InvariantCulture).Length == 4)
{'fraction_non_alphanumeric': 0.10025806451612904, 'fraction_numerical': 0.016, 'mean_word_length': 1.8910854158895933, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3921965', 'n_tokens_mistral': 2140, 'n_tokens_neox': 1964, 'n_words': 594}