From: SourceForge.net <no...@so...> - 2009-07-19 19:41:15
|
Bugs item #2806043, was opened at 2009-06-14 03:09 Message generated for change (Comment added) made by shlomy You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100588&aid=2806043&group_id=588 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Greg Knittl (gknittl) >Assigned to: Shlomy Reinstein (shlomy) Summary: Token.tokenToString .ArrayIndexOutOfBoundsException Initial Comment: jEdit 4.3pre16 org.gjt.sp.jedit.syntax.Token method tokenToString does not handle special case END It gives: java.lang.ArrayIndexOutOfBoundsException: 127 at org.gjt.sp.jedit.syntax.Token.tokenToString(Token.java:60) If I can figure out how to build jEdit and get some cycles will try to patch this. ---------------------------------------------------------------------- >Comment By: Shlomy Reinstein (shlomy) Date: 2009-07-19 22:41 Message: Fixed in SVN rev. 15712. I was convinced to add this since the opposite method - stringToToken - does work on the END token. ---------------------------------------------------------------------- Comment By: Shlomy Reinstein (shlomy) Date: 2009-06-17 07:32 Message: Token types are used internally for the syntax highlighting. The tokenToString method was created to those token types whose representation in the text area are customizable - using Global Options -> Text Area. Token.END is a valid token type, but one that is not customizable. Hence there was no reason to include a string for it. ---------------------------------------------------------------------- Comment By: Greg Knittl (gknittl) Date: 2009-06-17 04:25 Message: On any file type that I have tried so far, Token.END corresponds to the newline character at the end of each line. Token.END is not an abstract end to a TokenHandler linked list but a syntax token for a character in the buffer that is as real as any other character. So Token.END should be on the same footing as any other token. ---------------------------------------------------------------------- Comment By: Kazutoshi Satoda (k_satoda) Date: 2009-06-17 01:46 Message: Looking in the source code of class Token, Token.END is excluded from the explicit fold for "Token types". This seems to indicate that Token.END is not a token type. But the explicit fold is not shown in Javadoc. On the other hand, searching for Token.END shows that TokenMarker#markTokens() is passing Token.END as the argument "id" of TokenHandler#handleToken(), which is declared as "The token type (one of the constants in the {@link Token} class)". This seems to be a bug in documentation; it is not clear in Javadoc whether Token.END is a member of "token type" or not. ---------------------------------------------------------------------- Comment By: Shlomy Reinstein (shlomy) Date: 2009-06-17 00:18 Message: A patch would not be helpful - fixing this is a matter of seconds in terms of implementation. But I don't think it should be done. If you reach this level of integration with the jEdit core in BeanShell scripting, then you should also know to stop at Token.END and not try to print it. I vote for closing this item with no changes to the core. ---------------------------------------------------------------------- Comment By: Greg Knittl (gknittl) Date: 2009-06-14 10:25 Message: I hit the problem when writing a bsh to output syntax information at the caret location including the token type name. The bsh blew up with the caret at end of file. This is part of my effort to use syntax information in the XML plugin to reduce invalid attribute completion popups. It might also be helpful to anyone writing an edit mode and wanting to check the parsing. It's pretty obscure, but since I found it, I thought I'd take a moment to report it. I should be able to provide a patch eventually if that would be helpful. ---------------------------------------------------------------------- Comment By: Shlomy Reinstein (shlomy) Date: 2009-06-14 09:58 Message: I can fix that, but in general, jEdit wasn't made to be "bullet-proof" for arbitrary BeanShell expressions. It was meant to be a user-friendly text editor. BeanShell support is there to simplify customization and scripting, but don't expect arbitrary BeanShell commands that are not created by the macro recorder to work and not throw exceptions. jEdit is not an API, it's a tool. If you can reproduce this problem using an ordinary usage scenario, let me know. ---------------------------------------------------------------------- Comment By: Greg Knittl (gknittl) Date: 2009-06-14 09:52 Message: evaluate the following beanshell expression: Token.tokenToString(Token.END) ---------------------------------------------------------------------- Comment By: Shlomy Reinstein (shlomy) Date: 2009-06-14 08:40 Message: Can you specify the steps to reproduce this? jEdit has 19 predefined token types. The array accessed by the method specifies the string representation of each of these type. How do you get it called for a token type 127? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100588&aid=2806043&group_id=588 |