lib/fonte/parsers/action.treetop in fonte-0.1.0 vs lib/fonte/parsers/action.treetop in fonte-0.2.0

- old
+ new

@@ -3,10 +3,11 @@ grammar Action include Word include Player include Address include Property + include Rcon rule action log_started_action / log_ended_action / cvar_start_action @@ -37,10 +38,13 @@ / server_chat_action / team_alliance_action / score_report / weapon_selection_action / weapon_pickup_action + / rcon_command + / steamauth_failure_action + / spawn_action end rule log_started_action "Log file started" properties:action_properties? { def value @@ -72,21 +76,29 @@ end } end rule cvar_set_action - ([Ss] "erver cvar" SPACE)? key:quoted_word SPACE "=" SPACE val:quoted_word { + (cvar_set_complete_syntax / cvar_set_colon_sytax) { def value "cvar set" end def to_hash { key.value => val.value } end } end + rule cvar_set_complete_syntax + ([Ss] "erver cvar" SPACE)? key:quoted_word SPACE "=" SPACE val:quoted_word + end + + rule cvar_set_colon_sytax + "server_cvar:" SPACE key:quoted_word SPACE val:quoted_word + end + rule map_loading_action "Loading map" SPACE name:map_name { def value "map load" end @@ -204,17 +216,46 @@ end } end rule kill_action + source_kill_action / l4d2_kill_action + end + + rule source_kill_action QUOTE attacker:player QUOTE SPACE "killed" SPACE QUOTE victim:player QUOTE SPACE "with" SPACE QUOTE weapon QUOTE properties:action_properties? { def value "kill" end } end + # TODO: move this to separated grammar + rule l4d2_kill_action + "(DEATH)" source_kill_action { + def value + "kill" + end + + def attacker + source_kill_action.attacker + end + + def victim + source_kill_action.victim + end + + def weapon + source_kill_action.weapon + end + + def properties + source_kill_action.properties + end + } + end + rule injure_action QUOTE attacker:player QUOTE SPACE "attacked" SPACE QUOTE victim:player QUOTE SPACE "with" SPACE QUOTE weapon QUOTE properties:action_properties? { def value "injure" end @@ -244,17 +285,25 @@ end } end rule triggered_world_action - "World triggered" SPACE action:quoted_word properties:action_properties? { + "World triggered" SPACE action:quoted_word reason:triggered_world_action_reason? properties:action_properties? { def value action.value end } end + rule triggered_world_action_reason + SPACE "reason" SPACE reason:quoted_word { + def value + reason.value + end + } + end + rule chat_action QUOTE player QUOTE SPACE "say" SPACE message:quoted_word { def value "chat" end @@ -316,9 +365,33 @@ rule weapon_pickup_action QUOTE player QUOTE SPACE "acquired weapon" SPACE QUOTE weapon QUOTE { def value "weapon pickup" + end + } + end + + rule steamauth_failure_action + "STEAMAUTH: Client" SPACE client:steamauth_client SPACE "received failure code" SPACE code:integer { + def value + "authentication failure" + end + } + end + + rule spawn_action + QUOTE player QUOTE SPACE "spawned" { + def value + "spawn" + end + } + end + + rule steamauth_client + (!SPACE .)+ { + def value + text_value end } end rule role