问题标签 [irony]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c# - Irony 解析器中的表达式优先级
考虑我的 vbscript 语法的这一部分
这个 vbscript 程序:
它将 this 解析为if (2=1)+1 then x = 5
而不是if 2=(1+1) then x = 5
. 我BINARY_EXPR
之前已经指定,COMPARE_EXPR
并且“+”具有更高的运算符优先级,所以我不知道如何告诉它应该首先寻找加法运算。我还能如何表达这一点,以便 Irony 以我想要的方式解析它?
c# - How do I work with the AST in Irony now?
I have a grammar that works and parses in the Irony console just fine, but I don't get anything in the AST treeview. I was following along with the BASIC->Javascript article found here: http://www.codeproject.com/Articles/25069/JSBasic-A-BASIC-to-JavaScript-Compiler, but it seems that the Ast stuff has all been moved/removed. I found the Irony.Interpreter .dll, which has some Ast stuff in it, but it seems all tied up in the Expression sample implementation.
What am I missing here? I want to walk my tree and generate source code, and I'm not sure where to start.
I've seen some mention of using the visitor pattern, which I'm fine with, but I don't know how to implement it and run it in a way that Irony likes.
c# - 用 Irony 解析 SQL 语句
我正在尝试创建一个将常规 sql 语句转换为 c# 对象的方法,因此我决定使用 Irony 来解析 sql 语句,然后我将语句作为包含语句类型及其值的操作返回,具体取决于类型
这是我未完成的代码[因为我很沮丧,因为我不知道该怎么做]
所以这里的问题是:我如何利用 Irony 将字符串 SQL 语句转换为 ac# 对象?
这是我想要实现的一个例子:
插入人的价值观(4,'Nilsen','Johan','Bakken 2','Stavanger')
并将其转换为
动态地取决于方法从语句中读取的内容。
我希望我已经很好地解释了我的想法,所以你们可以帮助我,如果有不清楚的地方请告诉我,我会尽力解释。
c# - 反讽语法规范错误
我是 Irony 的新手(大约 10 年前我在大学学习 BNF),并且开始创建一个准实坐标解析器。
下面是我认为应该能够解析输入 的语法类(完整代码位于https://github.com/spadger/notam-visualiser )
但是,当我在语法资源管理器中运行它时,在 1:4 "expected: space" 处出现语法错误
你能看出我的代码有什么问题吗?
谢谢,
乔恩
c# - Irony 中的简单语法无法按预期工作
我一直在尝试使用 Irony 来解析一些 XML 代码。我将语法定义如下:
现在,当我尝试解析这样的东西时:
<a condition ='i'><a condition ='i'></a><b a='i'></b></a>
它工作正常(如预期的那样)。
但是,当我尝试这样的事情时:
<a condition ='i'><a condition ='i'></a></a>
它不起作用,它告诉我它期望<b a='i'>
在第一个</a>
.
如果我错了,请纠正我,但这不应该也是可解析的吗?最后一条规则的第一个产生式明确表示不必有<b a='i'>
after </a>
。我怀疑在解析器在第一个之后遇到另一个“<”之后,</a>
它会尝试应用最后一条规则 ifTagClose + elseIfTagBlock 的第二个产生,因此期望<b a='i'>
. 我很确定问题出在开头的“<”上,因为当我从所有终端的开头删除它时,它会按预期工作。
除了自定义解析操作之外,是否有任何解决方法?或者任何其他 c# 解析引擎知道如何处理这个问题?
parsing - 关于这个 Shift/Reduce 错误,Irony 告诉我什么?
我正在使用此处描述的语法为 PowerShell 语言编写解析器:http: //www.microsoft.com/en-us/download/details.aspx?id=9706。
我使用了 Irony,Irony Grammar Explorer 报告了一些 shift/reduce 和 reduce/reduce 错误。这把我难住了,因为我不确定它在告诉我什么。
如果你想看看自己,代码在这里:https ://github.com/Pash-Project/Pash/tree/method-invocation/Source/Pash.System.Management
编辑:我认为这让人困惑的输入是:
这是添加还是铸造?
c# - Irony 中的空白终止符和 MakePlusRule
我正在尝试使用Irony创建一个相当简单的解析器,但我得出的结论是 Irony 可能不适合这种特殊情况。
这些是我要解析的示例:
我正在使用带有空格或分号的 FreeTextLiterals 作为终止符
然后我使用 MakePlusRule 来获取一个或多个 server_name 值:
但是 - 我认为在这种情况下将空格作为 FreeTextLiteral 的终止符存在问题。当我运行它时,我得到一个解析器错误。如果我将空格替换为另一个特定字符以充当终止符(并在对 MakePlusRule 的调用中添加此分隔符) - 它可以正常工作。
有人对我如何在 Irony 中处理这个问题有任何想法吗?
c# - Code colorizer error
I am trying to write a grammar to parse a statement like
My grammar is as shown below
It works fine when I am trying to parse
The error coming is Fatal Error in code colorizer. Colorizing had been disabled.
Even if I comment out
the error still persists. The detailed error is
Can someone help me to resolve the error? I am using Irony_2013_03_10 version.
c# - 如何在 Irony.NET 中允许重复
我正在尝试创建一个非常非常基本的命令行解析器。
例如,我可以有这个命令:
我试图用这样的基本语法类来实现它:
这允许整个命令使用单个参数,但我不知道如何支持无限参数。
我怎样才能做到这一点?
先感谢您!
c# - 如何用 Irony 处理缩进敏感的语言?
我试图用只有两个结构(hello
语句和fun
块定义)来解析一种非常幼稚的缩进敏感语言。
为了做到这一点,我用 Irony 编写了以下语法:
然而,解析样本失败并出现错误(4,3) Syntax error, expected: INDENT
谁能指出我做错了什么?