Ejemplo n.º 1
0
    pattern_list = [
        '0/a/',
        '1/b/',
        '2/[ab]cd/',
    ]
elif "14" in sys.argv:
    #    ┌────┐  a   ┌───┐  c   ┌───┐  d   ┌───┐
    #    │ 0  │ ───▶ │ 1 │ ───▶ │ 2 │ ───▶ │ 3 │
    #    └────┘      └───┘      └───┘      └───┘
    #      │                      ▲
    #      │ b                    │
    #      ▼                      │
    #    ┌────┐  c                │
    #    │ 4  │ ──────────────────┘
    #    └────┘
    #____________________________________________________________________
    pattern_list = [
        '0/a/',
        '1/b/',
        '2/[ab]/',
        '[ab]cd',
    ]
else:
    assert False

sm = help.prepare(pattern_list)

# For DEBUG purposes: specify 'DRAW' on command line
help.if_DRAW_in_sys_argv(sm)
help.test(sm, PrintPRM_F=True)
Ejemplo n.º 2
0
        '0/c/a+z',
        '1/c/a+z',

        '2/c|cb/a+z',
        '3/c|cb/a+z',

        'a/c|cba/a+z',
        'b/c|cba/a+z',

        'a/c|cbaz/a+z',
        'b/c|cbaz/a+z',
    ]
else:
    assert False

sm = help.prepare(pattern_list)

print "State Machine _____________________________________"
print sm.get_string(OriginalStatesF=False)

# For DEBUG purposes: specify 'DRAW' on command line (in sys.argv)
help.if_DRAW_in_sys_argv(sm)

analyzer = core.Analyzer.from_StateMachine(sm, engine.FORWARD)

print "Positioning Info __________________________________"
position_register_map.print_this(analyzer)

for post_context_id, array_index in sorted(analyzer.position_register_map.iteritems()):
    print "   %s: %i" % (repr(post_context_id), array_index)
Ejemplo n.º 3
0
#! /usr/bin/env python
# -*- coding: utf8 -*-
import os
import sys
sys.path.insert(0, "./")
from track_analysis_single_pattern import choice_str, pattern_db, choice
import quex.engine.state_machine.cut.stem_and_branches as stem_and_branches
import help

if "--hwut-info" in sys.argv:
    print "Paths Analysis: Single Pattern;"
    print choice_str
    sys.exit()

stem_and_branches._unit_test_deactivate_branch_pruning_f = True

sm = help.prepare(pattern_db[choice])

# For DEBUG purposes: specify 'DRAW' on command line
help.if_DRAW_in_sys_argv(sm)
help.test(sm)
#! /usr/bin/env python
# -*- coding: utf8 -*-
import os
import sys
sys.path.insert(0, "./")
from   track_analysis_single_pattern                          import choice_str, pattern_db, choice
import quex.engine.state_machine.algorithm.acceptance_pruning as     acceptance_pruning
import help

if "--hwut-info" in sys.argv:
    print "Paths Analysis: Single Pattern;"
    print choice_str
    sys.exit()

acceptance_pruning._deactivated_for_unit_test_f = True

sm = help.prepare(pattern_db[choice])

# For DEBUG purposes: specify 'DRAW' on command line
help.if_DRAW_in_sys_argv(sm)
help.test(sm)

Ejemplo n.º 5
0
import quex.input.regular_expression.engine as regex
import quex.engine.state_machine.algorithm.acceptance_pruning as acceptance_pruning
import quex.engine.analyzer.engine_supply_factory as engine
from quex.blackboard import E_InputActions
import help

if "--hwut-info" in sys.argv:
    print "Track Analyzis: Backwards - For Pre-Context;"
    print "CHOICES: 0, 1;"
    sys.exit()

if "0" in sys.argv:
    pattern_list = [
        'x/a/',
        'y/a/',
    ]
elif "1" in sys.argv:
    pattern_list = [
        'x+/a/',
        'yx+/a/',
    ]
else:
    assert False

sm = help.prepare(pattern_list, GetPreContextSM_F=True)

# For DEBUG purposes: specify 'DRAW' on command line
help.if_DRAW_in_sys_argv(sm)
help.test(sm, EngineType=engine.BACKWARD_PRE_CONTEXT)
Ejemplo n.º 6
0
import quex.input.regular_expression.engine  as regex
import quex.engine.state_machine.algorithm.acceptance_pruning as     acceptance_pruning
import quex.engine.analyzer.engine_supply_factory as     engine
from   quex.blackboard                            import E_InputActions
import help

if "--hwut-info" in sys.argv:
    print "Track Analyzis: Backwards - For Pre-Context;"
    print "CHOICES: 0, 1;"
    sys.exit()

if "0" in sys.argv:
    pattern_list = [
        'x/a/',        
        'y/a/',     
    ]
elif "1" in sys.argv:
    pattern_list = [
        'x+/a/',        
        'yx+/a/',     
    ]
else:
    assert False

sm = help.prepare(pattern_list, GetPreContextSM_F=True)

# For DEBUG purposes: specify 'DRAW' on command line
help.if_DRAW_in_sys_argv(sm)
help.test(sm, EngineType=engine.BACKWARD_PRE_CONTEXT)