Skip to content

Commit d3991d6

Browse files
claude[bot]claude
andcommitted
Remove old pattern implementation and consolidate to new bytecode VM system
- Remove src/stdlib/legacy_pattern.rs (old regex-based pattern system) - Clean up src/stdlib/pattern.rs removing ~1000 lines of old IR parsing code - Keep only new native functions that integrate with bytecode VM pattern system - Update src/stdlib/pattern_test.rs with basic validation tests - Add missing native_pattern_replace/split functions required by interpreter - Remove legacy pattern registrations from stdlib module - Fix TestPrograms/pattern_stdlib_test.wfl syntax for WFL function calls This eliminates API confusion between old and new pattern systems as requested, reducing codebase by ~2000 lines while preserving all functionality through the new advanced natural language pattern matching system. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3ec1d2a commit d3991d6

6 files changed

Lines changed: 132 additions & 2205 deletions

File tree

TestPrograms/pattern_stdlib_test.wfl

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,35 @@ end pattern
1313
store test_text as "Hello 123 world 456"
1414

1515
// Test pattern_matches function
16-
store word_matches as pattern_matches(test_text, word_pattern)
16+
store word_matches as call pattern_matches with test_text and word_pattern
1717
display "Word pattern matches: " with word_matches
1818

19-
store number_matches as pattern_matches("999", number_pattern)
19+
store number_matches as call pattern_matches with "999" and number_pattern
2020
display "Number pattern matches '999': " with number_matches
2121

2222
// Test pattern_find function
23-
store first_match as pattern_find(test_text, word_pattern)
23+
store first_match as call pattern_find with test_text and word_pattern
2424
check if first_match is not nothing:
25-
display "First word found: " with first_match.matched_text
26-
display "Position: " with first_match.start with " to " with first_match.end
25+
store matched_text as property matched_text of first_match
26+
store start_pos as property start of first_match
27+
store end_pos as property end of first_match
28+
display "First word found: " with matched_text
29+
display "Position: " with start_pos with " to " with end_pos
2730
otherwise:
2831
display "No word found"
2932
end check
3033

31-
// Test pattern_find_all function
32-
store all_matches as pattern_find_all(test_text, word_pattern)
34+
// Test pattern_find_all function
35+
store all_matches as call pattern_find_all with test_text and word_pattern
3336
display "Found " with length of all_matches with " word matches:"
3437

35-
count i from 0 to length of all_matches minus 1:
38+
store i as 0
39+
count from 0 to length of all_matches minus 1:
3640
store match_result as all_matches at i
37-
display " Match " with i with ": '" with match_result.matched_text with "' at position " with match_result.start
41+
store matched_text as property matched_text of match_result
42+
store start_pos as property start of match_result
43+
display " Match " with i with ": '" with matched_text with "' at position " with start_pos
44+
store i as i plus 1
3845
end count
3946

4047
display "Standard library pattern tests completed!"

0 commit comments

Comments
 (0)