<commit_before>$bemBlockPrefix: 'b-'
$bemElementSeparator: '__' 
$bemModifierSeparator: '--'

@function selectorToString($selector)
	$selector: inspect($selector) //cast to string
	$selector: str-slice($selector, 2, -2) //remove bracket
	@return $selector

@function containsModifier($selector)
	$selector: selectorToString($selector)
	@if str-index($selector, $bemModifierSeparator)
		@return true
	@else
		@return false
		
@function getBlock($selector)
	$selector: selectorToString($selector)
	$modifierStart: str-index($selector, $bemModifierSeparator)-1
	@return str-slice($selector, 0, $modifierStart)

=b($block)
	.#{$bemBlockPrefix+$block}
		@content
		
=e($element)
	$selector: &
	@at-root
		@if containsModifier($selector)
			$block: getBlock($selector)
			#{$selector}
				#{$block+$bemElementSeparator+$element}
					@content
		@else
			#{$selector+$bemElementSeparator+$element}
				@content

=m($modifier)
	@at-root
		#{&}#{$bemModifierSeparator+$modifier}
			@content<commit_msg>added support for elements inside other elements with mods<commit_after>$bemBlockPrefix: 'b-'
$bemElementSeparator: '__' 
$bemModifierSeparator: '--'

@function selectorToString($selector)
	$selector: inspect($selector) //cast to string
	$selector: str-slice($selector, 2, -2) //remove bracket
	@return $selector

@function containsModifier($selector)
	$selector: selectorToString($selector)
	@if str-index($selector, $bemModifierSeparator)
		@return true
	@else
		@return false
		
@function getBlock($selector)
	$selector: selectorToString($selector)
	$elementStart: str-index($selector, $bemElementSeparator)
	$modifierStart: str-index($selector, $bemModifierSeparator)
	$start: if($elementStart, $elementStart - 1, $modifierStart - 1)
	@return str-slice($selector, 0, $start)

=b($block)
	.#{$bemBlockPrefix+$block}
		@content

//.b-subscribe-form__form--submit_field

=e($element)
	$selector: &
	@at-root
		@if containsModifier($selector)
			$block: getBlock($selector)
			#{$selector}
				#{$block+$bemElementSeparator+$element}
					@content
		@else
			#{$selector+$bemElementSeparator+$element}
				@content

=m($modifier)
	@at-root
		#{&}#{$bemModifierSeparator+$modifier}
			@content
{'fraction_non_alphanumeric': 0.1551487414187643, 'fraction_numerical': 0.004118993135011442, 'mean_word_length': 5.984025559105431, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7576099', 'n_tokens_mistral': 795, 'n_tokens_neox': 735, 'n_words': 141}