我正利用ant子来制作我的教官,但我想推翻一些错误的报告。 此时,如果我给出一些不正确的辛迪克斯,例如,一名失踪的表象,那么ant子就错了“线1:11 失踪的人”。
然而,我无法找到这一错误产生的方法。 我原先认为,这并不是报告方法。 是否有任何人知道信息产生在哪里?
感谢!
我正利用ant子来制作我的教官,但我想推翻一些错误的报告。 此时,如果我给出一些不正确的辛迪克斯,例如,一名失踪的表象,那么ant子就错了“线1:11 失踪的人”。
然而,我无法找到这一错误产生的方法。 我原先认为,这并不是报告方法。 是否有任何人知道信息产生在哪里?
感谢!
www.un.org/spanish/ga/president 请允许我说,你希望用以下图表来划分任务:
grammar T;
parse : assignment EOF;
assignment : Id = Number ; ;
Number : 0 .. 9 + ( . 0 .. 9 +)?;
Id : ( a .. z | A .. Z )+;
Space : {skip();};
现在简单地凌驾于<代码>reportError(......)方法之上,例如:
grammar T;
@parser::members {
@Override
public void reportError(RecognitionException e) {
System.out.println("CUSTOM ERROR...
" + e);
}
}
parse : assignment EOF;
assignment : Id = Number ; ;
Number : 0 .. 9 + ( . 0 .. 9 +)?;
Id : ( a .. z | A .. Z )+;
Space : {skip();};
接着试图 par,例如=123;>
(缺失<代码>Id):
java -cp antlr-3.3.jar org.antlr.Tool T.g
javac -cp antlr-3.3.jar *.java
java -cp .:antlr-3.3.jar Main "= 123;"
CUSTOM ERROR...
MissingTokenException(inserted [@-1,0:0= <missing Id> ,<4>,1:0] at =)
As you can see, the custom error message is being printed to the console.
象“别无选择......”这样的警告,在法尔,而不是教区,是一个问题。 当弹性体会到你没有在克法中说明的特性时(或至少是作为适当标语)。
请指出输入<代码>a = 123: (注:
at the end und a ;
。 由于我没有为“<代码>下的任何标注作出定义,因此现在法尔将产生“无法替代......”的警告。
对这种错误作出说明的一个容易的解决办法是,在你的法尔法末尾添加“全副渔获”规则,使之与任何与其相匹配的法理规则相一致。 无论这种“副渔获物-all”规则是否一致,你在<条码>后...}条码>中仅举一个例外(或做其他事情,当然!) 。
页: 1
grammar T;
@parser::members {
@Override
public void reportError(RecognitionException e) {
System.out.println("CUSTOM ERROR...
" + e);
}
}
parse : assignment EOF;
assignment : Id = Number ; ;
Number : 0 .. 9 + ( . 0 .. 9 +)?;
Id : ( a .. z | A .. Z )+;
Space : {skip();};
FallThrough
@after{
throw new RuntimeException(String.format(
"Encountered an illegal char on line \%d, column \%d: \%s ",
getLine(), getCharPositionInLine(), getText()
)
);
}
: . // match any char not matched by Number, Id or Space
;
如果您现在宣布<代码>a = 123:,你将看到以下内容:
Exception in thread "main" java.lang.RuntimeException:
Encountered an illegal char on line 1, column 8: :
...
I m attempting to write a bash script to parse out the following log file and give me a list of CURRENT players in the room (so ignoring players that left, but including players that may have rejoined)...
I would like to know the size of the movie I am watching on any video site [ if not possible on all video sites, then at least on YouTube ]. So is it possible, say I will specify the complete path ...
Is it possible to get the property of a class from string and then set a value? Example: string s = "label1.text"; string value = "new value"; label1.text = value; <--and some code that makes ...
I need to parse a xml string to obtain the xml DOM, the problem I m facing is with the self closing html tag like <br /> giving me the error of Tag mismatch expected </br>. I m aware this ...
The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...
I can easily do this with JQuery or PHP but I have a project for my Intro to C++ class and I thought it ll be pretty cool if I could mix C++ with some APIs like twitter, google, yahoo etc. Could you ...
I have never dealt with regular expressions before, and I am facing a problem here. The user has to input a text like Var1(0,enum1,enum2), and I have to check the syntax on the following manner:- 1- ...
I built a site a long time ago and now I want to place the data into a database without copying and pasting the 400+ pages that it has grown to so that I can make the site database driven. My site ...