wlang 0.10.2 → 2.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +3 -121
- data/Gemfile +23 -1
- data/Gemfile.lock +32 -28
- data/LICENCE.md +18 -21
- data/Manifest.txt +4 -5
- data/README.md +100 -174
- data/Rakefile +1 -13
- data/bin/wlang +3 -29
- data/lib/wlang.rb +21 -394
- data/lib/wlang/command.rb +94 -0
- data/lib/wlang/compiler.rb +78 -0
- data/lib/wlang/compiler/autospacing.rb +60 -0
- data/lib/wlang/compiler/dialect_enforcer.rb +91 -0
- data/lib/wlang/compiler/filter.rb +32 -0
- data/lib/wlang/compiler/grammar.citrus +67 -0
- data/lib/wlang/compiler/parser.rb +26 -0
- data/lib/wlang/compiler/proc_call_removal.rb +15 -0
- data/lib/wlang/compiler/static_merger.rb +28 -0
- data/lib/wlang/compiler/strconcat_flattener.rb +25 -0
- data/lib/wlang/compiler/to_ruby_abstraction.rb +22 -0
- data/lib/wlang/compiler/to_ruby_code.rb +55 -0
- data/lib/wlang/dialect.rb +40 -237
- data/lib/wlang/dialect/dispatching.rb +51 -0
- data/lib/wlang/dialect/evaluation.rb +30 -0
- data/lib/wlang/dialect/tags.rb +50 -0
- data/lib/wlang/dummy.rb +32 -0
- data/lib/wlang/html.rb +106 -0
- data/lib/wlang/loader.rb +6 -0
- data/lib/wlang/mustang.rb +90 -0
- data/lib/wlang/scope.rb +57 -0
- data/lib/wlang/scope/binding_scope.rb +18 -0
- data/lib/wlang/scope/object_scope.rb +25 -0
- data/lib/wlang/scope/proxy_scope.rb +18 -0
- data/lib/wlang/scope/root_scope.rb +24 -0
- data/lib/wlang/template.rb +16 -86
- data/lib/wlang/version.rb +9 -8
- data/spec/fixtures/dialect/foobar.rb +31 -0
- data/spec/fixtures/dialect/upcasing.rb +13 -0
- data/spec/fixtures/templates/hello.tpl +1 -0
- data/spec/integration/examples/1-basics.txt +65 -0
- data/spec/integration/examples/2-imperative.txt +51 -0
- data/spec/integration/examples/3-partials.txt +76 -0
- data/spec/integration/examples/4-recursion.txt +16 -0
- data/spec/integration/html/test_ampersand.rb +15 -0
- data/spec/integration/html/test_bang.rb +38 -0
- data/spec/integration/html/test_caret.rb +33 -0
- data/spec/integration/html/test_dollar.rb +16 -0
- data/spec/integration/html/test_greater.rb +23 -0
- data/spec/integration/html/test_modulo.rb +16 -0
- data/spec/integration/html/test_plus.rb +48 -0
- data/spec/integration/html/test_question.rb +33 -0
- data/spec/integration/html/test_sharp.rb +21 -0
- data/spec/integration/html/test_slash.rb +16 -0
- data/spec/integration/html/test_star.rb +37 -0
- data/spec/integration/test_dummy.rb +51 -0
- data/spec/integration/test_examples.rb +29 -0
- data/spec/integration/test_mustang.rb +120 -0
- data/spec/integration/test_readme.rb +56 -0
- data/spec/integration/test_upcasing.rb +22 -0
- data/spec/spec_helper.rb +62 -1
- data/spec/test_wlang.rb +101 -0
- data/spec/unit/compiler/autospacing/test_right_strip.rb +30 -0
- data/spec/unit/compiler/autospacing/test_unindent.rb +30 -0
- data/spec/unit/compiler/test_dialect_enforcer.rb +168 -0
- data/spec/unit/compiler/test_grammar.rb +207 -0
- data/spec/unit/compiler/test_parser.rb +69 -0
- data/spec/unit/compiler/test_proc_call_removal.rb +24 -0
- data/spec/unit/compiler/test_static_merger.rb +29 -0
- data/spec/unit/compiler/test_strconcat_flattener.rb +30 -0
- data/spec/unit/compiler/test_to_ruby_abstraction.rb +59 -0
- data/spec/unit/compiler/test_to_ruby_code.rb +24 -0
- data/spec/unit/dialect/test_compile.rb +52 -0
- data/spec/unit/dialect/test_dispatching.rb +19 -0
- data/spec/unit/dialect/test_evaluate.rb +41 -0
- data/spec/unit/dialect/test_render.rb +33 -0
- data/spec/unit/dialect/test_tags.rb +32 -0
- data/spec/unit/dialect/test_with_scope.rb +18 -0
- data/spec/unit/scope/test_binding_scope.rb +27 -0
- data/spec/unit/scope/test_coerce.rb +22 -0
- data/spec/unit/scope/test_object_scope.rb +38 -0
- data/spec/unit/scope/test_proxy_scope.rb +22 -0
- data/spec/unit/scope/test_root_scope.rb +22 -0
- data/spec/unit/test_assumptions.rb +29 -0
- data/spec/unit/test_scope.rb +57 -0
- data/tasks/debug_mail.rake +42 -45
- data/tasks/gem.rake +22 -17
- data/tasks/spec_test.rake +9 -17
- data/tasks/unit_test.rake +11 -12
- data/tasks/yard.rake +13 -13
- data/wlang.gemspec +36 -32
- data/wlang.noespec +27 -35
- metadata +268 -451
- data/doc/specification/about.rdoc +0 -61
- data/doc/specification/analytics.wtpl +0 -13
- data/doc/specification/dialect.wtpl +0 -14
- data/doc/specification/dialects.wtpl +0 -3
- data/doc/specification/examples.rb +0 -3
- data/doc/specification/glossary.wtpl +0 -14
- data/doc/specification/hosting.rdoc +0 -0
- data/doc/specification/overview.rdoc +0 -116
- data/doc/specification/rulesets.wtpl +0 -87
- data/doc/specification/specification.css +0 -53
- data/doc/specification/specification.html +0 -1690
- data/doc/specification/specification.js +0 -8
- data/doc/specification/specification.wtpl +0 -42
- data/doc/specification/specification.yml +0 -432
- data/doc/specification/symbols.wtpl +0 -16
- data/lib/wlang/dialect_dsl.rb +0 -141
- data/lib/wlang/dialect_loader.rb +0 -74
- data/lib/wlang/dialects/bluecloth_dialect.rb +0 -16
- data/lib/wlang/dialects/coderay_dialect.rb +0 -45
- data/lib/wlang/dialects/hosted_dialect.rb +0 -50
- data/lib/wlang/dialects/plain_text_dialect.rb +0 -69
- data/lib/wlang/dialects/rdoc_dialect.rb +0 -33
- data/lib/wlang/dialects/redcloth_dialect.rb +0 -16
- data/lib/wlang/dialects/ruby_dialect.rb +0 -118
- data/lib/wlang/dialects/sql_dialect.rb +0 -38
- data/lib/wlang/dialects/standard_dialects.rb +0 -181
- data/lib/wlang/dialects/xhtml_dialect.rb +0 -63
- data/lib/wlang/dialects/yaml_dialect.rb +0 -30
- data/lib/wlang/encoder.rb +0 -62
- data/lib/wlang/encoder_set.rb +0 -122
- data/lib/wlang/errors.rb +0 -80
- data/lib/wlang/ext/hash_methodize.rb +0 -13
- data/lib/wlang/ext/string.rb +0 -44
- data/lib/wlang/hash_scope.rb +0 -89
- data/lib/wlang/hosted_language.rb +0 -146
- data/lib/wlang/intelligent_buffer.rb +0 -94
- data/lib/wlang/parser.rb +0 -332
- data/lib/wlang/parser_state.rb +0 -94
- data/lib/wlang/rule.rb +0 -66
- data/lib/wlang/rule_set.rb +0 -106
- data/lib/wlang/rulesets/basic_ruleset.rb +0 -83
- data/lib/wlang/rulesets/buffering_ruleset.rb +0 -115
- data/lib/wlang/rulesets/context_ruleset.rb +0 -111
- data/lib/wlang/rulesets/encoding_ruleset.rb +0 -73
- data/lib/wlang/rulesets/imperative_ruleset.rb +0 -132
- data/lib/wlang/rulesets/ruleset_utils.rb +0 -317
- data/lib/wlang/wlang_command.rb +0 -51
- data/lib/wlang/wlang_command_options.rb +0 -163
- data/spec/basic_object.spec +0 -40
- data/spec/coderay_dialect.spec +0 -8
- data/spec/dialect/apply_post_transform.spec +0 -16
- data/spec/global_extensions.rb +0 -2
- data/spec/hash_scope.spec +0 -76
- data/spec/redcloth_dialect.spec +0 -24
- data/spec/test_all.rb +0 -8
- data/spec/wlang.spec +0 -53
- data/spec/wlang_spec.rb +0 -8
- data/spec/xhtml_dialect.spec +0 -22
- data/tasks/genspec.rake +0 -5
- data/test/blackbox/basic/execution_1.exp +0 -1
- data/test/blackbox/basic/execution_1.tpl +0 -1
- data/test/blackbox/basic/execution_2.exp +0 -1
- data/test/blackbox/basic/execution_2.tpl +0 -1
- data/test/blackbox/basic/execution_3.exp +0 -1
- data/test/blackbox/basic/execution_3.tpl +0 -1
- data/test/blackbox/basic/execution_4.exp +0 -1
- data/test/blackbox/basic/execution_4.tpl +0 -1
- data/test/blackbox/basic/inclusion_1.exp +0 -1
- data/test/blackbox/basic/inclusion_1.tpl +0 -1
- data/test/blackbox/basic/inclusion_2.exp +0 -1
- data/test/blackbox/basic/inclusion_2.tpl +0 -1
- data/test/blackbox/basic/injection_1.exp +0 -1
- data/test/blackbox/basic/injection_1.tpl +0 -1
- data/test/blackbox/basic/injection_2.exp +0 -1
- data/test/blackbox/basic/injection_2.tpl +0 -1
- data/test/blackbox/basic/modulation_1.exp +0 -1
- data/test/blackbox/basic/modulation_1.tpl +0 -1
- data/test/blackbox/basic/modulation_2.exp +0 -1
- data/test/blackbox/basic/modulation_2.tpl +0 -1
- data/test/blackbox/basic/recursive_app_1.exp +0 -1
- data/test/blackbox/basic/recursive_app_1.tpl +0 -1
- data/test/blackbox/basic/recursive_app_2.exp +0 -1
- data/test/blackbox/basic/recursive_app_2.tpl +0 -1
- data/test/blackbox/buffering/data_1.rb +0 -1
- data/test/blackbox/buffering/data_assignment_1.exp +0 -1
- data/test/blackbox/buffering/data_assignment_1.tpl +0 -1
- data/test/blackbox/buffering/data_assignment_2.exp +0 -1
- data/test/blackbox/buffering/data_assignment_2.tpl +0 -1
- data/test/blackbox/buffering/data_assignment_3.exp +0 -1
- data/test/blackbox/buffering/data_assignment_3.tpl +0 -1
- data/test/blackbox/buffering/data_assignment_4.exp +0 -1
- data/test/blackbox/buffering/data_assignment_4.tpl +0 -1
- data/test/blackbox/buffering/input_1.exp +0 -1
- data/test/blackbox/buffering/input_1.tpl +0 -1
- data/test/blackbox/buffering/input_2.exp +0 -1
- data/test/blackbox/buffering/input_2.tpl +0 -1
- data/test/blackbox/buffering/input_3.exp +0 -1
- data/test/blackbox/buffering/input_3.tpl +0 -1
- data/test/blackbox/buffering/input_inclusion.exp +0 -1
- data/test/blackbox/buffering/input_inclusion.tpl +0 -1
- data/test/blackbox/buffering/input_inclusion_1.exp +0 -0
- data/test/blackbox/buffering/input_inclusion_1.tpl +0 -1
- data/test/blackbox/buffering/input_inclusion_2.exp +0 -1
- data/test/blackbox/buffering/input_inclusion_2.tpl +0 -1
- data/test/blackbox/buffering/input_inclusion_3.exp +0 -1
- data/test/blackbox/buffering/input_inclusion_3.tpl +0 -1
- data/test/blackbox/buffering/input_inclusion_4.exp +0 -0
- data/test/blackbox/buffering/input_inclusion_4.tpl +0 -1
- data/test/blackbox/buffering/input_inclusion_5.exp +0 -1
- data/test/blackbox/buffering/input_inclusion_5.tpl +0 -1
- data/test/blackbox/buffering/input_inclusion_6.exp +0 -1
- data/test/blackbox/buffering/input_inclusion_6.tpl +0 -1
- data/test/blackbox/buffering/input_inclusion_7.exp +0 -0
- data/test/blackbox/buffering/input_inclusion_7.tpl +0 -1
- data/test/blackbox/buffering/text_1.txt +0 -1
- data/test/blackbox/buffering/wlang.txt +0 -1
- data/test/blackbox/context/assignment_1.exp +0 -1
- data/test/blackbox/context/assignment_1.tpl +0 -1
- data/test/blackbox/context/assignment_2.exp +0 -1
- data/test/blackbox/context/assignment_2.tpl +0 -1
- data/test/blackbox/context/assignment_3.exp +0 -2
- data/test/blackbox/context/assignment_3.tpl +0 -2
- data/test/blackbox/context/assignment_4.exp +0 -1
- data/test/blackbox/context/assignment_4.tpl +0 -1
- data/test/blackbox/context/block_assignment_1.exp +0 -1
- data/test/blackbox/context/block_assignment_1.tpl +0 -1
- data/test/blackbox/context/block_assignment_2.exp +0 -1
- data/test/blackbox/context/block_assignment_2.tpl +0 -1
- data/test/blackbox/context/modulo_assignment_1.exp +0 -1
- data/test/blackbox/context/modulo_assignment_1.tpl +0 -1
- data/test/blackbox/context/modulo_assignment_2.exp +0 -1
- data/test/blackbox/context/modulo_assignment_2.tpl +0 -1
- data/test/blackbox/data_1.rb +0 -1
- data/test/blackbox/postblock/hello.exp +0 -1
- data/test/blackbox/postblock/hello.pre +0 -1
- data/test/blackbox/postblock/hello.tpl +0 -1
- data/test/blackbox/postblock/hello_input_inclusion.exp +0 -1
- data/test/blackbox/postblock/hello_input_inclusion.tpl +0 -1
- data/test/blackbox/postblock/hello_to_authors.exp +0 -1
- data/test/blackbox/postblock/hello_to_authors.tpl +0 -1
- data/test/blackbox/poststring/hello.exp +0 -1
- data/test/blackbox/poststring/hello.tpl +0 -1
- data/test/blackbox/test_all.rb +0 -70
- data/test/standard_dialects/ruby/data.rb +0 -7
- data/test/standard_dialects/ruby/inclusion.exp +0 -6
- data/test/standard_dialects/ruby/inclusion.tpl +0 -6
- data/test/standard_dialects/test_all.rb +0 -29
- data/test/standard_dialects/yaml/assumptions_test.rb +0 -13
- data/test/standard_dialects/yaml/data.rb +0 -3
- data/test/standard_dialects/yaml/inclusion_1.exp +0 -7
- data/test/standard_dialects/yaml/inclusion_1.tpl +0 -2
- data/test/standard_dialects/yaml/inclusion_2.exp +0 -5
- data/test/standard_dialects/yaml/inclusion_2.tpl +0 -3
- data/test/unit/test_all.rb +0 -9
- data/test/unit/wlang/anagram_bugs_test.rb +0 -111
- data/test/unit/wlang/basic_ruleset_test.rb +0 -52
- data/test/unit/wlang/buffering_ruleset_test.rb +0 -102
- data/test/unit/wlang/buffering_template1.wtpl +0 -1
- data/test/unit/wlang/buffering_template2.wtpl +0 -1
- data/test/unit/wlang/buffering_template3.wtpl +0 -1
- data/test/unit/wlang/buffering_template4.wtpl +0 -1
- data/test/unit/wlang/buffering_template5.wtpl +0 -1
- data/test/unit/wlang/context_ruleset_test.rb +0 -32
- data/test/unit/wlang/data.rb +0 -3
- data/test/unit/wlang/encoder_set_test.rb +0 -42
- data/test/unit/wlang/imperative_ruleset_test.rb +0 -107
- data/test/unit/wlang/intelligent_buffer_test.rb +0 -194
- data/test/unit/wlang/othersymbols_test.rb +0 -16
- data/test/unit/wlang/parser_test.rb +0 -88
- data/test/unit/wlang/plain_text_dialect_test.rb +0 -21
- data/test/unit/wlang/ruby_dialect_test.rb +0 -100
- data/test/unit/wlang/ruby_expected.rb +0 -3
- data/test/unit/wlang/ruby_template.wrb +0 -3
- data/test/unit/wlang/ruleset_utils_test.rb +0 -245
- data/test/unit/wlang/specification_examples_test.rb +0 -54
- data/test/unit/wlang/test_utils.rb +0 -25
- data/test/unit/wlang/wlang_test.rb +0 -80
data/spec/wlang_spec.rb
DELETED
data/spec/xhtml_dialect.spec
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require File.expand_path('../spec_helper', __FILE__)
|
2
|
-
describe "The wlang/xhtml dialect" do
|
3
|
-
|
4
|
-
it("should provide helpers to create links") {
|
5
|
-
"@{/details}".wlang({}, 'wlang/xhtml').should == "/details"
|
6
|
-
"@{/details}{Details}".wlang({}, 'wlang/xhtml').should == '<a href="/details">Details</a>'
|
7
|
-
}
|
8
|
-
|
9
|
-
it("should provide to_xhtml_link callback on links") {
|
10
|
-
::String.module_eval do
|
11
|
-
def to_xhtml_link(url, label)
|
12
|
-
"#{url}:#{label}"
|
13
|
-
end
|
14
|
-
def to_xhtml_href(url)
|
15
|
-
"Hello:#{url}"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
"@{/details}{Details}".wlang({}, 'wlang/xhtml').should == '/details:Details'
|
19
|
-
"@{/details}".wlang({}, 'wlang/xhtml').should == 'Hello:/details'
|
20
|
-
}
|
21
|
-
|
22
|
-
end
|
data/tasks/genspec.rake
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
world
|
@@ -1 +0,0 @@
|
|
1
|
-
!{"world"}
|
@@ -1 +0,0 @@
|
|
1
|
-
WLang
|
@@ -1 +0,0 @@
|
|
1
|
-
!{WLang.name}
|
@@ -1 +0,0 @@
|
|
1
|
-
wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
!{who}
|
@@ -1 +0,0 @@
|
|
1
|
-
wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
!{!{whowho}}
|
@@ -1 +0,0 @@
|
|
1
|
-
wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
+{who}
|
@@ -1 +0,0 @@
|
|
1
|
-
wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
+{+{whowho}}
|
@@ -1 +0,0 @@
|
|
1
|
-
wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
${who}
|
@@ -1 +0,0 @@
|
|
1
|
-
wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
${${whowho}}
|
@@ -1 +0,0 @@
|
|
1
|
-
wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
%{blackbox/basic}{!{who}}
|
@@ -1 +0,0 @@
|
|
1
|
-
!{who}
|
@@ -1 +0,0 @@
|
|
1
|
-
%{wlang/dummy}{!{who}}
|
@@ -1 +0,0 @@
|
|
1
|
-
wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
%!{blackbox/basic}{!{who}}
|
@@ -1 +0,0 @@
|
|
1
|
-
blambeau
|
@@ -1 +0,0 @@
|
|
1
|
-
%!{blackbox/basic with who: 'blambeau'}{\!{!{whowho}\}}
|
@@ -1 +0,0 @@
|
|
1
|
-
"blambeau"
|
@@ -1 +0,0 @@
|
|
1
|
-
blambeau
|
@@ -1 +0,0 @@
|
|
1
|
-
<<={data_1.rb as x}{+{x}}
|
@@ -1 +0,0 @@
|
|
1
|
-
blambeau wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
<<={data_1.rb as who}{+{who}} +{who}
|
@@ -1 +0,0 @@
|
|
1
|
-
blambeau wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
<<={+{data_file_1} as who}{+{who}} +{who}
|
@@ -1 +0,0 @@
|
|
1
|
-
blambeau wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
<<={../+{data_file_1} as who}{+{who}} +{who}
|
@@ -1 +0,0 @@
|
|
1
|
-
text_1
|
@@ -1 +0,0 @@
|
|
1
|
-
<<{text_1.txt}
|
@@ -1 +0,0 @@
|
|
1
|
-
wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
<<{+{who}.txt}
|
@@ -1 +0,0 @@
|
|
1
|
-
text_1
|
@@ -1 +0,0 @@
|
|
1
|
-
<<{+{input_file}}
|
@@ -1 +0,0 @@
|
|
1
|
-
wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
+{who}
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
<<+{input_inclusion.tpl share none}
|
@@ -1 +0,0 @@
|
|
1
|
-
wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
<<+{input_inclusion.tpl share root}
|
@@ -1 +0,0 @@
|
|
1
|
-
wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
<<+{input_inclusion.tpl share all}
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
<<+{input_inclusion_1.tpl with who: 'blambeau'}
|
@@ -1 +0,0 @@
|
|
1
|
-
blambeau
|
@@ -1 +0,0 @@
|
|
1
|
-
<<+{input_inclusion_2.tpl with who: 'blambeau'}
|
@@ -1 +0,0 @@
|
|
1
|
-
blambeau
|
@@ -1 +0,0 @@
|
|
1
|
-
<<+{input_inclusion_3.tpl with who: 'blambeau'}
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
<<+{input_inclusion.tpl}
|
@@ -1 +0,0 @@
|
|
1
|
-
text_1
|
@@ -1 +0,0 @@
|
|
1
|
-
wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
blambeau
|
@@ -1 +0,0 @@
|
|
1
|
-
={'blambeau' as who}{!{who}}
|
@@ -1 +0,0 @@
|
|
1
|
-
blambeau wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
={'blambeau' as who}{!{who}} !{who}
|
@@ -1 +0,0 @@
|
|
1
|
-
Hello wlang!
|
@@ -1 +0,0 @@
|
|
1
|
-
Hello ={'wlang' as result}{${result}}!
|
@@ -1 +0,0 @@
|
|
1
|
-
who
|
@@ -1 +0,0 @@
|
|
1
|
-
#={x}{who}{!{x}}
|
@@ -1 +0,0 @@
|
|
1
|
-
wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
#={x}{!{who}}{!{x}}
|
@@ -1 +0,0 @@
|
|
1
|
-
!{who}
|
@@ -1 +0,0 @@
|
|
1
|
-
%={wlang/dummy as x}{!{who}}{!{x}}
|
@@ -1 +0,0 @@
|
|
1
|
-
wlang
|
@@ -1 +0,0 @@
|
|
1
|
-
%={blackbox/context as x}{!{who}}{!{x}}
|
data/test/blackbox/data_1.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"blambeau"
|
@@ -1 +0,0 @@
|
|
1
|
-
<pre>hello</pre>
|
@@ -1 +0,0 @@
|
|
1
|
-
puts "Hello world"
|
@@ -1 +0,0 @@
|
|
1
|
-
hello
|
@@ -1 +0,0 @@
|
|
1
|
-
<pre><pre>puts "Hello world"</pre></pre>
|
@@ -1 +0,0 @@
|
|
1
|
-
<<+{hello.pre}
|
@@ -1 +0,0 @@
|
|
1
|
-
<pre>hello blambeau, llambeau, acailliau</pre>
|
@@ -1 +0,0 @@
|
|
1
|
-
hello *{authors as a}{!{a}}{, }
|
@@ -1 +0,0 @@
|
|
1
|
-
HELLO
|
@@ -1 +0,0 @@
|
|
1
|
-
hello
|
data/test/blackbox/test_all.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
here = File.dirname(__FILE__)
|
2
|
-
$LOAD_PATH.unshift(File.join(here, '..', '..', 'lib'))
|
3
|
-
require 'wlang'
|
4
|
-
require 'test/unit'
|
5
|
-
module WLang
|
6
|
-
class BackBoxTest < Test::Unit::TestCase
|
7
|
-
|
8
|
-
def test_on_examples
|
9
|
-
# Dialect used here
|
10
|
-
dialect = WLang::dialect("blackbox") do
|
11
|
-
dialect("basic") {
|
12
|
-
ruby_require "wlang/rulesets/basic_ruleset"
|
13
|
-
rules WLang::RuleSet::Basic
|
14
|
-
}
|
15
|
-
dialect("context") {
|
16
|
-
ruby_require "wlang/rulesets/basic_ruleset"
|
17
|
-
ruby_require "wlang/rulesets/context_ruleset"
|
18
|
-
rules WLang::RuleSet::Basic
|
19
|
-
rules WLang::RuleSet::Context
|
20
|
-
}
|
21
|
-
dialect("buffering") {
|
22
|
-
ruby_require "wlang/rulesets/basic_ruleset"
|
23
|
-
ruby_require "wlang/rulesets/buffering_ruleset"
|
24
|
-
rules WLang::RuleSet::Basic
|
25
|
-
rules WLang::RuleSet::Buffering
|
26
|
-
}
|
27
|
-
dialect("postblock", ".pre") {
|
28
|
-
post_transform{|txt| "<pre>#{txt}</pre>"}
|
29
|
-
rules WLang::RuleSet::Basic
|
30
|
-
rules WLang::RuleSet::Buffering
|
31
|
-
rules WLang::RuleSet::Imperative
|
32
|
-
}
|
33
|
-
dialect("poststring") {
|
34
|
-
post_transform "plain-text/upcase"
|
35
|
-
rules WLang::RuleSet::Basic
|
36
|
-
}
|
37
|
-
end
|
38
|
-
hosted = ::WLang::HostedLanguage.new
|
39
|
-
def hosted.variable_missing(name)
|
40
|
-
""
|
41
|
-
end
|
42
|
-
WLang::file_extension_map('.tpl', 'blackbox/buffering')
|
43
|
-
|
44
|
-
# Context used here
|
45
|
-
context = {
|
46
|
-
'who' => 'wlang',
|
47
|
-
'whowho' => 'who',
|
48
|
-
'input_file' => 'text_1.txt',
|
49
|
-
'data_file_1' => 'data_1.rb',
|
50
|
-
'authors' => ['blambeau', 'llambeau', 'acailliau']
|
51
|
-
}
|
52
|
-
|
53
|
-
Dir["#{File.dirname(__FILE__)}/*"].each do |folder|
|
54
|
-
dialect_name = File.basename(folder)
|
55
|
-
Dir["#{folder}/*.tpl"].each do |template_file|
|
56
|
-
begin
|
57
|
-
basename = File.basename(template_file, ".tpl")
|
58
|
-
expected = File.read(File.join(folder, "#{basename}.exp"))
|
59
|
-
template = WLang::file_template(template_file, "blackbox/#{dialect_name}")
|
60
|
-
assert_equal(expected, template.instantiate(context.dup, hosted), "Blackbox test failed #{basename}")
|
61
|
-
rescue Exception => ex
|
62
|
-
puts "Blackbox test failed: #{template_file}\n#{ex.message}"
|
63
|
-
puts ex.backtrace.join("\n")
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
end # class BackBoxTest
|
70
|
-
end # module WLang
|
@@ -1,29 +0,0 @@
|
|
1
|
-
here = File.dirname(__FILE__)
|
2
|
-
$LOAD_PATH.unshift(File.join(here, '..', '..', 'lib'))
|
3
|
-
require 'wlang'
|
4
|
-
require 'test/unit'
|
5
|
-
module WLang
|
6
|
-
class StandardDialectsTest < Test::Unit::TestCase
|
7
|
-
|
8
|
-
def test_standard_dialects
|
9
|
-
Dir["#{File.dirname(__FILE__)}/*"].each do |folder|
|
10
|
-
dialect_name = File.basename(folder)
|
11
|
-
Dir["#{folder}/*.tpl"].each do |template_file|
|
12
|
-
begin
|
13
|
-
basename = File.basename(template_file, ".tpl")
|
14
|
-
expected = File.read(File.join(folder, "#{basename}.exp"))
|
15
|
-
template = WLang::file_template(template_file, "wlang/#{dialect_name}")
|
16
|
-
assert_equal(expected, template.instantiate, "Standard dialect test failed wlang/#{basename}")
|
17
|
-
rescue WLang::Error => ex
|
18
|
-
puts "Standard dialect test failed: #{template_file}\n#{ex.message}"
|
19
|
-
puts ex.wlang_backtrace.join("\n")
|
20
|
-
rescue Exception => ex
|
21
|
-
puts "Standard dialect test failed: #{template_file}\n#{ex.message}"
|
22
|
-
puts ex.backtrace.join("\n")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
end # class StandardDialectsTest
|
29
|
-
end # module WLang
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'yaml'
|
3
|
-
module WLang
|
4
|
-
class YAMLAssumptionTest < Test::Unit::TestCase
|
5
|
-
|
6
|
-
def test_it_supports_quotes_as_expected
|
7
|
-
text = "---\nauthor:\n \"Bernard Lambeau\"\n"
|
8
|
-
x = YAML::load(text)
|
9
|
-
assert_equal({'author' => "Bernard Lambeau"}, x)
|
10
|
-
end
|
11
|
-
|
12
|
-
end # class YAMLAssumptionTest
|
13
|
-
end # module WLang
|