gpt4 book ai didi

parsing - 解析文件的工具

转载 作者:行者123 更新时间:2023-12-02 05:56:09 26 4
gpt4 key购买 nike

我正在尝试找出解析 GE Logician MEL 跟踪文件以使其更易于阅读的最佳方法。

它有像

这样的片段
>{!gDYNAMIC_3205_1215032915_810 = (clYN)}execute>GDYNAMIC_3205_1215032915_810 = "Yes, No"results>"Yes, No" execute>end results>"Yes, No" >{!gDYNAMIC_3205_1215032893_294 = (clYN)}execute>GDYNAMIC_3205_1215032893_294 = "Yes, No"results>"Yes, No" execute>end results>"Yes, No" 

>{IF (STR(F3205_1220646638_285, F3205_1220646638_301) == "") THEN "" ELSE (\par\tab fnHeadingFormat("Depression") + CFMT(F3205_1220646638_285, "", "Have you often been bothered by feeling down, depressed or hopeless? ", "B", "\par ") + CFMT(F3205_1220646638_301, "", "Have you often been bothered by little interest or pleasure in doing things? ", "B", "\par ") ) ENDIF}execute>call STR("No", "No")results>"NoNo" execute>"NoNo" == ""results>FALSE execute>if FALSEresults>FALSE execute>call FNHEADINGFORMAT("Depression")execute>call CFMT("Depression", "B,2")results>"\fs24\b Depression\b0\fs20 " execute>"\r\n" + "\fs24\b Depression\b0\fs20 "results>"\r\n\fs24\b Depression\b0\fs20 " execute>"\r\n\fs24\b Depression\b0\fs20 " + "\r\n"results>"\r\n\fs24\b Depression\b0\fs20 \r\n" results>return "\r\n\fs24\b Depression\b0\fs20 \r\n" execute>call CFMT("No", "", "Have you often been bothered by feeling down, depressed or hopeless? ", "B", "\par ")results>"\b Have you often been bothered by feeling down, depressed or hopeless? \b0 No\par " execute>"\r\n\fs24\b Depression\b0\fs20 \r\n" + "\b Have you often been bothered by feeling down, depressed or hopeless? \b0 No\par "results>"\r\n\fs24\b Depression\b0\fs20 \r\n\b Have you often been bothered by feeling down, depressed or hopeless? \b0 No\par " execute>call CFMT("No", "", "Have you often been bothered by little interest or pleasure in doing things? ", "B", "\par ")results>"\b Have you often been bothered by little interest or pleasure in doing things? \b0 No\par " execute>"\r\n\fs24\b Depression\b0\fs20 \r\n\b Have you often been bothered by feeling down, depressed or hopeless? \b0 No\par " + "\b Have you often been bothered by little interest or pleasure in doing things? \b0 No\par "results>"\r\n\fs24\b Depression\b0\fs20 \r\n\b Have you often been bothered by feeling down, depressed or hopeless? \b0 No\par \b Have you often been bothered by little interest or pleasure in doing things? \b0 No\par " 

我可以通过程序来完成它,但在我使用过所有正则表达式之后,我发现很难相信没有任何东西可以让我以类似的方式定义解析文件的规则。我错了吗?

最佳答案

使用 ANTLR 编写语法。如果您使用的是 C,那么 lex/yacc 是原生的。 ANTLR 在 Java、Python 和 .NET 中创建本地解析器。你的输出看起来像一个 repl;尝试向供应商询问有关输入语言的规范。

关于parsing - 解析文件的工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74928/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com