Skip to content

Commit d4f091a

Browse files
authored
Merge pull request #91 from Krzmbrzl/plugin
Finished work on v0.6.1
2 parents 333671e + f5ea630 commit d4f091a

File tree

172 files changed

+6800
-2075
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+6800
-2075
lines changed

log.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Total number of code lines for %1 = 0

plugin/Raven.SQDev.Editors/META-INF/MANIFEST.MF

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: Editors
44
Bundle-SymbolicName: raven.sqdev.editors;singleton:=true
5-
Bundle-Version: 0.4.0
5+
Bundle-Version: 0.5.0
66
Bundle-Activator: raven.sqdev.editors.activator.Activator
77
Require-Bundle: org.eclipse.ui,
88
org.eclipse.core.runtime,
@@ -44,7 +44,8 @@ Export-Package: org.antlr.v4.runtime;
4444
org.eclipse.swt.custom,
4545
org.antlr.v4.runtime.tree,
4646
raven.sqdev.interfaces,
47-
org.eclipse.jface.text.rules"
47+
org.eclipse.jface.text.rules",
48+
raven.sqdev.editors.parser.preprocessor
4849
Bundle-Vendor: Raven
4950
Import-Package: raven.sqdev.preferences.util
5051
Bundle-ClassPath: ANTLR/antlr-runtime-4.5.3.jar,
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
IF=1
2+
IFN=2
3+
ELSE=3
4+
ENDIF=4
5+
DEFINE=5
6+
UNDEFINE=6
7+
INCLUDE=7
8+
UNKNOWN=8
9+
NUMBER=9
10+
STRING=10
11+
ID=11
12+
ESC_LINEBREAK=12
13+
LINEBREAK=13
14+
WS=14
15+
COMMENT=15
16+
ANY=16
17+
'#ifdef'=1
18+
'#ifndef'=2
19+
'#else'=3
20+
'#endif'=4
21+
'#define'=5
22+
'#undef'=6
23+
'#include'=7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
IF=1
2+
IFN=2
3+
ELSE=3
4+
ENDIF=4
5+
DEFINE=5
6+
UNDEFINE=6
7+
INCLUDE=7
8+
UNKNOWN=8
9+
NUMBER=9
10+
STRING=10
11+
ID=11
12+
ESC_LINEBREAK=12
13+
LINEBREAK=13
14+
WS=14
15+
COMMENT=15
16+
ANY=16
17+
'#ifdef'=1
18+
'#ifndef'=2
19+
'#else'=3
20+
'#endif'=4
21+
'#define'=5
22+
'#undef'=6
23+
'#include'=7
Binary file not shown.

plugin/Raven.SQDev.Editors/src/raven/sqdev/editors/BasicErrorListener.java

+15-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,20 @@ public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int
4444
int length = (offendingToken.getType() == Token.EOF) ? 0
4545
: offendingToken.getText().length();
4646

47-
editor.createMarker(IMarker.PROBLEM, offendingToken.getStartIndex(), length, msg,
48-
IMarker.SEVERITY_ERROR);
47+
reportError(offendingToken.getStartIndex(), length, msg);
48+
}
49+
50+
/**
51+
* Reports an error to the respective editor
52+
*
53+
* @param offset
54+
* The offset of the error start
55+
* @param length
56+
* The length of the error
57+
* @param msg
58+
* The error message
59+
*/
60+
public void reportError(int offset, int length, String msg) {
61+
editor.createMarker(IMarker.PROBLEM, offset, length, msg, IMarker.SEVERITY_ERROR);
4962
}
5063
}

plugin/Raven.SQDev.Editors/src/raven/sqdev/editors/BasicFoldingManager.java

