diff options
author | Steve Kemp <steve@steve.org.uk> | 2012-11-13 15:31:38 +0000 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2012-11-13 15:31:38 +0000 |
commit | 2fc596cc02c0d7ac674fe8aa9ff3caf9bd601a01 (patch) | |
tree | eb5c6c9c732f3d052b41836912478c9bc60a4c7d /parser/parser.rb | |
parent | 9f4c74658edd2e807796ede8c31fd147ecb7d9cc (diff) |
Comment updates.
Diffstat (limited to 'parser/parser.rb')
-rwxr-xr-x | parser/parser.rb | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/parser/parser.rb b/parser/parser.rb index d11360c..a3f7246 100755 --- a/parser/parser.rb +++ b/parser/parser.rb @@ -6,14 +6,6 @@ # Macro names match the pattern "^[0-9A-Z_]$" # # -# TODO: -# -# Write manual. -# -# Use a real parser framework? -# -# Love me. -# require 'beanstalk-client' @@ -28,11 +20,40 @@ require 'json' # -# Simple wrapper to parse the configuration file +# This is a simple class which will parse a sentinel configuration file. +# +# Unlike Sentinel it is not using a real parser, instead it peels off lines +# via a small number of very simple regular expressions - this should be flaky, +# but in practice it manages to successfully parse each of the configuration +# files that we currently maintain @ Bytemark. +# +# TODO: +# +# 1. Break parse_file down into repeated calls to parse_line, to allow test +# cases to be written. +# +# 2. Explicitly abort and panic on malformed lines. +# +# 3. Implement HTTP-fetching for macro-bodies. +# +# Steve +# -- # class MonitorConfig + + # + # A hash of macros we found. + # attr_reader :MACROS + + # + # A handle to the beanstalkd queue. + # attr_reader :queue + + # + # The filename that we're going to parse. + # attr_reader :filename # @@ -90,6 +111,7 @@ class MonitorConfig end + # # Is the given string of text a macro? # @@ -98,6 +120,7 @@ class MonitorConfig end + # # Return an array of hosts if the given string was a macro identifier. # |