Sha256: 7c63debbcaef5cc450d2b55b852eeef12cc583402d03cb9fa6f2c21903e700cd

Contents?: true

Size: 1.81 KB

Versions: 1

Compression:

Stored size: 1.81 KB

Contents

module Fonte
  module Parsers
    grammar Log
      include Word
      include Temporal
      include Rcon

      rule entry
        "L" SPACE date_time ":" SPACE command
      end

      rule command
          log_started
        / log_ended
        / cvar_start
        / cvar_end
        / cvar_set
        / map_loading
        / map_started
        / server_name
        / server_say
        / rcon_command
      end

      rule log_ended
        "Log file closed"
      end

      rule log_started
        "Log file started" SPACE log_filename SPACE log_game_path SPACE log_game_version
      end

      rule log_filename
        "(file" SPACE quoted_word ")" <Fonte::Nodes::SingleWordNode>
      end

      rule log_game_path
        "(game" SPACE quoted_word ")" <Fonte::Nodes::SingleWordNode>
      end

      rule log_game_version
        "(version" SPACE quoted_word ")" <Fonte::Nodes::SingleWordNode>
      end

      rule cvar_start
        [Ss] "erver cvars start"
      end

      rule cvar_end
        [Ss] "erver cvars end"
      end

      rule cvar_set
        ([Ss] "erver cvar" SPACE)? key:quoted_word SPACE "=" SPACE val:quoted_word {
          def name
            key.value
          end

          def value
            val.value
          end
        }
      end

      rule map_loading
        "Loading map" SPACE map_name
      end

      rule map_started
        "Started map" SPACE map_name SPACE "(" map_crc ")"
      end

      rule map_name
        quoted_word
      end

      rule map_crc
        "CRC" SPACE quoted_word <Fonte::Nodes::SingleWordNode>
      end

      rule server_name
        "Server name is" SPACE server_name:quoted_word <Fonte::Nodes::SingleWordNode>
      end

      rule server_say
        "Server say" SPACE server_say:quoted_word <Fonte::Nodes::SingleWordNode>
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fonte-0.0.1 lib/fonte/parsers/log.treetop