+16
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ public class BasicFoldingManager implements IManager {
2727
* The annotation model of the editor this manager should contribute to
2828
*/
2929
protected ProjectionAnnotationModel model;
30+
/**
31+
* Indicates that the annotation Queue has changed
32+
*/
33+
protected boolean annotationQueueChanged;
3034

3135

3236
/**
@@ -53,17 +57,29 @@ public BasicFoldingManager(ProjectionAnnotationModel model) {
5357
*/
5458
public void addFoldingArea(Entry<ProjectionAnnotation, Position> entry) {
5559
annotationQueue.put(entry.getKey(), entry.getValue());
60+
61+
// indicate change
62+
annotationQueueChanged = true;
5663
}
5764

5865
@Override
5966
public void apply() {
67+
annotationQueueChanged = false;
68+
6069
// clear
6170
model.removeAllAnnotations();
6271

6372
Iterator<Entry<ProjectionAnnotation, Position>> mapIterator = annotationQueue.entrySet()
6473
.iterator();
6574

6675
while (mapIterator.hasNext()) {
76+
if (annotationQueueChanged) {
77+
// the queue has been modified by another thread -> reapply to
78+
// avoid concurrent exception
79+
apply();
80+
break;
81+
}
82+
6783
// add the foladable areas TODO: implement some overlap logic
6884
Entry<ProjectionAnnotation, Position> entry = mapIterator.next();
6985

plugin/Raven.SQDev.Editors/src/raven/sqdev/editors/BasicSourceViewerConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public List<Keyword> getConfiguredKeywordsFor(char c) {
143143
* The preference key for the color of the desired
144144
* <code>KeywordScanner</code>
145145
* @return The <code>KeywordScanner</code> working for the given preference
146-
* key or <code>null</code> if no such scanne could be found
146+
* key or <code>null</code> if no such scanner could be found
147147
*/
148148
public KeywordScanner getKeywordScanner(String colorPreferenceKey) {
149149
if (!configuredKeywordScanners.containsKey(colorPreferenceKey)) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package raven.sqdev.editors;
2+
3+
/**
4+
* An interface describing a class that provides macro-support
5+
*
6+
* @author Raven
7+
*
8+
*/
9+
public interface IMacroSupport {
10+
11+
/**
12+
* Adds a macro to this <code>IMacroSupport</code>
13+
*
14+
* @param macro
15+
* The <code>Macro</code> to add
16+
*/
17+
public void addMacro(Macro macro);
18+
19+
/**
20+
* Removes the given macro
21+
*
22+
* @param macro
23+
* The <code>Macro</code> to remove
24+
*/
25+
public void removeMacro(Macro macro);
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package raven.sqdev.editors;
2+
3+
import raven.sqdev.infoCollection.base.Keyword;
4+
5+
/**
6+
* A class representing a defined macro expression
7+
*
8+
* @author Raven
9+
*
10+
*/
11+
public class Macro extends Keyword {
12+
13+
protected int arguments;
14+
15+
/**
16+
* Creates a new macro that has no arguments
17+
*
18+
* @param name
19+
* The name of the macro
20+
*/
21+
public Macro(String name) {
22+
super(name);
23+
arguments = 0;
24+
}
25+
26+
/**
27+
* Creates a new macro
28+
*
29+
* @param name
30+
* The name of the macro
31+
* @param arguments
32+
* The number of arguments this macro can take
33+
*/
34+
public Macro(String name, int arguments) {
35+
super(name);
36+
37+
this.arguments = arguments;
38+
}
39+
40+
/**
41+
* Gets the number of arguments this macro takes
42+
*/
43+
public int getArgumentCount() {
44+
return arguments;
45+
}
46+
47+
/**
48+
* Checks whether this macro uses any arguments
49+
*/
50+
public boolean hasArguments() {
51+
return getArgumentCount() != 0;
52+
}
53+
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
IF=1
2+
IFN=2
3+
ELSE=3
4+
ENDIF=4
5+
DEFINE=5
6+
UNDEFINE=6
7+
INCLUDE=7
8+
UNKNOWN=8
9+
NUMBER=9
10+
STRING=10
11+
ID=11
12+
ESC_LINEBREAK=12
13+
LINEBREAK=13
14+
WS=14
15+
COMMENT=15
16+
ANY=16
17+
'#ifdef'=1
18+
'#ifndef'=2
19+
'#else'=3
20+
'#endif'=4
21+
'#define'=5
22+
'#undef'=6
23+
'#include'=7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
// Generated from Preprocessor.g4 by ANTLR 4.5.3
2+
package raven.sqdev.editors.parser.preprocessor;
3+
4+
import org.antlr.v4.runtime.ParserRuleContext;
5+
import org.antlr.v4.runtime.tree.ErrorNode;
6+
import org.antlr.v4.runtime.tree.TerminalNode;
7+
8+
/**
9+
* This class provides an empty implementation of {@link PreprocessorListener},
10+
* which can be extended to create a listener which only needs to handle a subset
11+
* of the available methods.
12+
*/
13+
public class PreprocessorBaseListener implements PreprocessorListener {
14+
/**
15+
* {@inheritDoc}
16+
*
17+
* <p>The default implementation does nothing.</p>
18+
*/
19+
@Override public void enterStart(PreprocessorParser.StartContext ctx) { }
20+
/**
21+
* {@inheritDoc}
22+
*
23+
* <p>The default implementation does nothing.</p>
24+
*/
25+
@Override public void exitStart(PreprocessorParser.StartContext ctx) { }
26+
/**
27+
* {@inheritDoc}
28+
*
29+
* <p>The default implementation does nothing.</p>
30+
*/
31+
@Override public void enterPreprocessing(PreprocessorParser.PreprocessingContext ctx) { }
32+
/**
33+
* {@inheritDoc}
34+
*
35+
* <p>The default implementation does nothing.</p>
36+
*/
37+
@Override public void exitPreprocessing(PreprocessorParser.PreprocessingContext ctx) { }
38+
/**
39+
* {@inheritDoc}
40+
*
41+
* <p>The default implementation does nothing.</p>
42+
*/
43+
@Override public void enterIfBlock(PreprocessorParser.IfBlockContext ctx) { }
44+
/**
45+
* {@inheritDoc}
46+
*
47+
* <p>The default implementation does nothing.</p>
48+
*/
49+
@Override public void exitIfBlock(PreprocessorParser.IfBlockContext ctx) { }
50+
/**
51+
* {@inheritDoc}
52+
*
53+
* <p>The default implementation does nothing.</p>
54+
*/
55+
@Override public void enterDefine(PreprocessorParser.DefineContext ctx) { }
56+
/**
57+
* {@inheritDoc}
58+
*
59+
* <p>The default implementation does nothing.</p>
60+
*/
61+
@Override public void exitDefine(PreprocessorParser.DefineContext ctx) { }
62+
/**
63+
* {@inheritDoc}
64+
*
65+
* <p>The default implementation does nothing.</p>
66+
*/
67+
@Override public void enterUndefine(PreprocessorParser.UndefineContext ctx) { }
68+
/**
69+
* {@inheritDoc}
70+
*
71+
* <p>The default implementation does nothing.</p>
72+
*/
73+
@Override public void exitUndefine(PreprocessorParser.UndefineContext ctx) { }
74+
/**
75+
* {@inheritDoc}
76+
*
77+
* <p>The default implementation does nothing.</p>
78+
*/
79+
@Override public void enterInclude(PreprocessorParser.IncludeContext ctx) { }
80+
/**
81+
* {@inheritDoc}
82+
*
83+
* <p>The default implementation does nothing.</p>
84+
*/
85+
@Override public void exitInclude(PreprocessorParser.IncludeContext ctx) { }
86+
/**
87+
* {@inheritDoc}
88+
*
89+
* <p>The default implementation does nothing.</p>
90+
*/
91+
@Override public void enterError(PreprocessorParser.ErrorContext ctx) { }
92+
/**
93+
* {@inheritDoc}
94+
*
95+
* <p>The default implementation does nothing.</p>
96+
*/
97+
@Override public void exitError(PreprocessorParser.ErrorContext ctx) { }
98+
99+
/**
100+
* {@inheritDoc}
101+
*
102+
* <p>The default implementation does nothing.</p>
103+
*/
104+
@Override public void enterEveryRule(ParserRuleContext ctx) { }
105+
/**
106+
* {@inheritDoc}
107+
*
108+
* <p>The default implementation does nothing.</p>
109+
*/
110+
@Override public void exitEveryRule(ParserRuleContext ctx) { }
111+
/**
112+
* {@inheritDoc}
113+
*
114+
* <p>The default implementation does nothing.</p>
115+
*/
116+
@Override public void visitTerminal(TerminalNode node) { }
117+
/**
118+
* {@inheritDoc}
119+
*
120+
* <p>The default implementation does nothing.</p>
121+
*/
122+
@Override public void visitErrorNode(ErrorNode node) { }
123+
}

0 commit comments

Comments
 (0)