<commit_before># Variables: binding and scope
# see: http://www.cmake.org/cmake/help/v3.0/manual/cmake-language.7.html#variables
cmake_minimum_required(VERSION 3.0)
set(indent "\t")

macro(message_with_indent)
  message("${indent}${ARGV}")
endmacro()

macro(display_vars)
  message_with_indent("a: ${a}")
  message_with_indent("b: ${b}")
endmacro()

macro(set_value name exp)
  math(EXPR ${name} "${exp}")
  message_with_indent("set(${name} ${${name}})")
endmacro()

function(verify_function_scope_impl recurrence_count)
  set(indent "${indent}\t")
  math(EXPR is_even "${recurrence_count} % 2")
  math(EXPR next_recurrence_count "${recurrence_count} - 1")
  
  display_vars()
  if (${is_even} EQUAL 0)
    set_value(a "${recurrence_count} * 123")
  else()
    set_value(b "${recurrence_count} * 43")
  endif()
  display_vars()
  
  if (${recurrence_count} GREATER 1)
    message_with_indent("function verify_function_scope() {")
      verify_function_scope_impl(${next_recurrence_count})
    message_with_indent("}")
    display_vars()
  endif()
endfunction()

macro(verify_function_scope)
  display_vars()
  message_with_indent("function verify_function_scope() {")
    verify_function_scope_impl(2)
  message_with_indent("}")
  display_vars()
endmacro()

message("directory root {")
  set_value(a 1)
  verify_function_scope()
  message_with_indent("directory subdir {")
    add_subdirectory(subdir)
  message_with_indent("}")
  verify_function_scope()
message("}")<commit_msg>Added the foreach scope to the core/variable_scope.<commit_after># Variables: binding and scope
# see: http://www.cmake.org/cmake/help/v3.0/manual/cmake-language.7.html#variables
cmake_minimum_required(VERSION 3.0)
set(indent "\t")

macro(message_with_indent)
  message("${indent}${ARGV}")
endmacro()

macro(display_vars)
  message_with_indent("a: ${a}")
  message_with_indent("b: ${b}")
endmacro()

macro(set_value name exp)
  math(EXPR ${name} "${exp}")
  message_with_indent("set(${name} ${${name}})")
endmacro()

function(verify_function_scope_impl recurrence_count)
  set(indent "${indent}\t")
  math(EXPR is_even "${recurrence_count} % 2")
  math(EXPR next_recurrence_count "${recurrence_count} - 1")
  
  display_vars()
  if (${is_even} EQUAL 0)
    set_value(a "${recurrence_count} * 123")
  else()
    set_value(b "${recurrence_count} * 43")
  endif()
  display_vars()
  
  if (${recurrence_count} GREATER 1)
    message_with_indent("function verify_function_scope() {")
      verify_function_scope_impl(${next_recurrence_count})
    message_with_indent("}")
    display_vars()
  endif()
endfunction()

macro(verify_function_scope)
  display_vars()
  message_with_indent("function verify_function_scope() {")
    verify_function_scope_impl(2)
  message_with_indent("}")
  display_vars()
endmacro()

macro(verify_foreach_scope)
  set(_indent ${indent})
  display_vars()
  message_with_indent("foreach {")
    set(indent "${indent}\t")
    message_with_indent("loop target: 3;4;5")
    foreach(a 3;4;5)
      set_value(b "${a}+1")
      display_vars()
    endforeach()
    set(indent "${_indent}")
  message_with_indent("}")
  display_vars()
endmacro()

message("directory root {")
  set_value(a 1)
  verify_function_scope()
  message_with_indent("directory subdir {")
    add_subdirectory(subdir)
  message_with_indent("}")
  verify_function_scope()
  verify_foreach_scope()
message("}")
{'fraction_non_alphanumeric': 0.15323058684054536, 'fraction_numerical': 0.011558980438648489, 'mean_word_length': 5.944444444444445, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2471726', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1202, 'n_words': 197}