Skip to content

Commit

Permalink
Merge pull request #205 from theludovyc/fix#203_sg_custom_regex
Browse files Browse the repository at this point in the history
Fix #203 rename unhandled_regex to custom_regex
  • Loading branch information
Jeremi360 authored Mar 13, 2023
2 parents 5ce66f4 + a85034d commit aeb9c21
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
20 changes: 20 additions & 0 deletions Test/TestExecuter/TestCustomRegex/TestCustomRegex.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
extends "res://Test/RakugoTest.gd"

const file_path = "res://Test/TestExecuter/TestCustomRegex/TestCustomRegex.rk"

var file_base_name = get_file_base_name(file_path)

func test_custom_regex():
Rakugo.add_custom_regex("HW", "^hello_world$")

watch_rakugo_signals()

await wait_parse_and_execute_script(file_path)

await wait_for_signal(Rakugo.sg_custom_regex, 0.2)

var params = get_signal_parameters(Rakugo, Rakugo.sg_custom_regex.get_name())

assert_eq(params[0], "HW")

await wait_execute_script_finished(file_base_name)
6 changes: 6 additions & 0 deletions Test/TestExecuter/TestCustomRegex/TestCustomRegex.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://ds2f3ywueejdo"]

[ext_resource type="Script" path="res://Test/TestExecuter/TestCustomRegex/TestCustomRegex.gd" id="1_u0hr0"]

[node name="TestCustomRegex" type="Node"]
script = ExtResource("1_u0hr0")
20 changes: 0 additions & 20 deletions Test/TestExecuter/TestUnhandledRegex/TestUnhandledRegex.gd

This file was deleted.

6 changes: 0 additions & 6 deletions Test/TestExecuter/TestUnhandledRegex/TestUnhandledRegex.tscn

This file was deleted.

4 changes: 2 additions & 2 deletions addons/Rakugo/Rakugo.gd
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ signal sg_say(character, text)
signal sg_notify(text)
signal sg_ask(character, question, default_answer)
signal sg_menu(choices)
signal sg_parser_unhandled_regex(key, result)
signal sg_custom_regex(key, result)
signal sg_execute_script_start(file_name)
signal sg_execute_script_finished(file_name, error_str)
signal sg_variable_changed(var_name, value)
Expand Down Expand Up @@ -220,7 +220,7 @@ func _exit_tree() -> void:


# Todo Handle Error
func parser_add_regex_at_runtime(key: String, regex: String):
func add_custom_regex(key: String, regex: String):
parser.add_regex_at_runtime(key, regex)


Expand Down
2 changes: 1 addition & 1 deletion addons/Rakugo/lib/systems/Executer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func do_execute_script(parameters:Dictionary):

Rakugo.set_variable(result.get_string("lvar_name"), value)
_:
Rakugo.sg_parser_unhandled_regex.emit(line[0], result)
Rakugo.sg_custom_regex.emit(line[0], result)

index += 1

Expand Down

0 comments on commit aeb9c21

Please sign in to comment.