mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
IDEA-78458 Patch ini4j to let comment be on the same line as section header
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
Index: src/main/java/org/ini4j/spi/IniParser.java
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>x-MacCyrillic
|
||||
===================================================================
|
||||
--- src/main/java/org/ini4j/spi/IniParser.java (date 1319206062000)
|
||||
+++ src/main/java/org/ini4j/spi/IniParser.java (revision )
|
||||
@@ -114,10 +114,19 @@
|
||||
{
|
||||
String sectionName;
|
||||
|
||||
- if (line.charAt(line.length() - 1) != SECTION_END)
|
||||
+ if (line.charAt(line.length() - 1) != SECTION_END)
|
||||
{
|
||||
+ int sectionEnd = line.lastIndexOf(SECTION_END);
|
||||
+ String afterSectionEnd = line.substring(sectionEnd + 1).trim();
|
||||
+ if (afterSectionEnd.isEmpty() || isComment(afterSectionEnd.charAt(0)))
|
||||
+ {
|
||||
+ line = line.substring(0, sectionEnd + 1);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
parseError(line, source.getLineNumber());
|
||||
- }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
sectionName = unescapeFilter(line.substring(1, line.length() - 1).trim());
|
||||
if ((sectionName.length() == 0) && !getConfig().isUnnamedSection())
|
||||
@@ -133,5 +142,9 @@
|
||||
handler.startSection(sectionName);
|
||||
|
||||
return sectionName;
|
||||
+ }
|
||||
+
|
||||
+ private boolean isComment(char c) {
|
||||
+ return COMMENTS.indexOf(c) >= 0;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user