<commit_before>package ru.stablex.ui;

/**
* :INFO:
* Special thanks to Dima (profelis) Granetchi for resource embedding code
* https://github.com/profelis
*/

using StringTools;

#if macro
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.Type;
import haxe.macro.TypeTools;
import sys.FileSystem;
import sys.io.File;

enum AssetType {
    AImage;
    ASound;
    AFont;
}

#else


#end

/**
* Base class for themes
*
*/
#if !macro @:autoBuild(ru.stablex.ui.Theme.register()) #end
@:allow(ru.stablex)
class Theme {
    /**
    * Replacement for non-alphanumeric characters in class names generated from file names.
    * Using underscore '_' breaks compatibility with HTML5 target
    */
    static private inline var _NON_ALPHANUM_REPLACEMENT = 'DDOTT';
#if !macro


#else
    /** match file name in full file path */
    static private var _erFile : EReg = ~/([^\\\/]+)$/;
    /** check if file is image */
    static private var _erImg : EReg = ~/^(jpg|jpeg|png)$/i;
    /** check if file is font */
    static private var _erFont : EReg = ~/^(ttf)$/i;
    /** non alphanumeric characters */
    static private var _erNonAlphaNum : EReg = ~/[^0-9a-zA-Z]/g;
    /** defauls from registered themes */
    static private var _defaults : Map<String, Map<String,Array<String>> > = new Map();
    /** directories of themes */
    static private var _themeDirectory : Map<String,String> = new Map();

    /**
    * Get directory of a file for current context
    *
    */
    static private inline function _dir (pos:Position = null) : String {
        if (pos == null) pos = Context.currentPos();
        var file : String = Context.resolvePath( Context.getPosInfos(pos).file );

        return Theme._erFile.replace(file, '');<commit_msg>Apply same fix as https://github.com/openfl/openfl/pull/261 to prevent this error https://groups.google.com/forum/#!topic/haxelang/_PjbeDCAAcU<commit_after>package ru.stablex.ui;

/**
* :INFO:
* Special thanks to Dima (profelis) Granetchi for resource embedding code
* https://github.com/profelis
*/

using StringTools;

#if macro
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.Type;
import haxe.macro.TypeTools;
import sys.FileSystem;
import sys.io.File;

enum AssetType {
    AImage;
    ASound;
    AFont;
}

#else


#end

/**
* Base class for themes
*
*/
#if !macro @:autoBuild(ru.stablex.ui.Theme.register()) #end
@:allow(ru.stablex)
class Theme {
    /**
    * Replacement for non-alphanumeric characters in class names generated from file names.
    * Using underscore '_' breaks compatibility with HTML5 target
    */
    static private inline var _NON_ALPHANUM_REPLACEMENT = 'DDOTT';
#if !macro


#else
    /** match file name in full file path */
    static private var _erFile : EReg = ~/([^\\\/]+)$/;
    /** check if file is image */
    static private var _erImg : EReg = ~/^(jpg|jpeg|png)$/i;
    /** check if file is font */
    static private var _erFont : EReg = ~/^(ttf)$/i;
    /** non alphanumeric characters */
    static private var _erNonAlphaNum : EReg = ~/[^0-9a-zA-Z]/g;
    /** defauls from registered themes */
    static private var _defaults : Map<String, Map<String,Array<String>> > = new Map();
    /** directories of themes */
    static private var _themeDirectory : Map<String,String> = new Map();

    /**
    * Get directory of a file for current context
    *
    */
    static private inline function _dir (pos:Position = null) : String {
        if (pos == null) pos = Context.currentPos();
        var filePath = Context.getPosInfos(pos).file;
        var file : String = Context.getPosInfos(pos).file;
        if (!sys.FileSystem.exists(filePath)) {
            file = Context.resolvePath (filePath);
        }
        return Theme._erFile.replace(file, '');
{'fraction_non_alphanumeric': 0.1339332980412917, 'fraction_numerical': 0.002382212811011117, 'mean_word_length': 3.08982683982684, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 4, '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': '5186806', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1204, 'n_words': 352}