你可能已经猜到了,我需要一些帮助。我目前正在和朋友一起开发 WPF,但我们遇到了一个问题:我们需要解析某种类型的文本,但我们不知道该怎么做。我们找到了 Sprache,它似乎是一个很棒的解析器,但我们不知道如何使用它。另外:英语不是我们的母语,所以介绍文章对我们来说不是很容易理解。
所以我们决定在 Stackoverflow 上询问它。
我们要解析的文本位于一个简单的 .txt 文件中,如下所示:
focus_tree = {
id = german_focus
country = {
factor = 0
modifier = {
add = 10
tag = GER
}
}
default = no
focus = {
id = GER_autobahn
icon = GFX_goal_generic_construct_infrastructure
x = 0
y = 0
cost = 10
ai_will_do = {
factor = 12
}
completion_reward = {
custom_effect_tooltip = GER_autobahn_tt
hidden_effect = {
64 = {
if = {
limit = { is_controlled_by = ROOT }
add_building_construction = {
type = infrastructure
level = 10
instant_build = yes
}
}
}
59 = {
if = {
limit = { is_controlled_by = ROOT }
add_building_construction = {
type = infrastructure
level = 10
instant_build = yes
}
}
}
60 = {
if = {
limit = { is_controlled_by = ROOT }
add_building_construction = {
type = infrastructure
level = 10
instant_build = yes
}
}
}
54 = {
if = {
limit = { is_controlled_by = ROOT }
add_building_construction = {
type = infrastructure
level = 10
instant_build = yes
}
}
}
}
}
}
(它来自一个名为“钢铁之心IV”的游戏,只是整个事情的一小部分)
你们能给我们一点帮助或一点提示吗?
在此先感谢,