Module: Pione::TestHelper::Lang
- Defined in:
- lib/pione/test-helper/lang-helper.rb
Class Method Summary collapse
-
.conditional_branch(string, opts = {}) ⇒ Object
Read a conditional branch.
-
.conditional_branch_context(string, opts = {}) ⇒ Object
Read a conditional branch context.
-
.conditional_branch_context!(env, string, opts = {}) ⇒ Object
Read and evaluate a rule condition context.
-
.context(string, opts = {}) ⇒ Object
Read a structural context.
- .context!(env, string, opts = {}) ⇒ Object
-
.declaration(string, opts = {}) ⇒ Object
Read a declaration.
- .declaration!(env, string, opts = {}) ⇒ Object
-
.env(string = nil) ⇒ Object
Build an environment and update it with the string as structural context.
-
.expr(string, opts = {}) ⇒ Object
Read an expression.
-
.expr!(env, string, opts = {}) ⇒ Object
Read and evaluate an expression.
-
.feature_expr(string, opts = {}) ⇒ Object
Read a feature expression.
-
.feature_expr!(string, opts = {}) ⇒ Object
Read and evaluate a feature expression.
-
.package_context(string, opts = {}) ⇒ Object
Read a package context.
-
.package_context!(env, string, opts = {}) ⇒ Object
Read and evaluate a package context.
-
.read(string, parser_name, opts = {}) ⇒ Object
Read PIONE language and return the result.
-
.rule_condition_context(string, opts = {}) ⇒ Object
Read a rule condition context.
-
.rule_condition_context!(env, string, opts = {}) ⇒ Object
Read and evaluate a rule condition context.
-
.test_pione_method(name, option = {}) ⇒ Object
Test pione method.
Class Method Details
.conditional_branch(string, opts = {}) ⇒ Object
Read a conditional branch.
20 21 22 |
# File 'lib/pione/test-helper/lang-helper.rb', line 20 def conditional_branch(string, opts={}) read(string, :conditional_branch, opts) end |
.conditional_branch_context(string, opts = {}) ⇒ Object
Read a conditional branch context.
54 55 56 |
# File 'lib/pione/test-helper/lang-helper.rb', line 54 def conditional_branch_context(string, opts={}) read(string, :conditional_branch_context, opts) end |
.conditional_branch_context!(env, string, opts = {}) ⇒ Object
Read and evaluate a rule condition context.
59 60 61 |
# File 'lib/pione/test-helper/lang-helper.rb', line 59 def conditional_branch_context!(env, string, opts={}) conditional_branch_context(string, opts).eval!(env) end |
.context(string, opts = {}) ⇒ Object
Read a structural context.
25 26 27 |
# File 'lib/pione/test-helper/lang-helper.rb', line 25 def context(string, opts={}) read(string, :structural_context, opts) end |
.context!(env, string, opts = {}) ⇒ Object
29 30 31 |
# File 'lib/pione/test-helper/lang-helper.rb', line 29 def context!(env, string, opts={}) context(string, opts).eval!(env) end |
.declaration(string, opts = {}) ⇒ Object
Read a declaration.
11 12 13 |
# File 'lib/pione/test-helper/lang-helper.rb', line 11 def declaration(string, opts={}) read(string, :declaration, opts) end |
.declaration!(env, string, opts = {}) ⇒ Object
15 16 17 |
# File 'lib/pione/test-helper/lang-helper.rb', line 15 def declaration!(env, string, opts={}) declaration(string, opts).eval(env) end |
.env(string = nil) ⇒ Object
Build an environment and update it with the string as structural context.
84 85 86 87 88 |
# File 'lib/pione/test-helper/lang-helper.rb', line 84 def env(string=nil) _env = Pione::Lang::Environment.new.setup_new_package("Test") context(string).eval(_env) if string _env end |
.expr(string, opts = {}) ⇒ Object
Read an expression.
64 65 66 |
# File 'lib/pione/test-helper/lang-helper.rb', line 64 def expr(string, opts={}) read(string, :expr, opts) end |
.expr!(env, string, opts = {}) ⇒ Object
Read and evaluate an expression.
69 70 71 |
# File 'lib/pione/test-helper/lang-helper.rb', line 69 def expr!(env, string, opts={}) expr(string, opts).eval!(env) end |
.feature_expr(string, opts = {}) ⇒ Object
Read a feature expression.
74 75 76 |
# File 'lib/pione/test-helper/lang-helper.rb', line 74 def feature_expr(string, opts={}) read(string, :feature_expr, opts) end |
.feature_expr!(string, opts = {}) ⇒ Object
Read and evaluate a feature expression.
79 80 81 |
# File 'lib/pione/test-helper/lang-helper.rb', line 79 def feature_expr!(string, opts={}) feature_expr(string, opts).eval(env) end |
.package_context(string, opts = {}) ⇒ Object
Read a package context.
34 35 36 |
# File 'lib/pione/test-helper/lang-helper.rb', line 34 def package_context(string, opts={}) read(string, :package_context, opts) end |
.package_context!(env, string, opts = {}) ⇒ Object
Read and evaluate a package context.
39 40 41 |
# File 'lib/pione/test-helper/lang-helper.rb', line 39 def package_context!(env, string, opts={}) package_context(string, opts).eval!(env) end |
.read(string, parser_name, opts = {}) ⇒ Object
Read PIONE language and return the result.
6 7 8 |
# File 'lib/pione/test-helper/lang-helper.rb', line 6 def read(string, parser_name, opts={}) LangReader.new(string, parser_name, opts).read end |
.rule_condition_context(string, opts = {}) ⇒ Object
Read a rule condition context.
44 45 46 |
# File 'lib/pione/test-helper/lang-helper.rb', line 44 def rule_condition_context(string, opts={}) read(string, :rule_condition_context, opts) end |
.rule_condition_context!(env, string, opts = {}) ⇒ Object
Read and evaluate a rule condition context.
49 50 51 |
# File 'lib/pione/test-helper/lang-helper.rb', line 49 def rule_condition_context!(env, string, opts={}) rule_condition_context(string, opts).eval!(env) end |
.test_pione_method(name, option = {}) ⇒ Object
Test pione method.
91 92 93 |
# File 'lib/pione/test-helper/lang-helper.rb', line 91 def test_pione_method(name, option={}) TestPioneMethod.new(name, option).run end |