grammar SQLRowSupport include SQLPrimitives rule one_or_more_table_names table_name "," SPACE one_or_more_table_names { def eval [table_name.eval, one_or_more_table_names.eval] end } / table_name end rule one_or_more_column_names_with_sort one_column_name_with_sort "," SPACE one_or_more_column_names { def eval result1, result2 = one_column_name.eval, one_or_more_column_names.eval [result1, result2].flatten end } / one_column_name_with_sort end rule one_or_more_column_names one_column_name SPACE? "," SPACE? one_or_more_column_names { def eval result1, result2 = one_column_name.eval, one_or_more_column_names.eval [result1, result2].flatten end } / one_column_name end rule one_column_name table_name dot column_name { def eval column_name.eval end } / column_name end rule column_name backtick_string / column_string / all_columns end # TODO: Clean this up rule table_name backtick_string / string end rule column_string string { def eval text_value.downcase end } end rule dot "." { def eval; "."; end } end rule all_columns "*" { def eval; "*"; end } end end