<commit_before>##
# AST parser for CSS expressions.
#
class Oga::CSS::Parser

options no_result_var

rule
  css
    : selectors  { val[0] }
    | /* none */ { nil }
    ;

  selectors
    : selectors selector { val[0] << val[1] }
    | selector           { val[0] }
    ;

  selector
    : node_test
    ;

  node_test
    : node_name { s(:test, *val[0]) }
    ;

  node_name
    # foo
    : T_IDENT { [nil, val[0]] }<commit_msg>Support for parsing multiple CSS node tests.<commit_after>##
# AST parser for CSS expressions.
#
class Oga::CSS::Parser

options no_result_var

rule
  css
    : expression { val[0] }
    | /* none */ { nil }
    ;

  expression
    : path
    | node_test
    ;

  path_member
    : node_test
    ;

  path_members
    : path_member path_member  { [val[0], val[1]] }
    | path_member path_members { [val[0], *val[1]] }
    ;

  path
    : path_members { s(:path, *val[0]) }
    ;

  node_test
    : node_name { s(:test, *val[0]) }
    ;

  node_name
    # foo
    : T_IDENT { [nil, val[0]] }
{'fraction_non_alphanumeric': 0.14313725490196078, 'fraction_numerical': 0.013725490196078431, 'mean_word_length': 2.200626959247649, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1161940', 'n_tokens_mistral': 396, 'n_tokens_neox': 382, 'n_words': 83}