rattler 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -175
- data/features/README.markdown +27 -0
- data/features/Tutorial.md +224 -0
- data/features/command_line/output_option.feature +2 -1
- data/features/command_line/{parser_generator.feature → rtlr.feature} +43 -15
- data/features/error_reporting/automatic_error_messages.feature +40 -0
- data/features/error_reporting/custom_error_messages.feature +28 -0
- data/features/examples/json_parser.markdown +88 -0
- data/features/{grammar → extended_matching_syntax}/back_reference.feature +5 -3
- data/features/{grammar → extended_matching_syntax}/e_symbol.feature +2 -2
- data/features/{grammar → extended_matching_syntax}/eof.feature +4 -3
- data/features/{grammar → extended_matching_syntax}/fail.feature +8 -6
- data/features/extended_matching_syntax/fragments.feature +29 -0
- data/features/extended_matching_syntax/include.feature +42 -0
- data/features/{grammar → extended_matching_syntax}/list_matching.feature +7 -6
- data/features/extended_matching_syntax/posix_class.feature +127 -0
- data/features/{grammar → extended_matching_syntax}/repeat.feature +29 -3
- data/features/{grammar → extended_matching_syntax}/skip_operator.feature +2 -1
- data/features/extended_matching_syntax/super.feature +24 -0
- data/features/{grammar → extended_matching_syntax}/token.feature +6 -5
- data/features/{grammar → extended_matching_syntax}/whitespace.feature +7 -6
- data/features/{grammar → extended_matching_syntax}/word_literal.feature +10 -6
- data/features/grammar_heading/explicit_start_rule.feature +20 -0
- data/features/grammar_heading/grammar_declaration.feature +60 -0
- data/features/grammar_heading/include.feature +19 -0
- data/features/grammar_heading/require.feature +27 -0
- data/features/{grammar → peg_syntax}/any_character.feature +1 -1
- data/features/peg_syntax/character_class.feature +25 -0
- data/features/{grammar → peg_syntax}/comments.feature +1 -1
- data/features/{grammar → peg_syntax}/literal.feature +5 -3
- data/features/{grammar → peg_syntax}/negative_lookahead.feature +5 -3
- data/features/peg_syntax/nonterminal.feature +46 -0
- data/features/peg_syntax/one_or_more.feature +59 -0
- data/features/{grammar → peg_syntax}/optional.feature +2 -2
- data/features/peg_syntax/ordered_choice.feature +24 -0
- data/features/{grammar → peg_syntax}/positive_lookahead.feature +6 -4
- data/features/peg_syntax/sequence.feature +23 -0
- data/features/{grammar → peg_syntax}/start_rule.feature +1 -1
- data/features/peg_syntax/zero_or_more.feature +59 -0
- data/features/{grammar → semantics}/labels.feature +0 -0
- data/features/{grammar → semantics}/negative_semantic_predicate.feature +30 -9
- data/features/{grammar → semantics}/node_action.feature +0 -0
- data/features/{grammar → semantics}/positive_semantic_predicate.feature +29 -8
- data/features/{grammar/symantic_action.feature → semantics/semantic_action.feature} +2 -2
- data/features/semantics/semantic_result.feature +86 -0
- data/features/{grammar → semantics}/side_effect.feature +33 -21
- data/features/step_definitions/cli_steps.rb +1 -1
- data/features/step_definitions/grammar_steps.rb +19 -5
- data/features/support/env.rb +5 -0
- data/lib/rattler.rb +21 -44
- data/lib/rattler/compiler.rb +69 -0
- data/lib/rattler/{grammar → compiler}/grammar_parser.rb +58 -24
- data/lib/rattler/compiler/metagrammar.rb +1570 -0
- data/lib/rattler/compiler/optimizer.rb +77 -0
- data/lib/rattler/{back_end → compiler}/optimizer/composite_reducing.rb +2 -2
- data/lib/rattler/{back_end → compiler}/optimizer/flatten_choice.rb +3 -12
- data/lib/rattler/{back_end → compiler}/optimizer/flatten_sequence.rb +4 -16
- data/lib/rattler/{back_end → compiler}/optimizer/flattening.rb +2 -2
- data/lib/rattler/compiler/optimizer/inline_regular_rules.rb +24 -0
- data/lib/rattler/{back_end → compiler}/optimizer/join_match_capturing_sequence.rb +16 -14
- data/lib/rattler/{back_end → compiler}/optimizer/join_match_choice.rb +4 -13
- data/lib/rattler/{back_end → compiler}/optimizer/join_match_matching_sequence.rb +4 -13
- data/lib/rattler/compiler/optimizer/join_match_sequence.rb +7 -0
- data/lib/rattler/{back_end → compiler}/optimizer/join_predicate_bare_match.rb +3 -12
- data/lib/rattler/compiler/optimizer/join_predicate_match.rb +7 -0
- data/lib/rattler/{back_end → compiler}/optimizer/join_predicate_nested_match.rb +4 -13
- data/lib/rattler/{back_end → compiler}/optimizer/join_predicate_or_bare_match.rb +3 -12
- data/lib/rattler/compiler/optimizer/join_predicate_or_match.rb +7 -0
- data/lib/rattler/{back_end → compiler}/optimizer/join_predicate_or_nested_match.rb +4 -13
- data/lib/rattler/{back_end → compiler}/optimizer/match_joining.rb +2 -2
- data/lib/rattler/{back_end → compiler}/optimizer/optimization.rb +12 -34
- data/lib/rattler/compiler/optimizer/optimization_context.rb +83 -0
- data/lib/rattler/{back_end → compiler}/optimizer/optimization_sequence.rb +3 -11
- data/lib/rattler/compiler/optimizer/optimizations.rb +27 -0
- data/lib/rattler/{back_end → compiler}/optimizer/optimize_children.rb +6 -14
- data/lib/rattler/{back_end → compiler}/optimizer/reduce_repeat_match.rb +4 -13
- data/lib/rattler/compiler/optimizer/remove_meaningless_wrapper.rb +22 -0
- data/lib/rattler/{back_end → compiler}/optimizer/simplify_redundant_repeat.rb +4 -13
- data/lib/rattler/{back_end → compiler}/optimizer/simplify_token_match.rb +4 -13
- data/lib/rattler/compiler/parser_generator.rb +108 -0
- data/lib/rattler/{back_end → compiler}/parser_generator/apply_generator.rb +7 -21
- data/lib/rattler/{back_end → compiler}/parser_generator/assert_generator.rb +11 -19
- data/lib/rattler/compiler/parser_generator/attributed_sequence_generator.rb +37 -0
- data/lib/rattler/{back_end → compiler}/parser_generator/back_reference_generator.rb +10 -10
- data/lib/rattler/{back_end → compiler}/parser_generator/choice_generator.rb +10 -22
- data/lib/rattler/{back_end → compiler}/parser_generator/delegating_generator.rb +2 -2
- data/lib/rattler/{back_end → compiler}/parser_generator/disallow_generator.rb +11 -19
- data/lib/rattler/{back_end → compiler}/parser_generator/e_symbol_generator.rb +2 -10
- data/lib/rattler/{back_end → compiler}/parser_generator/eof_generator.rb +2 -10
- data/lib/rattler/{back_end → compiler}/parser_generator/expr_generator.rb +9 -35
- data/lib/rattler/{back_end → compiler}/parser_generator/fail_generator.rb +7 -3
- data/lib/rattler/{back_end → compiler}/parser_generator/gen_method_names.rb +3 -5
- data/lib/rattler/{back_end → compiler}/parser_generator/general_list_generator.rb +6 -18
- data/lib/rattler/{back_end → compiler}/parser_generator/general_repeat_generator.rb +16 -22
- data/lib/rattler/{back_end/parser_generator/rule_set_generator.rb → compiler/parser_generator/grammar_generator.rb} +24 -33
- data/lib/rattler/compiler/parser_generator/group_match.rb +33 -0
- data/lib/rattler/{back_end → compiler}/parser_generator/group_match_generator.rb +4 -17
- data/lib/rattler/compiler/parser_generator/label_generator.rb +37 -0
- data/lib/rattler/{back_end → compiler}/parser_generator/list0_generating.rb +5 -5
- data/lib/rattler/{back_end → compiler}/parser_generator/list1_generating.rb +3 -3
- data/lib/rattler/{back_end → compiler}/parser_generator/list_generator.rb +2 -2
- data/lib/rattler/{back_end → compiler}/parser_generator/match_generator.rb +10 -10
- data/lib/rattler/{back_end → compiler}/parser_generator/nested.rb +2 -2
- data/lib/rattler/compiler/parser_generator/node_action_generator.rb +49 -0
- data/lib/rattler/{back_end → compiler}/parser_generator/one_or_more_generating.rb +3 -3
- data/lib/rattler/{back_end → compiler}/parser_generator/optional_generating.rb +6 -22
- data/lib/rattler/compiler/parser_generator/predicate_propogating.rb +24 -0
- data/lib/rattler/{back_end → compiler}/parser_generator/repeat_generator.rb +2 -2
- data/lib/rattler/compiler/parser_generator/rule_generator.rb +66 -0
- data/lib/rattler/compiler/parser_generator/rule_set_generator.rb +33 -0
- data/lib/rattler/compiler/parser_generator/semantic_action_generator.rb +58 -0
- data/lib/rattler/compiler/parser_generator/sequence_generating.rb +138 -0
- data/lib/rattler/compiler/parser_generator/sequence_generator.rb +57 -0
- data/lib/rattler/{back_end → compiler}/parser_generator/skip_generator.rb +4 -18
- data/lib/rattler/compiler/parser_generator/skip_propogating.rb +16 -0
- data/lib/rattler/{back_end → compiler}/parser_generator/sub_generating.rb +19 -11
- data/lib/rattler/compiler/parser_generator/super_generator.rb +54 -0
- data/lib/rattler/{back_end → compiler}/parser_generator/token_generator.rb +3 -3
- data/lib/rattler/compiler/parser_generator/token_propogating.rb +10 -0
- data/lib/rattler/{back_end → compiler}/parser_generator/top_level.rb +2 -2
- data/lib/rattler/{back_end → compiler}/parser_generator/zero_or_more_generating.rb +5 -5
- data/lib/rattler/compiler/rattler.rtlr +201 -0
- data/lib/rattler/{back_end → compiler}/ruby_generator.rb +16 -25
- data/lib/rattler/parsers.rb +12 -33
- data/lib/rattler/parsers/action_code.rb +25 -16
- data/lib/rattler/{grammar → parsers}/analysis.rb +32 -11
- data/lib/rattler/parsers/apply.rb +10 -19
- data/lib/rattler/parsers/assert.rb +4 -14
- data/lib/rattler/parsers/atomic.rb +3 -10
- data/lib/rattler/parsers/attributed_sequence.rb +50 -0
- data/lib/rattler/parsers/back_reference.rb +19 -14
- data/lib/rattler/parsers/choice.rb +11 -12
- data/lib/rattler/parsers/combinator_parser.rb +15 -7
- data/lib/rattler/parsers/combining.rb +15 -9
- data/lib/rattler/parsers/disallow.rb +5 -12
- data/lib/rattler/parsers/e_symbol.rb +5 -14
- data/lib/rattler/parsers/eof.rb +10 -15
- data/lib/rattler/parsers/fail.rb +16 -26
- data/lib/rattler/{grammar → parsers}/grammar.rb +15 -20
- data/lib/rattler/parsers/label.rb +10 -16
- data/lib/rattler/parsers/list_parser.rb +14 -14
- data/lib/rattler/parsers/match.rb +5 -17
- data/lib/rattler/parsers/node_action.rb +72 -0
- data/lib/rattler/parsers/node_code.rb +47 -30
- data/lib/rattler/parsers/parser.rb +63 -32
- data/lib/rattler/parsers/parser_scope.rb +88 -0
- data/lib/rattler/parsers/predicate.rb +12 -10
- data/lib/rattler/parsers/repeat.rb +15 -8
- data/lib/rattler/parsers/rule.rb +8 -23
- data/lib/rattler/parsers/rule_set.rb +67 -12
- data/lib/rattler/parsers/semantic.rb +36 -0
- data/lib/rattler/parsers/semantic_action.rb +39 -0
- data/lib/rattler/parsers/sequence.rb +25 -40
- data/lib/rattler/parsers/sequencing.rb +40 -0
- data/lib/rattler/parsers/skip.rb +11 -12
- data/lib/rattler/parsers/super.rb +33 -0
- data/lib/rattler/parsers/token.rb +3 -13
- data/lib/rattler/rake_task.rb +50 -0
- data/lib/rattler/runner.rb +19 -22
- data/lib/rattler/runtime.rb +0 -10
- data/lib/rattler/runtime/extended_packrat_parser.rb +40 -45
- data/lib/rattler/runtime/packrat_parser.rb +17 -31
- data/lib/rattler/runtime/parse_failure.rb +16 -26
- data/lib/rattler/runtime/parse_node.rb +8 -18
- data/lib/rattler/runtime/parser.rb +6 -18
- data/lib/rattler/runtime/parser_helper.rb +3 -10
- data/lib/rattler/runtime/recursive_descent_parser.rb +26 -23
- data/lib/rattler/runtime/syntax_error.rb +0 -10
- data/lib/rattler/util.rb +2 -6
- data/lib/rattler/util/grammar_cli.rb +19 -0
- data/lib/rattler/util/graphviz.rb +6 -17
- data/lib/rattler/util/graphviz/digraph_builder.rb +10 -17
- data/lib/rattler/util/graphviz/node_builder.rb +45 -31
- data/lib/rattler/util/line_counter.rb +11 -20
- data/lib/rattler/util/node.rb +52 -30
- data/lib/rattler/util/parser_cli.rb +84 -0
- data/lib/rattler/util/parser_spec_helper.rb +8 -12
- data/spec/rattler/compiler/assert_compiler_examples.rb +284 -0
- data/spec/rattler/compiler/attributed_sequence_compiler_examples.rb +154 -0
- data/spec/rattler/compiler/disallow_compiler_examples.rb +293 -0
- data/spec/rattler/compiler/grammar_parser_spec.rb +700 -0
- data/spec/rattler/{back_end → compiler}/optimizer/flatten_choice_spec.rb +1 -1
- data/spec/rattler/{back_end → compiler}/optimizer/flatten_sequence_spec.rb +1 -1
- data/spec/rattler/compiler/optimizer/inline_regular_rules_spec.rb +50 -0
- data/spec/rattler/{back_end → compiler}/optimizer/join_match_capturing_sequence_spec.rb +106 -22
- data/spec/rattler/{back_end → compiler}/optimizer/join_match_choice_spec.rb +1 -1
- data/spec/rattler/{back_end → compiler}/optimizer/join_match_matching_sequence_spec.rb +1 -1
- data/spec/rattler/{back_end → compiler}/optimizer/join_predicate_bare_match_spec.rb +1 -1
- data/spec/rattler/{back_end → compiler}/optimizer/join_predicate_nested_match_spec.rb +1 -1
- data/spec/rattler/{back_end → compiler}/optimizer/join_predicate_or_bare_match_spec.rb +1 -1
- data/spec/rattler/{back_end → compiler}/optimizer/join_predicate_or_nested_match_spec.rb +1 -1
- data/spec/rattler/{back_end → compiler}/optimizer/reduce_repeat_match_spec.rb +1 -1
- data/spec/rattler/compiler/optimizer/remove_meaningless_wrapper_spec.rb +82 -0
- data/spec/rattler/{back_end → compiler}/optimizer/simplify_redundant_repeat_spec.rb +1 -1
- data/spec/rattler/{back_end → compiler}/optimizer/simplify_token_match_spec.rb +1 -1
- data/spec/rattler/{back_end → compiler}/optimizer_spec.rb +1 -1
- data/spec/rattler/{back_end → compiler}/parser_generator/apply_generator_spec.rb +1 -39
- data/spec/rattler/{back_end → compiler}/parser_generator/assert_generator_spec.rb +1 -55
- data/spec/rattler/compiler/parser_generator/attributed_sequence_generator_spec.rb +699 -0
- data/spec/rattler/{back_end → compiler}/parser_generator/back_reference_generator_spec.rb +3 -56
- data/spec/rattler/{back_end → compiler}/parser_generator/choice_generator_spec.rb +1 -63
- data/spec/rattler/{back_end → compiler}/parser_generator/disallow_generator_spec.rb +1 -55
- data/spec/rattler/{back_end → compiler}/parser_generator/e_symbol_generator_spec.rb +1 -39
- data/spec/rattler/{back_end → compiler}/parser_generator/eof_generator_spec.rb +1 -39
- data/spec/rattler/{back_end → compiler}/parser_generator/fail_generator_spec.rb +94 -23
- data/spec/rattler/compiler/parser_generator/grammar_generator_spec.rb +98 -0
- data/spec/rattler/compiler/parser_generator/group_match_generator_spec.rb +67 -0
- data/spec/rattler/{back_end → compiler}/parser_generator/group_match_spec.rb +1 -1
- data/spec/rattler/{back_end → compiler}/parser_generator/label_generator_spec.rb +1 -55
- data/spec/rattler/{back_end → compiler}/parser_generator/list0_generator_examples.rb +0 -88
- data/spec/rattler/{back_end → compiler}/parser_generator/list1_generator_examples.rb +0 -88
- data/spec/rattler/{back_end → compiler}/parser_generator/list_generator_spec.rb +1 -227
- data/spec/rattler/{back_end → compiler}/parser_generator/match_generator_spec.rb +1 -55
- data/spec/rattler/compiler/parser_generator/node_action_generator_spec.rb +135 -0
- data/spec/rattler/{back_end → compiler}/parser_generator/one_or_more_generator_examples.rb +0 -74
- data/spec/rattler/{back_end → compiler}/parser_generator/optional_generator_examples.rb +0 -62
- data/spec/rattler/{back_end → compiler}/parser_generator/repeat_generator_spec.rb +66 -1
- data/spec/rattler/{back_end → compiler}/parser_generator/rule_generator_spec.rb +3 -2
- data/spec/rattler/{back_end → compiler}/parser_generator/rule_set_generator_spec.rb +9 -27
- data/spec/rattler/compiler/parser_generator/semantic_action_generator_spec.rb +437 -0
- data/spec/rattler/{back_end → compiler}/parser_generator/sequence_generator_spec.rb +234 -68
- data/spec/rattler/{back_end → compiler}/parser_generator/skip_generator_spec.rb +1 -55
- data/spec/rattler/compiler/parser_generator/super_generator_spec.rb +93 -0
- data/spec/rattler/{back_end → compiler}/parser_generator/token_generator_spec.rb +1 -55
- data/spec/rattler/{back_end → compiler}/parser_generator/zero_or_more_generator_examples.rb +0 -74
- data/spec/rattler/{back_end → compiler}/ruby_generator_spec.rb +13 -13
- data/spec/rattler/compiler/semantic_action_compiler_examples.rb +57 -0
- data/spec/rattler/{back_end → compiler}/shared_compiler_examples.rb +111 -140
- data/spec/rattler/{back_end → compiler}/skip_compiler_examples.rb +60 -57
- data/spec/rattler/{back_end → compiler}/token_compiler_examples.rb +99 -104
- data/spec/rattler/compiler_spec.rb +67 -0
- data/spec/rattler/parsers/action_code_spec.rb +34 -18
- data/spec/rattler/{grammar → parsers}/analysis_spec.rb +13 -67
- data/spec/rattler/parsers/apply_spec.rb +6 -0
- data/spec/rattler/parsers/assert_spec.rb +38 -2
- data/spec/rattler/parsers/attributed_sequence_spec.rb +204 -0
- data/spec/rattler/parsers/back_reference_spec.rb +6 -0
- data/spec/rattler/parsers/choice_spec.rb +38 -1
- data/spec/rattler/parsers/combinator_parser_spec.rb +2 -1
- data/spec/rattler/parsers/disallow_spec.rb +38 -2
- data/spec/rattler/parsers/e_symbol_spec.rb +6 -0
- data/spec/rattler/parsers/eof_spec.rb +6 -0
- data/spec/rattler/parsers/fail_spec.rb +6 -0
- data/spec/rattler/{grammar → parsers}/grammar_spec.rb +10 -15
- data/spec/rattler/parsers/label_spec.rb +30 -0
- data/spec/rattler/parsers/list_parser_spec.rb +31 -2
- data/spec/rattler/parsers/match_spec.rb +6 -0
- data/spec/rattler/parsers/node_action_spec.rb +121 -0
- data/spec/rattler/parsers/parser_scope_spec.rb +105 -0
- data/spec/rattler/parsers/repeat_spec.rb +56 -0
- data/spec/rattler/parsers/rule_set_spec.rb +42 -0
- data/spec/rattler/parsers/semantic_action_spec.rb +89 -0
- data/spec/rattler/parsers/sequence_spec.rb +156 -12
- data/spec/rattler/parsers/skip_spec.rb +21 -0
- data/spec/rattler/parsers/super_spec.rb +45 -0
- data/spec/rattler/parsers/token_spec.rb +33 -14
- data/spec/rattler/runtime/extended_packrat_parser_spec.rb +10 -8
- data/spec/rattler/runtime/recursive_descent_parser_spec.rb +26 -0
- data/spec/rattler/runtime/shared_parser_examples.rb +22 -16
- data/spec/rattler/util/graphviz/node_builder_spec.rb +33 -17
- data/spec/rattler/util/line_counter_spec.rb +21 -21
- data/spec/rattler/util/node_spec.rb +62 -0
- data/spec/rattler_spec.rb +7 -41
- data/spec/spec_helper.rb +1 -2
- data/spec/support/combinator_parser_spec_helper.rb +1 -1
- data/spec/support/compiler_spec_helper.rb +0 -4
- data/spec/support/parser_generator_spec_helper.rb +7 -7
- data/spec/support/runtime_parser_spec_helper.rb +57 -3
- metadata +447 -303
- data/features/grammar/character_class.feature +0 -20
- data/features/grammar/nonterminal.feature +0 -24
- data/features/grammar/one_or_more.feature +0 -34
- data/features/grammar/ordered_choice.feature +0 -21
- data/features/grammar/posix_class.feature +0 -70
- data/features/grammar/sequence.feature +0 -20
- data/features/grammar/zero_or_more.feature +0 -34
- data/lib/rattler/back_end.rb +0 -22
- data/lib/rattler/back_end/compiler.rb +0 -128
- data/lib/rattler/back_end/optimizer.rb +0 -101
- data/lib/rattler/back_end/optimizer/inline_regular_rules.rb +0 -46
- data/lib/rattler/back_end/optimizer/join_match_sequence.rb +0 -17
- data/lib/rattler/back_end/optimizer/join_predicate_match.rb +0 -17
- data/lib/rattler/back_end/optimizer/join_predicate_or_match.rb +0 -17
- data/lib/rattler/back_end/optimizer/optimization_context.rb +0 -72
- data/lib/rattler/back_end/optimizer/remove_meaningless_wrapper.rb +0 -32
- data/lib/rattler/back_end/optimizer/specialize_repeat.rb +0 -40
- data/lib/rattler/back_end/parser_generator.rb +0 -113
- data/lib/rattler/back_end/parser_generator/direct_action_generator.rb +0 -45
- data/lib/rattler/back_end/parser_generator/dispatch_action_generator.rb +0 -45
- data/lib/rattler/back_end/parser_generator/group_match.rb +0 -26
- data/lib/rattler/back_end/parser_generator/label_generator.rb +0 -64
- data/lib/rattler/back_end/parser_generator/predicate_propogating.rb +0 -24
- data/lib/rattler/back_end/parser_generator/rule_generator.rb +0 -53
- data/lib/rattler/back_end/parser_generator/sequence_generator.rb +0 -190
- data/lib/rattler/back_end/parser_generator/skip_propogating.rb +0 -16
- data/lib/rattler/back_end/parser_generator/token_propogating.rb +0 -10
- data/lib/rattler/grammar.rb +0 -43
- data/lib/rattler/grammar/grammar_dsl.rb +0 -51
- data/lib/rattler/grammar/metagrammar.rb +0 -990
- data/lib/rattler/grammar/rattler.rtlr +0 -183
- data/lib/rattler/parsers/assert_code.rb +0 -31
- data/lib/rattler/parsers/direct_action.rb +0 -85
- data/lib/rattler/parsers/disallow_code.rb +0 -31
- data/lib/rattler/parsers/dispatch_action.rb +0 -121
- data/lib/rattler/parsers/effect_code.rb +0 -31
- data/lib/rattler/parsers/parser_dsl.rb +0 -414
- data/lib/rattler/parsers/semantic_assert.rb +0 -19
- data/lib/rattler/parsers/semantic_disallow.rb +0 -19
- data/lib/rattler/parsers/side_effect.rb +0 -19
- data/spec/rattler/back_end/assert_compiler_examples.rb +0 -187
- data/spec/rattler/back_end/compiler_spec.rb +0 -43
- data/spec/rattler/back_end/direct_action_compiler_examples.rb +0 -227
- data/spec/rattler/back_end/disallow_compiler_examples.rb +0 -187
- data/spec/rattler/back_end/dispatch_action_compiler_examples.rb +0 -225
- data/spec/rattler/back_end/optimizer/inline_regular_rules_spec.rb +0 -80
- data/spec/rattler/back_end/parser_generator/direct_action_generator_spec.rb +0 -204
- data/spec/rattler/back_end/parser_generator/dispatch_action_generator_spec.rb +0 -204
- data/spec/rattler/back_end/parser_generator/group_match_generator_spec.rb +0 -185
- data/spec/rattler/back_end/semantic_assert_compiler_examples.rb +0 -152
- data/spec/rattler/back_end/semantic_disallow_compiler_examples.rb +0 -152
- data/spec/rattler/back_end/side_effect_compiler_examples.rb +0 -227
- data/spec/rattler/grammar/grammar_parser_spec.rb +0 -626
- data/spec/rattler/parsers/direct_action_spec.rb +0 -224
- data/spec/rattler/parsers/dispatch_action_spec.rb +0 -209
- data/spec/rattler/parsers/node_code_spec.rb +0 -59
- data/spec/rattler/parsers/parser_dsl_spec.rb +0 -334
- data/spec/rattler/parsers/semantic_assert_spec.rb +0 -83
- data/spec/rattler/parsers/semantic_disallow_spec.rb +0 -83
- data/spec/rattler/parsers/side_effect_spec.rb +0 -214
@@ -0,0 +1,67 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/compiler/shared_compiler_examples')
|
3
|
+
|
4
|
+
describe Rattler::Compiler do
|
5
|
+
include CompilerSpecHelper
|
6
|
+
include RuntimeParserSpecHelper
|
7
|
+
|
8
|
+
describe '.compile_parser result' do
|
9
|
+
|
10
|
+
let :compiled_parser do
|
11
|
+
described_class.compile_parser compiled_parser_base, grammar, :no_optimize => true
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:compiled_parser_base) { Rattler::Runtime::RecursiveDescentParser }
|
15
|
+
|
16
|
+
it_behaves_like 'a compiled parser'
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '.compile_parser' do
|
20
|
+
|
21
|
+
let(:grammar) { Rattler::Parsers::Grammar[Rattler::Parsers::RuleSet[*rules]] }
|
22
|
+
|
23
|
+
context 'given parse rules' do
|
24
|
+
|
25
|
+
let(:rules) { [
|
26
|
+
rule(:word) { match(/\w+/) },
|
27
|
+
rule(:space) { match(/\s*/) }
|
28
|
+
] }
|
29
|
+
|
30
|
+
let(:parser_base) { Rattler::Runtime::RecursiveDescentParser }
|
31
|
+
|
32
|
+
let(:result) { described_class.compile_parser(parser_base, grammar) }
|
33
|
+
|
34
|
+
it 'compiles a match_xxx method for each rule' do
|
35
|
+
result.should have_method(:match_word)
|
36
|
+
result.should have_method(:match_space)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '.compile' do
|
42
|
+
|
43
|
+
let(:grammar) { Rattler::Parsers::Grammar[Rattler::Parsers::RuleSet[*rules]] }
|
44
|
+
|
45
|
+
context 'given parse rules' do
|
46
|
+
|
47
|
+
let(:rules) { [
|
48
|
+
rule(:word) { match(/\w+/) },
|
49
|
+
rule(:space) { match(/\s*/) }
|
50
|
+
] }
|
51
|
+
|
52
|
+
let(:target_module) { Module.new }
|
53
|
+
|
54
|
+
before { described_class.compile(target_module, grammar) }
|
55
|
+
|
56
|
+
it 'compiles a match_xxx method for each rule' do
|
57
|
+
target_module.should have_method(:match_word)
|
58
|
+
target_module.should have_method(:match_space)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def have_method(rule_name)
|
64
|
+
be_method_defined(rule_name)
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
@@ -72,49 +72,53 @@ describe Rattler::Parsers::ActionCode do
|
|
72
72
|
|
73
73
|
describe '#bind' do
|
74
74
|
|
75
|
-
let(:scope) {
|
75
|
+
let(:scope) { ParserScope.new(bindings, captures) }
|
76
|
+
let(:bindings) { {} }
|
77
|
+
let(:captures) { [] }
|
76
78
|
|
77
79
|
context 'when the code uses block parameters' do
|
78
80
|
|
81
|
+
let(:captures) { ['r0_0', 'r0_1'] }
|
82
|
+
|
79
83
|
let(:code) { '|a, b| a + b' }
|
80
84
|
|
81
|
-
it 'replaces block parameter names with corresponding
|
82
|
-
subject.bind(scope
|
85
|
+
it 'replaces block parameter names with corresponding captures' do
|
86
|
+
subject.bind(scope).should == 'r0_0 + r0_1'
|
83
87
|
end
|
84
88
|
end
|
85
89
|
|
86
90
|
context 'when the code refers to labels' do
|
87
91
|
|
88
|
-
let(:
|
92
|
+
let(:bindings) { {:l => 'r0_3', :r => 'r0_5'} }
|
89
93
|
|
90
94
|
let(:code) { 'l + r' }
|
91
95
|
|
92
96
|
it 'replaces label names with associated arguments' do
|
93
|
-
subject.bind(scope
|
97
|
+
subject.bind(scope).should == 'r0_3 + r0_5'
|
94
98
|
end
|
95
99
|
end
|
96
100
|
|
97
101
|
context 'when the code uses block parameters and label names' do
|
98
102
|
|
99
|
-
let(:
|
103
|
+
let(:bindings) { {:c => 'r0_3', :d => 'r0_5'} }
|
104
|
+
let(:captures) { ['r0_0', 'r0_1'] }
|
100
105
|
|
101
106
|
let(:code) { '|a, b| a * c + b * d' }
|
102
107
|
|
103
108
|
it 'replaces both block parameter names and label names' do
|
104
|
-
subject.bind(scope
|
105
|
-
should == 'r0_0 * r0_3 + r0_1 * r0_5'
|
109
|
+
subject.bind(scope).should == 'r0_0 * r0_3 + r0_1 * r0_5'
|
106
110
|
end
|
107
111
|
end
|
108
112
|
|
109
113
|
context 'when the code uses block parameters that are label names' do
|
110
114
|
|
111
|
-
let(:
|
115
|
+
let(:bindings) { {:b => 'r0_3', :c => 'r0_5'} }
|
116
|
+
let(:captures) { ['r0_0', 'r0_1'] }
|
112
117
|
|
113
118
|
let(:code) { '|a, b| a * c + b' }
|
114
119
|
|
115
120
|
it 'the block parameters shadow the label names' do
|
116
|
-
subject.bind(scope
|
117
|
-
should == 'r0_0 * r0_5 + r0_1'
|
121
|
+
subject.bind(scope).should == 'r0_0 * r0_5 + r0_1'
|
118
122
|
end
|
119
123
|
end
|
120
124
|
|
@@ -123,25 +127,32 @@ describe Rattler::Parsers::ActionCode do
|
|
123
127
|
let(:code) { '_.to_s' }
|
124
128
|
|
125
129
|
context 'given one argument' do
|
130
|
+
|
131
|
+
let(:captures) { ['r0'] }
|
132
|
+
|
126
133
|
it 'replaces "_" with the argument' do
|
127
|
-
subject.bind(scope
|
134
|
+
subject.bind(scope).should == 'r0.to_s'
|
128
135
|
end
|
129
136
|
end
|
130
137
|
|
131
138
|
context 'given multiple arguments' do
|
139
|
+
|
140
|
+
let(:captures) { ['r0_0', 'r0_1'] }
|
141
|
+
|
132
142
|
it 'replaces "_" with the array of arguments' do
|
133
|
-
subject.bind(scope
|
134
|
-
should == '[r0_0, r0_1].to_s'
|
143
|
+
subject.bind(scope).should == '[r0_0, r0_1].to_s'
|
135
144
|
end
|
136
145
|
end
|
137
146
|
end
|
138
147
|
|
139
148
|
context 'when the code uses "_" as a block parameter' do
|
140
149
|
|
150
|
+
let(:captures) { ['r0_0', 'r0_1'] }
|
151
|
+
|
141
152
|
let(:code) { '|_| _.to_f' }
|
142
153
|
|
143
154
|
it 'the block parameter shadows the default "_" binding' do
|
144
|
-
subject.bind(scope
|
155
|
+
subject.bind(scope).should == 'r0_0.to_f'
|
145
156
|
end
|
146
157
|
end
|
147
158
|
|
@@ -150,15 +161,20 @@ describe Rattler::Parsers::ActionCode do
|
|
150
161
|
let(:code) { 'do_stuff *_' }
|
151
162
|
|
152
163
|
context 'given one argument' do
|
164
|
+
|
165
|
+
let(:captures) { ['r0'] }
|
166
|
+
|
153
167
|
it 'replaces "*_" with the argument' do
|
154
|
-
subject.bind(scope
|
168
|
+
subject.bind(scope).should == 'do_stuff r0'
|
155
169
|
end
|
156
170
|
end
|
157
171
|
|
158
172
|
context 'given multiple arguments' do
|
173
|
+
|
174
|
+
let(:captures) { ['r0_0', 'r0_1'] }
|
175
|
+
|
159
176
|
it 'replaces "*_" with the arguments' do
|
160
|
-
subject.bind(scope
|
161
|
-
should == 'do_stuff r0_0, r0_1'
|
177
|
+
subject.bind(scope).should == 'do_stuff r0_0, r0_1'
|
162
178
|
end
|
163
179
|
end
|
164
180
|
end
|
@@ -2,11 +2,11 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
2
|
|
3
3
|
include Rattler::Parsers
|
4
4
|
|
5
|
-
describe
|
5
|
+
describe Analysis do
|
6
6
|
|
7
7
|
subject { described_class.new(grammar.rules) }
|
8
8
|
|
9
|
-
let(:grammar) { Rattler::
|
9
|
+
let(:grammar) { Rattler::Parsers::Grammar[rule_set] }
|
10
10
|
|
11
11
|
describe '#recursive?' do
|
12
12
|
|
@@ -46,6 +46,17 @@ describe Rattler::Grammar::Analysis do
|
|
46
46
|
subject.recursive?(:a).should be_false
|
47
47
|
end
|
48
48
|
end
|
49
|
+
|
50
|
+
context 'given a rule with a Super' do
|
51
|
+
|
52
|
+
let (:rule_set) { RuleSet[
|
53
|
+
Rule[:a, Sequence[Match[/a/], Super[:a]]]
|
54
|
+
] }
|
55
|
+
|
56
|
+
it 'returns true' do
|
57
|
+
subject.recursive?(:a).should be_true
|
58
|
+
end
|
59
|
+
end
|
49
60
|
end
|
50
61
|
|
51
62
|
describe '#left_recursive?' do
|
@@ -99,69 +110,4 @@ describe Rattler::Grammar::Analysis do
|
|
99
110
|
end
|
100
111
|
end
|
101
112
|
|
102
|
-
describe '#referenced_from?' do
|
103
|
-
|
104
|
-
context 'with non-recursive rules' do
|
105
|
-
|
106
|
-
let(:rule_set) { RuleSet[
|
107
|
-
Rule[:a, Apply[:b]],
|
108
|
-
Rule[:b, Apply[:c]],
|
109
|
-
Rule[:c, Match[/a/]],
|
110
|
-
Rule[:d, Match[/b/]]
|
111
|
-
] }
|
112
|
-
|
113
|
-
context 'given a rule name and itself' do
|
114
|
-
it 'returns false' do
|
115
|
-
subject.referenced_from?(:a, :a).should be_false
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
context 'given a directly referenced rule name' do
|
120
|
-
it 'returns true' do
|
121
|
-
subject.referenced_from?(:a, :b).should be_true
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
context 'given an indirectly referenced rule name' do
|
126
|
-
it 'returns true' do
|
127
|
-
subject.referenced_from?(:a, :c).should be_true
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
context 'given a non-referenced rule name' do
|
132
|
-
it 'returns false' do
|
133
|
-
subject.referenced_from?(:a, :d).should be_false
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
context 'with recursive rules' do
|
139
|
-
|
140
|
-
let(:rule_set) { RuleSet[
|
141
|
-
Rule[:a, Apply[:a]],
|
142
|
-
Rule[:b, Apply[:c]],
|
143
|
-
Rule[:c, Apply[:b]]
|
144
|
-
] }
|
145
|
-
|
146
|
-
context 'given a directly recursive rule name and itself' do
|
147
|
-
it 'returns true' do
|
148
|
-
subject.referenced_from?(:a, :a).should be_true
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
context 'given an indirectly recursive rule name and itself' do
|
153
|
-
it 'returns true' do
|
154
|
-
subject.referenced_from?(:b, :b).should be_true
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
context 'given a referenced rule name' do
|
159
|
-
it 'returns true' do
|
160
|
-
subject.referenced_from?(:b, :c).should be_true
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
end
|
166
|
-
|
167
113
|
end
|
@@ -29,6 +29,12 @@ describe Apply do
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
describe '#capturing_decidable?' do
|
33
|
+
it 'is false' do
|
34
|
+
subject.should_not be_capturing_decidable
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
32
38
|
describe '#with_ws' do
|
33
39
|
it 'returns self' do
|
34
40
|
subject.with_ws(Match[/\s*/]).should == subject
|
@@ -24,8 +24,44 @@ describe Assert do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
describe '#capturing?' do
|
27
|
-
|
28
|
-
|
27
|
+
|
28
|
+
context 'with a capturing parser' do
|
29
|
+
|
30
|
+
let(:nested) { Match[/\w+/] }
|
31
|
+
|
32
|
+
it 'is false' do
|
33
|
+
subject.should_not be_capturing
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'with a non-capturing parser' do
|
38
|
+
|
39
|
+
let(:nested) { Skip[Match[/\w+/]] }
|
40
|
+
|
41
|
+
it 'is false' do
|
42
|
+
subject.should_not be_capturing
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '#capturing_decidable?' do
|
48
|
+
|
49
|
+
context 'with a decidably capturing parser' do
|
50
|
+
|
51
|
+
let(:nested) { Match[/\w+/] }
|
52
|
+
|
53
|
+
it 'is true' do
|
54
|
+
subject.should be_capturing_decidable
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'with a non capturing_decidable parser' do
|
59
|
+
|
60
|
+
let(:nested) { Apply[:foo] }
|
61
|
+
|
62
|
+
it 'is true' do
|
63
|
+
subject.should be_capturing_decidable
|
64
|
+
end
|
29
65
|
end
|
30
66
|
end
|
31
67
|
|
@@ -0,0 +1,204 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe AttributedSequence do
|
4
|
+
include CombinatorParserSpecHelper
|
5
|
+
|
6
|
+
include Rattler::Runtime
|
7
|
+
|
8
|
+
subject { AttributedSequence[*children] }
|
9
|
+
|
10
|
+
describe '#parse' do
|
11
|
+
|
12
|
+
context 'with a single capture and a semantic action' do
|
13
|
+
|
14
|
+
context 'when the action uses a parameter' do
|
15
|
+
|
16
|
+
let(:children) { [Match[/\w+/], SemanticAction['|s| "<#{s}>"']] }
|
17
|
+
|
18
|
+
it 'binds the capture to the parameter and returns the result' do
|
19
|
+
parsing('foo').should result_in '<foo>'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'when the action uses "_"' do
|
24
|
+
|
25
|
+
let(:children) { [Match[/\w+/], SemanticAction['"<#{_}>"']] }
|
26
|
+
|
27
|
+
it 'binds the capture to "_" and returns the result' do
|
28
|
+
parsing('foo').should result_in '<foo>'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'with a single capture and a node action' do
|
34
|
+
|
35
|
+
let(:children) { [Match[/\w+/], NodeAction[ParseNode.name]] }
|
36
|
+
|
37
|
+
it 'returns a new node with the capture' do
|
38
|
+
parsing('foo').should result_in ParseNode.parsed(['foo'])
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context 'with multiple captures and a semantic action' do
|
43
|
+
|
44
|
+
context 'when the action uses parameters' do
|
45
|
+
|
46
|
+
let :children do
|
47
|
+
[Match[/[a-z]+/], Match[/\d+/], SemanticAction['|a,b| b+a']]
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'binds the captures to the parameters and returns the result' do
|
51
|
+
parsing('abc123').should result_in '123abc'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'when the action uses "_"' do
|
56
|
+
|
57
|
+
let(:children) { [Match[/[a-z]+/], Match[/\d+/], SemanticAction['_']] }
|
58
|
+
|
59
|
+
it 'binds the array of captures to "_" and returns the result' do
|
60
|
+
parsing('abc123').should result_in ['abc', '123']
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'with multiple captures and a node action' do
|
66
|
+
|
67
|
+
let(:children) { [Match[/[a-z]+/], Match[/\d+/], NodeAction[ParseNode.name]] }
|
68
|
+
|
69
|
+
it 'returns a new node with the captures' do
|
70
|
+
parsing('abc123').should result_in ParseNode.parsed(['abc', '123'])
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'with a single labeled capture and a semantic action' do
|
75
|
+
|
76
|
+
let(:children) { [Label[:a, Match[/\w+/]], SemanticAction['"<#{a}>"']] }
|
77
|
+
|
78
|
+
it 'binds the capture to the label name and returns the result' do
|
79
|
+
parsing('foo').should result_in '<foo>'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
context 'with multiple labeled captures and a semantic action' do
|
84
|
+
|
85
|
+
let(:children) { [
|
86
|
+
Label[:a, Match[/[[:alpha:]]+/]],
|
87
|
+
Label[:b, Match[/[[:digit:]]+/]],
|
88
|
+
SemanticAction['b + a']
|
89
|
+
] }
|
90
|
+
|
91
|
+
it 'binds the captures to the label names and returns the result' do
|
92
|
+
parsing('abc123').should result_in '123abc'
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context 'with labeled captures and a node action' do
|
97
|
+
|
98
|
+
let(:children) { [
|
99
|
+
Label[:a, Match[/[[:alpha:]]+/]],
|
100
|
+
Label[:b, Match[/[[:digit:]]+/]],
|
101
|
+
NodeAction[ParseNode.name]
|
102
|
+
] }
|
103
|
+
|
104
|
+
it 'returns a new node with the captures and :labeled attribute' do
|
105
|
+
parsing('abc123').should result_in(
|
106
|
+
ParseNode.parsed(['abc', '123'], :labeled => {:a => 'abc', :b => '123'})
|
107
|
+
)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
describe '#capturing?' do
|
113
|
+
|
114
|
+
context 'when attributed with a semantic action' do
|
115
|
+
|
116
|
+
let(:children) { [Match[/\w+/], SemanticAction['_']] }
|
117
|
+
|
118
|
+
it 'is true' do
|
119
|
+
subject.should be_capturing
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
context 'when attributed with a semantic predicate' do
|
124
|
+
|
125
|
+
let(:children) { [Match[/\w+/], Assert[SemanticAction['_ == "hi"']]] }
|
126
|
+
|
127
|
+
it 'is false' do
|
128
|
+
subject.should_not be_capturing
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
context 'when attributed with a side effect' do
|
133
|
+
|
134
|
+
let(:children) { [Match[/\w+/], Skip[SemanticAction['@word = _']]] }
|
135
|
+
|
136
|
+
it 'is false' do
|
137
|
+
subject.should_not be_capturing
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
context 'when attributed with a node action' do
|
142
|
+
|
143
|
+
let(:children) { [Match[/\w+/], NodeAction[ParseNode]] }
|
144
|
+
|
145
|
+
it 'is true' do
|
146
|
+
subject.should be_capturing
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
describe '#with_ws' do
|
152
|
+
|
153
|
+
let(:ws) { Match[/\s*/] }
|
154
|
+
let(:children) { [Match[/\w+/], SemanticAction['_']] }
|
155
|
+
|
156
|
+
it 'applies #with_ws to the children parsers' do
|
157
|
+
subject.with_ws(ws).should ==
|
158
|
+
AttributedSequence[Sequence[Skip[ws], children[0]], children[1]]
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
describe '#capture_count' do
|
163
|
+
|
164
|
+
context 'with a single capture and a semantic action' do
|
165
|
+
|
166
|
+
let(:children) { [Match[/\w+/], SemanticAction['_']] }
|
167
|
+
|
168
|
+
it 'is 1' do
|
169
|
+
subject.capture_count.should == 1
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
context 'with two captures and a semantic predicate' do
|
174
|
+
|
175
|
+
let(:children) do
|
176
|
+
[Match[/\w+/], Skip[Match[/\s+/]], Match[/\w+/], SemanticAction['_']]
|
177
|
+
end
|
178
|
+
|
179
|
+
it 'is 2' do
|
180
|
+
subject.capture_count.should == 2
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
describe '#&' do
|
186
|
+
|
187
|
+
let(:children) { [Match[/\w+/], SemanticAction['_']] }
|
188
|
+
|
189
|
+
it 'returns a new sequence with the given parser' do
|
190
|
+
(subject & Match[/:/]).should == Sequence[subject, Match[/:/]]
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
describe '#>>' do
|
195
|
+
|
196
|
+
let(:children) { [Match[/\w+/], SemanticAction['_']] }
|
197
|
+
|
198
|
+
it 'returns a new attributed sequence with the given semantic action' do
|
199
|
+
(subject >> SemanticAction['_ * 2']).should ==
|
200
|
+
AttributedSequence[subject, SemanticAction['_ * 2']]
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
end
|