module Syntax
  class Highlighter
    def build_spec(actions)
      actions.create_symbol([["statements"]])
      actions.start_rule([":start", "::=", [[["statements"]]]])
      actions.create_symbol([["statement"]])
      actions.quantified_rule([[[["statements"]]], ["::="], [[["statement"]]], ["+"], [] of String])
      actions.create_symbol([["<start rule>"]])
      actions.create_symbol([["<priority rule>"]])
      actions.create_symbol([["<quantified rule>"]])
      actions.create_symbol([["<discard rule>"]])
      actions.create_symbol([["<empty rule>"]])
      actions.priority_rule([[[["statement"]]], ["::="], [[[[[[[["<start rule>"]]]]], [] of String], "|", [[[[[["<priority rule>"]]]]], [] of String], "|", [[[[[["<quantified rule>"]]]]], [] of String], "|", [[[[[["<discard rule>"]]]]], [] of String], "|", [[[[[["<empty rule>"]]]]], [] of String]]]])
      actions.create_literal(["':start'"])
      actions.create_symbol([["<op declare bnf>"]])
      actions.create_symbol([["<single symbol>"]])
      actions.priority_rule([[[["<start rule>"]]], ["::="], [[[[[["':start'"]], [[[["<op declare bnf>"]]]], [[[["<single symbol>"]]]]], [[["action", "=>", "start_rule"]]]]]]])
      actions.create_symbol([["lhs"]])
      actions.create_symbol([["<op declare>"]])
      actions.create_symbol([["priorities"]])
      actions.priority_rule([[[["<priority rule>"]]], ["::="], [[[[[[[["lhs"]]]], [[[["<op declare>"]]]], [[[["priorities"]]]]], [[["action", "=>", "priority_rule"]]]]]]])
      actions.create_symbol([["quantifier"]])
      actions.create_symbol([["<adverb list>"]])
      actions.priority_rule([[[["<quantified rule>"]]], ["::="], [[[[[[[["lhs"]]]], [[[["<op declare>"]]]], [[[["<single symbol>"]]]], [[[["quantifier"]]]], [[[["<adverb list>"]]]]], [[["action", "=>", "quantified_rule"]]]]]]])
      actions.create_literal(["':discard'"])
      actions.create_symbol([["<op declare match>"]])
      actions.priority_rule([[[["<discard rule>"]]], ["::="], [[[[[["':discard'"]], [[[["<op declare match>"]]]], [[[["<single symbol>"]]]]], [[["action", "=>", "discard_rule"]]]]]]])
      actions.priority_rule([[[["<empty rule>"]]], ["::="], [[[[[[[["lhs"]]]], [[[["<op declare>"]]]], [[[["<adverb list>"]]]]], [[["action", "=>", "empty_rule"]]]]]]])
      actions.create_symbol([["alternatives"]])
      actions.create_literal(["'||'"])
      actions.quantified_rule([[[["priorities"]]], ["::="], [[["alternatives"]]], ["+"], [[["separator", "=>", ["'||'"]]], [["proper", "=>", "1"]]]])
      actions.create_symbol([["alternative"]])
      actions.create_literal(["'|'"])
      actions.quantified_rule([[[["alternatives"]]], ["::="], [[["alternative"]]], ["+"], [[["separator", "=>", ["'|'"]]], [["proper", "=>", "1"]]]])
      actions.create_symbol([["rhs"]])
      actions.priority_rule([[[["alternative"]]], ["::="], [[[[[[[["rhs"]]]], [[[["<adverb list>"]]]]], [] of String]]]])
      actions.create_symbol([["<adverb item>"]])
      actions.quantified_rule([[[["<adverb list>"]]], ["::="], [[["<adverb item>"]]], ["*"], [[["action", "=>", "adverb_list"]]]])
      actions.create_symbol([["<separator specification>"]])
      actions.create_symbol([["<proper specification>"]])
      actions.create_symbol([["<rank specification>"]])
      actions.create_symbol([["<color specification>"]])
      actions.create_symbol([["<bgcolor specification>"]])
      actions.priority_rule([[[["<adverb item>"]]], ["::="], [[[[[[[["<separator specification>"]]]]], [] of String], "|", [[[[[["<proper specification>"]]]]], [] of String], "|", [[[[[["<rank specification>"]]]]], [] of String], "|", [[[[[["<color specification>"]]]]], [] of String], "|", [[[[[["<bgcolor specification>"]]]]], [] of String]]]])
      actions.create_literal(["'separator'"])
      actions.create_literal(["'=>'"])
      actions.create_symbol([["<single quoted string>"]])
      actions.priority_rule([[[["<separator specification>"]]], ["::="], [[[[[["'separator'"]], [["'=>'"]], [[[["<single symbol>"]]]]], [] of String], "|", [[[["'separator'"]], [["'=>'"]], [[[["<single quoted string>"]]]]], [] of String]]]])
      actions.create_literal(["'proper'"])
      actions.create_symbol([["boolean"]])
      actions.priority_rule([[[["<proper specification>"]]], ["::="], [[[[[["'proper'"]], [["'=>'"]], [[[["boolean"]]]]], [] of String]]]])
      actions.create_literal(["'rank'"])
      actions.create_symbol([["digit"]])
      actions.priority_rule([[[["<rank specification>"]]], ["::="], [[[[[["'rank'"]], [["'=>'"]], [[[["digit"]]]]], [] of String]]]])
      actions.create_literal(["'color'"])
      actions.create_symbol([["color"]])
      actions.priority_rule([[[["<color specification>"]]], ["::="], [[[[[["'color'"]], [["'=>'"]], [[[["color"]]]]], [] of String]]]])
      actions.create_literal(["'bgcolor'"])
      actions.priority_rule([[[["<bgcolor specification>"]]], ["::="], [[[[[["'bgcolor'"]], [["'=>'"]], [[[["color"]]]]], [] of String]]]])
      actions.create_symbol([["<hex color>"]])
      actions.create_symbol([["<css color>"]])
      actions.priority_rule([[[["color"]]], ["::="], [[[[[[[["<hex color>"]]]]], [] of String], "|", [[[[[["<css color>"]]]]], [[["action", "=>", "css_color"]]]]]]])
      actions.create_regex(["/#[a-fA-F0-9]{6}/"])
      actions.priority_rule([[[["<hex color>"]]], ["~"], [[[[["#[a-fA-F0-9]{6}"]], [] of String]]]])
      actions.create_character_class(["[\\w]"])
      actions.quantified_rule([[[["<css color>"]]], ["~"], ["[\\w]"], ["+"], [] of String])
      actions.create_symbol([["symbol"]])
      actions.priority_rule([[[["lhs"]]], ["::="], [[[[[[[["symbol"]]]]], [] of String]]]])
      actions.create_symbol([["<rhs primary>"]])
      actions.quantified_rule([[[["rhs"]]], ["::="], [[["<rhs primary>"]]], ["+"], [] of String])
      actions.create_symbol([["<parenthesized rhs primary list>"]])
      actions.priority_rule([[[["<rhs primary>"]]], ["::="], [[[[[[[["<single symbol>"]]]]], [] of String], "|", [[[[[["<single quoted string>"]]]]], [] of String], "|", [[[[[["<parenthesized rhs primary list>"]]]]], [] of String]]]])
      actions.create_literal(["'('"])
      actions.create_symbol([["<rhs list>"]])
      actions.create_literal(["')'"])
      actions.priority_rule([[[["<parenthesized rhs primary list>"]]], ["::="], [[[[[["'('"]], [[[["<rhs list>"]]]], [["')'"]]], [] of String]]]])
      actions.quantified_rule([[[["<rhs list>"]]], ["::="], [[["<rhs primary>"]]], ["+"], [] of String])
      actions.create_symbol([["<character class>"]])
      actions.create_symbol([["<regex>"]])
      actions.priority_rule([[[["<single symbol>"]]], ["::="], [[[[[[[["symbol"]]]]], [] of String], "|", [[[[[["<character class>"]]]]], [[["action", "=>", "create_character_class"]]]], "|", [[[[[["<regex>"]]]]], [[["action", "=>", "create_regex"]]]]]]])
      actions.create_symbol([["<symbol name>"]])
      actions.priority_rule([[[["symbol"]]], ["::="], [[[[[[[["<symbol name>"]]]]], [[["action", "=>", "create_symbol"]]]]]]])
      actions.create_symbol([["<bare name>"]])
      actions.create_symbol([["<bracketed name>"]])
      actions.priority_rule([[[["<symbol name>"]]], ["::="], [[[[[[[["<bare name>"]]]]], [] of String], "|", [[[[[["<bracketed name>"]]]]], [] of String]]]])
      actions.create_symbol([["whitespace"]])
      actions.discard_rule([":discard", "~", [[["whitespace"]]]])
      actions.create_character_class(["[\\s]"])
      actions.quantified_rule([[[["whitespace"]]], ["~"], ["[\\s]"], ["+"], [] of String])
      actions.priority_rule([[[["<op declare>"]]], ["::="], [[[[[[[["<op declare bnf>"]]]]], [] of String], "|", [[[[[["<op declare match>"]]]]], [] of String]]]])
      actions.create_literal(["'::='"])
      actions.priority_rule([[[["<op declare bnf>"]]], ["~"], [[[[[["'::='"]]], [] of String]]]])
      actions.create_literal(["'~'"])
      actions.priority_rule([[[["<op declare match>"]]], ["~"], [[[[[["'~'"]]], [] of String]]]])
      actions.create_literal(["'*'"])
      actions.create_literal(["'+'"])
      actions.priority_rule([[[["quantifier"]]], ["::="], [[[[[["'*'"]]], [] of String], "|", [[[["'+'"]]], [] of String]]]])
      actions.create_symbol([["<name>"]])
      actions.quantified_rule([[[["<name>"]]], ["~"], ["[\\w]"], ["+"], [] of String])
      actions.create_character_class(["[01]"])
      actions.priority_rule([[[["boolean"]]], ["~"], [[[[[["[01]"]]], [] of String]]]])
      actions.create_character_class(["[\\d]"])
      actions.quantified_rule([[[["digit"]]], ["~"], ["[\\d]"], ["+"], [] of String])
      actions.create_symbol([["<before or after>"]])
      actions.create_literal(["'before'"])
      actions.create_literal(["'after'"])
      actions.priority_rule([[[["<before or after>"]]], ["::="], [[[[[["'before'"]]], [] of String], "|", [[[["'after'"]]], [] of String]]]])
      actions.quantified_rule([[[["<bare name>"]]], ["~"], ["[\\w]"], ["+"], [] of String])
      actions.create_literal(["'<'"])
      actions.create_symbol([["<bracketed name string>"]])
      actions.create_literal(["'>'"])
      actions.priority_rule([[[["<bracketed name>"]]], ["~"], [[[[[["'<'"]], [[[["<bracketed name string>"]]]], [["'>'"]]], [] of String]]]])
      actions.create_character_class(["[\\s\\w]"])
      actions.quantified_rule([[[["<bracketed name string>"]]], ["~"], ["[\\s\\w]"], ["+"], [] of String])
      actions.create_symbol([["<quoted string>"]])
      actions.priority_rule([[[["<single quoted string>"]]], ["::="], [[[[[[[["<quoted string>"]]]]], [[["action", "=>", "create_literal"]]]]]]])
      actions.create_regex(["/'[^'\\x0A\\x0B\\x0C\\x0D\\x{0085}\\x{2028}\\x{2029}]+'/"])
      actions.priority_rule([[[["<quoted string>"]]], ["~"], [[[[["'[^'\\x0A\\x0B\\x0C\\x0D\\x{0085}\\x{2028}\\x{2029}]+'"]], [] of String]]]])
      actions.create_regex(["/\\/.*\\/[imx]{0,3}/"])
      actions.priority_rule([[[["<regex>"]]], ["~"], [[[[["\\/.*\\/[imx]{0,3}"]], [] of String]]]])
      actions.create_literal(["'['"])
      actions.create_symbol([["<cc elements>"]])
      actions.create_literal(["']'"])
      actions.priority_rule([[[["<character class>"]]], ["~"], [[[[[["'['"]], [[[["<cc elements>"]]]], [["']'"]]], [] of String]]]])
      actions.create_character_class(["[^\\x5d\\x0A\\x0B\\x0C\\x0D\\x{0085}\\x{2028}\\x{2029}]"])
      actions.quantified_rule([[[["<cc elements>"]]], ["~"], ["[^\\x5d\\x0A\\x0B\\x0C\\x0D\\x{0085}\\x{2028}\\x{2029}]"], ["+"], [] of String])
      actions.create_symbol([["<hash comment>"]])
      actions.discard_rule([":discard", "~", [[["<hash comment>"]]]])
      actions.create_regex(["/#[^\\n]*/"])
      actions.priority_rule([[[["<hash comment>"]]], ["~"], [[[[["#[^\\n]*"]], [] of String]]]])

      return actions
    end
  end
end
