I wanted to make an option that doesn't include the timestamp and line number in the generated file, but I couldn't think of a name for it. Anyone have any suggestions?
Sam From: [email protected] [mailto:[email protected]] On Behalf Of Tom Ball Sent: Wednesday, May 20, 2009 2:07 PM To: [email protected] Subject: [antlr-interest] Unnecessary Java output file diffs Our distributed build system compares output files and only copies back the ones that have changed since the last build. We've noticed that our Antlr->Java step always gets copied, for two reasons. First, because a timestamp is in the output file's header -- is that necessary as a default? More useful might be a timestamp variable that can be put a .g file if desired, and expanded during generation. We think the second reason might be a bug, as here is some example output from a common, unchanged source file: @@ -2531,7 +2531,7 @@ int index13_13 = input.index(); input.rewind(); s = -1; - if ( (((input.LT(1).getText() .equals("gte"))||(input.LT(1).getText().equals("lte"))||(input.LT(1).get Text().equals("gt"))||(input.LT(1).getText().equals("lt"))||(input.LT(1) .getText().equals("eq"))||(input.LT(1).getText().equals("ne")))) ) {s = 2;} + if ( (((input.LT(1).getText().equals("gte"))||(input.LT(1).getText().equals(" lte"))||(input.LT(1).getText().equals("lt"))||(input.LT(1).getText().equ als("gt"))||(input.LT(1).getText().equals("eq"))||(input.LT(1).getText() .equals("ne")))) ) {s = 2;} else if ( (true) ) {s = 8;} Shouldn't the order of the token comparisons be the same for every generation? I guess it doesn't matter in this example since the string can only have one match, but my hunch is that with other rules comparison order matters. Here is the rule which generated the above: comparator returns [Operation value] : ((eqToken | '=') { $value = Operation.EQ; }) | ((neToken | '!=') { $value = Operation.NEQ; }) | ((gtToken | '>') { $value = Operation.GT; }) | ((gteToken | '>=') { $value = Operation.GTE; }) | ((ltToken | '<') { $value = Operation.LT; }) | ((lteToken | '<=') { $value = Operation.LTE; }) ; // Pseudo-tokens eqToken : {input.LT(1).getText().equals("eq")}? NCNAME ; neToken : {input.LT(1).getText().equals("ne")}? NCNAME ; ltToken : {input.LT(1).getText().equals("lt")}? NCNAME ; lteToken : {input.LT(1).getText().equals("lte")}? NCNAME ; gtToken : {input.LT(1).getText().equals("gt")}? NCNAME ; gteToken : {input.LT(1).getText().equals("gte")}? NCNAME ; NCNAME : (LETTER | '_') (LETTER | NONLETTER | '.' | '-' | '_')* ; Tom --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
