This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Gstring in source breaks token recognition | ||
---|---|---|---|
Product: | groovy | Reporter: | schmidtm <schmidtm> |
Component: | Code | Assignee: | schmidtm <schmidtm> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | ||
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: |
AccountController.groovy
EntriesController.groovy LoginController.groovy |
Description
schmidtm
2008-01-08 19:39:26 UTC
Created attachment 54831 [details]
AccountController.groovy
One additional information: It seems that only full syntax gstrings ( ${id} ) break the editor. Have a look, how this looks in the editor: // Groovy source file def name='World' println "Hello $name" println "Hello ${name}" assert true println """ Test 1 and yet another line """ println """ Test 2 and yet another line Now with Gstring simple = $name """ println """ Test 3 and yet another line And with Gstring full = ${name} """ println """ Test 4 and yet another line Now with Gstring simple = $name And with Gstring full = ${name} """ println "end of run." I've added a little testcase to demonstrate this bug a bit more: http://www.netbeans.org/source/browse/scripting/groovy/editor/test/unit/src/org/netbeans/modules/groovy/editor/GroovyLexerBatchTest.java?r1=1.7&r2=1.8 it gives: Testcase: testFullSyntaxGstring(org.netbeans.modules.groovy.editor.GroovyLexerBatchTest): FAILED Invalid token.id() for text="}" expected:<org.netbeans.modules.groovy.editor.lexer.GroovyTokenId:GSF_RBRACE:26> but was:<org.netbeans.modules.groovy.editor.lexer.GroovyTokenId:GSF_STRING_LITERAL:17> junit.framework.AssertionFailedError: Invalid token.id() for text="}" expected:<org.netbeans.modules.groovy.editor.lexer.GroovyTokenId:GSF_RBRACE:26> but was:<org.netbeans.modules.groovy.editor.lexer.GroovyTokenId:GSF_STRING_LITERAL:17> at org.netbeans.lib.lexer.test.LexerTestUtilities.assertTokenEquals(LexerTestUtilities.java:112) at org.netbeans.lib.lexer.test.LexerTestUtilities.assertTokenEquals(LexerTestUtilities.java:98) at org.netbeans.modules.groovy.editor.GroovyLexerBatchTest.testFullSyntaxGstring(GroovyLexerBatchTest.java:138) So the input line: String text = "def name = 'World'; println \"Hello, ${name}\""; causes the lexer to tread the closing brace to be a GSF_STRING_LITERAL rather than a GSF_RBRACE Fixed. http://www.netbeans.org/source/browse/scripting/groovy/editor/src/org/netbeans/modules/groovy/editor/lexer/GroovyLexer.java?r1=1.12&r2=1.13 http://www.netbeans.org/source/browse/scripting/groovy/editor/test/unit/src/org/netbeans/modules/groovy/editor/GroovyLexerBatchTest.java? r1=1.12&r2=1.13 Created attachment 55180 [details]
EntriesController.groovy
Created attachment 55181 [details]
LoginController.groovy
Hi, thank you Martin for the fix! It solved the most important problem, but we still have issues with string-constants. Therefore i reopen but lower the priority. Please take a look at these Attachments: EntriesController.groovy: Line 22 LoginController.groovy: Line 49-60 cheers, M. Hopefully fixed :-) http://www.netbeans.org/source/browse/scripting/groovy/editor/nbproject/project.xml?r1=1.10&r2=1.11 http://www.netbeans.org/source/browse/scripting/groovy/editor/src/org/netbeans/modules/groovy/editor/lexer/GroovyLexer.java?r1=1.14&r2=1.15 http://www.netbeans.org/source/browse/scripting/groovy/editor/test/unit/src/org/netbeans/modules/groovy/editor/GroovyLexerBatchTest.java? r1=1.13&r2=1.14 http://www.netbeans.org/source/browse/scripting/groovy/editor/test/unit/src/org/netbeans/modules/groovy/editor/GroovyLexerGStringTest.java? r1=1.3&r2=1.4 Thanks Martin for the last fix, which was a great relieve. But we still have issues in these attachments: EntriesController.groovy: Line 22 LoginController.groovy: Line 49-60 to narrow it down a bit i added an additional testcase for Gstrings in strings: http://www.netbeans.org/source/browse/scripting/groovy/editor/test/unit/src/org/netbeans/modules/groovy/editor/GroovyLexerStringConstants.java?rev=1.1&view=markup OK, now it is really fixed. If you will find another bug, I will buy you a beer :-) Seriously, I finally find how groovyc is doing this so I made major rewrite (=simplification). Now I really like it... :-) http://www.netbeans.org/source/browse/scripting/groovy/editor/test/unit/src/org/netbeans/modules/groovy/editor/GroovyLexerStringConstants.java? r1=1.1&r2=1.2 http://www.netbeans.org/source/browse/scripting/groovy/editor/test/unit/src/org/netbeans/modules/groovy/editor/GroovyLexerBatchTest.java? r1=1.14&r2=1.15 http://www.netbeans.org/source/browse/scripting/groovy/editor/src/org/netbeans/modules/groovy/editor/lexer/GroovyLexer.java?r1=1.16&r2=1.17 Integrated into 'main-golden', available in NB_Trunk_Production #206 build Changeset: http://hg.netbeans.org/main/rev/260a269563c6 User: Martin Adamek <martin_adamek@netbeans.org> Log: #124912: Gstring in source breaks token recognition |