diff options
3 files changed, 7 insertions, 14 deletions
diff --git a/plugins/org.eclipse.dltk.sh.core/src/org/eclipse/dltk/sh/internal/core/parser/ShellScriptSourceParser.java b/plugins/org.eclipse.dltk.sh.core/src/org/eclipse/dltk/sh/internal/core/parser/ShellScriptSourceParser.java index 2a9da3f..9fbb004 100644 --- a/plugins/org.eclipse.dltk.sh.core/src/org/eclipse/dltk/sh/internal/core/parser/ShellScriptSourceParser.java +++ b/plugins/org.eclipse.dltk.sh.core/src/org/eclipse/dltk/sh/internal/core/parser/ShellScriptSourceParser.java @@ -76,13 +76,9 @@ public class ShellScriptSourceParser extends AbstractSourceParser { functionNames.add(line.substring(fPlusEight, lBracket).trim()); tmp.push(mDeclaration); model.addFunction(mDeclaration); - } else if (line.trim().equals("}")) { - if (mDeclaration != null) { - if (!tmp.isEmpty()) { - mDeclaration = (MethodDeclaration) tmp.pop(); - mDeclaration.setEnd(lineStart + line.length()); - } - } + } else if (line.trim().equals("}") && mDeclaration != null && !tmp.isEmpty()) { + mDeclaration = (MethodDeclaration) tmp.pop(); + mDeclaration.setEnd(lineStart + line.length()); } Pattern assignmentPattern = Pattern.compile("(^|\\W)\\w*="); Matcher matcher = assignmentPattern.matcher(line); @@ -198,7 +194,6 @@ public class ShellScriptSourceParser extends AbstractSourceParser { lineStart += line.length() + commentLength + 1; commentLength = 0; } - bReader.close(); } catch (IOException e) { e.printStackTrace(); } diff --git a/plugins/org.eclipse.dltk.sh.ui/src/org/eclipse/dltk/sh/internal/ui/text/DollarBraceCountingRule.java b/plugins/org.eclipse.dltk.sh.ui/src/org/eclipse/dltk/sh/internal/ui/text/DollarBraceCountingRule.java index f9adede..dac3543 100644 --- a/plugins/org.eclipse.dltk.sh.ui/src/org/eclipse/dltk/sh/internal/ui/text/DollarBraceCountingRule.java +++ b/plugins/org.eclipse.dltk.sh.ui/src/org/eclipse/dltk/sh/internal/ui/text/DollarBraceCountingRule.java @@ -86,9 +86,9 @@ public class DollarBraceCountingRule extends PatternRule { break; } } - } else + } else { scanner.read(); - + } } else if (c == fOpening) { // Count opening braces fBraceCount++; diff --git a/plugins/org.eclipse.dltk.sh.ui/src/org/eclipse/dltk/sh/internal/ui/text/folding/ShellCodeFoldingBlockProvider.java b/plugins/org.eclipse.dltk.sh.ui/src/org/eclipse/dltk/sh/internal/ui/text/folding/ShellCodeFoldingBlockProvider.java index ba9f1af..9ffb9c1 100644 --- a/plugins/org.eclipse.dltk.sh.ui/src/org/eclipse/dltk/sh/internal/ui/text/folding/ShellCodeFoldingBlockProvider.java +++ b/plugins/org.eclipse.dltk.sh.ui/src/org/eclipse/dltk/sh/internal/ui/text/folding/ShellCodeFoldingBlockProvider.java @@ -45,10 +45,8 @@ public class ShellCodeFoldingBlockProvider extends ModelFoldingBlockProvider { @Override protected boolean isFoldedInitially(IModelElement element) { - if (foldingEnabled) { - if (element instanceof IMethod) { - return functionsCollapsedInitially; - } + if (foldingEnabled && (element instanceof IMethod)) { + return functionsCollapsedInitially; } return false; } |