summaryrefslogtreecommitdiff
path: root/tool/lrama/lib/lrama/warning.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tool/lrama/lib/lrama/warning.rb')
-rw-r--r--tool/lrama/lib/lrama/warning.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/tool/lrama/lib/lrama/warning.rb b/tool/lrama/lib/lrama/warning.rb
new file mode 100644
index 0000000000..3c99791ebf
--- /dev/null
+++ b/tool/lrama/lib/lrama/warning.rb
@@ -0,0 +1,25 @@
+module Lrama
+ class Warning
+ attr_reader :errors, :warns
+
+ def initialize(out = STDERR)
+ @out = out
+ @errors = []
+ @warns = []
+ end
+
+ def error(message)
+ @out << message << "\n"
+ @errors << message
+ end
+
+ def warn(message)
+ @out << message << "\n"
+ @warns << message
+ end
+
+ def has_error?
+ !@errors.empty?
+ end
+ end
+end