Details
-
Type:
Improvement
-
Status:
Reopened
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:1.1 SNAPSHOT
-
Testcase included:yes
-
Number of attachments :
Description
public class TestPreonTestCases extends TestCase {
// Minus signs are not well interpreted. Workaround - compound expression i.e. -1 = 0-1
public void testLimboMinusSign()
// Underscores are not well interpreted in @If. No DecodingException is thrown and the expression is evaluated to false;
public void testLimboUnderscore() throws DecodingException {
Codec<Test2> codec = Codecs.create(Test2.class);
Test2 instance = Codecs.decode(codec, new byte[]
);
assert instance.next == 'A';
assert instance.description != null;
}
private static class Test1
{ @BoundNumber(match = "-1") private short magic; }public static class Test2
{ @Bound private byte LONG_DESCRIPTION; @If(value = "LONG_DESCRIPTION == 1") @BoundString private String description; @Bound private byte next; }}
Good catch. The problem is located in Limbo, the expression parser. That one, quite frankly, isn't the best code in the world. (I'm starting to dislike ANTLR more every day.) I will try to see what I can do to fix is and release a new version. One of the things I want to do is bring Limbo back under the Preon project, since it really is the only project using it. That will make it a little easier to get an integrated version.