Lines 43-49
Link Here
|
43 |
package org.netbeans.modules.php.editor.parser; |
43 |
package org.netbeans.modules.php.editor.parser; |
44 |
|
44 |
|
45 |
import java.util.ArrayList; |
45 |
import java.util.ArrayList; |
46 |
import java.util.Arrays; |
|
|
47 |
import java.util.List; |
46 |
import java.util.List; |
48 |
import java.util.logging.Level; |
47 |
import java.util.logging.Level; |
49 |
import java.util.logging.Logger; |
48 |
import java.util.logging.Logger; |
Lines 52-58
Link Here
|
52 |
import org.netbeans.modules.php.api.util.StringUtils; |
51 |
import org.netbeans.modules.php.api.util.StringUtils; |
53 |
import org.netbeans.modules.php.editor.parser.GSFPHPParser.Context; |
52 |
import org.netbeans.modules.php.editor.parser.GSFPHPParser.Context; |
54 |
import org.netbeans.modules.php.editor.parser.astnodes.ASTNode; |
53 |
import org.netbeans.modules.php.editor.parser.astnodes.ASTNode; |
55 |
import org.netbeans.modules.php.editor.parser.astnodes.Program; |
|
|
56 |
import org.openide.util.NbBundle; |
54 |
import org.openide.util.NbBundle; |
57 |
|
55 |
|
58 |
/** |
56 |
/** |
Lines 64-74
Link Here
|
64 |
private final List<SyntaxError> syntaxErrors; |
62 |
private final List<SyntaxError> syntaxErrors; |
65 |
private final Context context; |
63 |
private final Context context; |
66 |
private volatile boolean handleErrors = true; |
64 |
private volatile boolean handleErrors = true; |
|
|
65 |
private final List<FatalError> fatalErrors; |
67 |
|
66 |
|
68 |
public PHP5ErrorHandlerImpl(Context context) { |
67 |
public PHP5ErrorHandlerImpl(Context context) { |
69 |
super(); |
68 |
super(); |
70 |
this.context = context; |
69 |
this.context = context; |
71 |
syntaxErrors = new ArrayList<>(); |
70 |
syntaxErrors = new ArrayList<>(); |
|
|
71 |
fatalErrors = new ArrayList<>(); |
72 |
} |
72 |
} |
73 |
|
73 |
|
74 |
@Override |
74 |
@Override |
Lines 81-86
Link Here
|
81 |
syntaxErrorType = SyntaxError.Type.FIRST_VALID_ERROR; |
81 |
syntaxErrorType = SyntaxError.Type.FIRST_VALID_ERROR; |
82 |
} |
82 |
} |
83 |
syntaxErrors.add(new SyntaxError(expectedtokens, current, previous, syntaxErrorType)); |
83 |
syntaxErrors.add(new SyntaxError(expectedtokens, current, previous, syntaxErrorType)); |
|
|
84 |
} else if (type == Type.FATAL_PARSER_ERROR) { |
85 |
fatalErrors.add(new FatalError(context)); |
84 |
} |
86 |
} |
85 |
} |
87 |
} |
86 |
} |
88 |
} |
Lines 90-102
Link Here
|
90 |
handleErrors = false; |
92 |
handleErrors = false; |
91 |
} |
93 |
} |
92 |
|
94 |
|
93 |
@Override |
95 |
private List<? extends Error> prepareSyntaxErrors() { |
94 |
public List<Error> displayFatalError() { |
|
|
95 |
return Arrays.asList((Error) new FatalError(context)); |
96 |
} |
97 |
|
98 |
@Override |
99 |
public List<Error> displaySyntaxErrors(Program program) { |
100 |
List<Error> errors = new ArrayList<>(); |
96 |
List<Error> errors = new ArrayList<>(); |
101 |
for (SyntaxError syntaxError : syntaxErrors) { |
97 |
for (SyntaxError syntaxError : syntaxErrors) { |
102 |
errors.add(defaultSyntaxErrorHandling(syntaxError)); |
98 |
errors.add(defaultSyntaxErrorHandling(syntaxError)); |
Lines 104-109
Link Here
|
104 |
return errors; |
100 |
return errors; |
105 |
} |
101 |
} |
106 |
|
102 |
|
|
|
103 |
@Override |
104 |
public List<? extends Error> displayErrors() { |
105 |
List<Error> errors = new ArrayList<>(); |
106 |
errors.addAll(prepareSyntaxErrors()); |
107 |
errors.addAll(fatalErrors); |
108 |
return errors; |
109 |
} |
110 |
|
107 |
@NbBundle.Messages("SE_Expected=expected") |
111 |
@NbBundle.Messages("SE_Expected=expected") |
108 |
private Error defaultSyntaxErrorHandling(SyntaxError syntaxError) { |
112 |
private Error defaultSyntaxErrorHandling(SyntaxError syntaxError) { |
109 |
StringBuilder message = new StringBuilder(); |
113 |
StringBuilder message = new StringBuilder(); |