fesch / Structorizer.Desktop

Structorizer is a little tool which you can use to create Nassi-Schneiderman Diagrams (NSD).
https://structorizer.fisch.lu
GNU General Public License v3.0
65 stars 20 forks source link

Java import may fail if a source code string literal ends with a properly escaped backslash. #1132

Closed codemanyak closed 8 months ago

codemanyak commented 8 months ago

If the Java source code contains a string literal ending with a properly escaped backslash, the Java parser is prone to fail with a (false) syntax error. It wrongly associates the second backslash with the ending quote, thus preventing the detection of the string literal end:

error.syntax in file "D:\SW-Produkte\Structorizer\tests\Issue1131_Java_import\Structorizer_mod.java"

Preceding source context:
 1662:           String problems = "";
 1663:           File configDir = configFile.getParentFile();
 1664:           File homeDir = new File(System.getProperty("user.home"));
 1665:           StringList pathParts = new StringList();
 1666:           while (configDir != null && homeDir != null) {
 1667:               if (homeDir.equals(configDir)) {
 1668:                   pathParts.add("%h");
 1669:                   homeDir = null;
 1670:               }
 1671:               else if (configDir.getName().isEmpty()) {
 1672:                   pathParts.add(configDir.toString().replace(":\\", "» :"));

Found token ':'

Expected: ')' | ','
codemanyak commented 8 months ago

The StringLiteral definition in the grammar is fixed now (to be delivered with version 3.32-17).