Exception: Pione::Lang::ContextError
- Defined in:
- lib/pione/lang/lang-exception.rb
Overview
ContextError is raised when contexts have unacceptable elements or we try to composite different contexts.
Instance Method Summary collapse
- #context_type ⇒ Object
-
#initialize(declaration_or_context, context) ⇒ ContextError
constructor
A new instance of ContextError.
- #message ⇒ Object
Constructor Details
#initialize(declaration_or_context, context) ⇒ ContextError
Returns a new instance of ContextError.
26 27 28 29 |
# File 'lib/pione/lang/lang-exception.rb', line 26 def initialize(declaration_or_context, context) @obj = declaration_or_context @context = context end |
Instance Method Details
#context_type ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/pione/lang/lang-exception.rb', line 31 def context_type case @context when ConditionalBranchContext "conditional branch context" when ParamContext "parameter context" when RuleConditionContext "rule condition contexxt" when FlowContext "flow context" when PackageContext "package context" when LiteralContext "literal context" else raise ArgumentError.new(self) end end |
#message ⇒ Object
50 51 52 53 54 |
# File 'lib/pione/lang/lang-exception.rb', line 50 def name = @obj.class.name pos = @obj.pos.format "%s is not acceptable for %s%s" % [name, context_type, pos] end |