<commit_before>drop function if exists pgmapcss_parse_condition(text);
create or replace function pgmapcss_parse_condition(
  IN text,
  OUT result pgmapcss_condition,
  OUT content text
)
as $$
#variable_conflict use_variable
declare
  m text;
  r record;
begin
  content:=$1;
  result.op := '';

  if substring(content, 1, 1)='!' then
    content=substring(content, 2);
    result.op := result.op || '! ';
  end if;

  r := pgmapcss_parse_string(content, E'^([a-zA-Z_0-9\\-\.:]+)(=|!=|<|>|<=|>=|\\^=|\\$=|\\*=|~=|=~)');
  if r.result is not null then
    result.key := r.result;
    content = r.content;

    result.op = result.op || substring(content from '^(=|!=|<|>|<=|>=|\^=|\$=|\*=|~=|=~)(.*)$');
    content = substring(content, length(result.op) + 1);

    r := pgmapcss_parse_string(content, E'^eval\\(');
    if r is not null then
      r := pgmapcss_parse_eval(content, 6);
      result.value := r.result;
      result.value_type := 1;
      content = r.content;
    else
      r := pgmapcss_parse_string(content, E'^([^\\]]+)\\]');
      result.value := r.result;
      result.value_type := 0;
      content = r.content;
    end if;

    return;
  end if;<commit_msg>Parse Condition: Bugfix reading values in quotes<commit_after>drop function if exists pgmapcss_parse_condition(text);
create or replace function pgmapcss_parse_condition(
  IN text,
  OUT result pgmapcss_condition,
  OUT content text
)
as $$
#variable_conflict use_variable
declare
  m text;
  r record;
begin
  content:=$1;
  result.op := '';

  if substring(content, 1, 1)='!' then
    content=substring(content, 2);
    result.op := result.op || '! ';
  end if;

  r := pgmapcss_parse_string(content, E'^([a-zA-Z_0-9\\-\.:]+)(=|!=|<|>|<=|>=|\\^=|\\$=|\\*=|~=|=~)');
  if r.result is not null then
    result.key := r.result;
    content = r.content;

    result.op = result.op || substring(content from '^(=|!=|<|>|<=|>=|\^=|\$=|\*=|~=|=~)(.*)$');
    content = substring(content, length(result.op) + 1);

    if content ~ E'^eval\\(' then
      r := pgmapcss_parse_eval(content, 6);
      result.value := r.result;
      result.value_type := 1;
      content = substr(r.content, 3);
    else
      r := pgmapcss_parse_string(content, E'^([^\\]]+)\\]');
      result.value := r.result;
      result.value_type := 0;
      content = r.content;
    end if;

    return;
  end if;
{'fraction_non_alphanumeric': 0.2055084745762712, 'fraction_numerical': 0.008898305084745763, 'mean_word_length': 3.2085561497326203, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '7465262', 'n_tokens_mistral': 907, 'n_tokens_neox': 842, 'n_words': 189}