在超级大国C#中找到某个令牌模式之前,如何忽略令牌?
我试图解析散布着函数的对象,我想跳过函数 结构如下:在超级大国C#中找到某个令牌模式之前,如何忽略令牌?,c#,parsing,superpower,C#,Parsing,Superpower,我试图解析散布着函数的对象,我想跳过函数 结构如下: /datum/chemical_reaction/reagent_explosion name = "Generic explosive" id = "reagent_explosion" var/strengthdiv = 10 var/modifier = 0 /datum/chemical_reaction/reagent_explosion/on_reaction(datum/reagents/hol
/datum/chemical_reaction/reagent_explosion
name = "Generic explosive"
id = "reagent_explosion"
var/strengthdiv = 10
var/modifier = 0
/datum/chemical_reaction/reagent_explosion/on_reaction(datum/reagents/holder, created_volume)
var/power = modifier + round(created_volume/strengthdiv, 1)
if(power > 0)
var/turf/T = get_turf(holder.my_atom)
var/inside_msg
if(ismob(holder.my_atom))
// More code ...
/datum/chemical_reaction/reagent_explosion/nitroglycerin
name = "Nitroglycerin"
id = /datum/reagent/nitroglycerin
results = list(/datum/reagent/nitroglycerin = 2)
required_reagents = list(/datum/reagent/glycerol = 1, /datum/reagent/toxin/acid/nitracid = 1, /datum/reagent/toxin/acid = 1)
strengthdiv = 2
/datum/chemical_reaction/reagent_explosion/nitroglycerin/on_reaction(datum/reagents/holder, created_volume)
if(holder.has_reagent(/datum/reagent/stabilizing_agent))
return
holder.remove_reagent(/datum/reagent/nitroglycerin, created_volume*2)
..()
路径后的用户可以识别函数。
由于解析代码很困难,我只想跳过开括号后的标记,直到找到紧跟ReferencePath的EOL标记。
我试图解析函数,但这太难了,没有真正的回报,所以我现在就在这里:
公共静态只读令牌列表解析器参数定义=
from_uu-in-Token.EqualTo(DMToken.OpenParen)
来自Identifier.ManyDelimitedBy(Token.EqualTo(DMToken.逗号))中的值
来自Token.EqualTo(DMToken.CloseParen)中的
选择值;
公共静态只读TokenListParser函数=
从引用路径中的路径
参数定义中的from u
从令牌.EqualTo(DMToken.Eol)中的
来自伦敦的uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
来自Token.EqualTo(DMToken.ReturnKeyword)中的
选择空作为对象;
公共静态只读TokenListParser对象=
从引用路径中的路径
从uu-in-Token.EqualTo(DMToken.Eol)
从loneasignment.Many()中的值中选择(a=>{
//KeyValuePair到动态映射代码
})
选择值;
公共静态只读TokenListParser对象列表=
(从Object/.Try()或(Function.Select(x=>(dynamic)x)中的obj)
从u-in-Token.EqualTo(DMToken.Eol.Many())
选择obj).Many();
源代码,但不是最新版本:
我试图解析的代码:您是否尝试过
IgnoreThan
/IgnoreMany
combinator?您是否尝试过IgnoreThan
/IgnoreMany
combinator?