Skip to content

Commit

Permalink
Merge pull request #91 from Krzmbrzl/plugin
Browse files Browse the repository at this point in the history
Finished work on v0.6.1
  • Loading branch information
Krzmbrzl authored Aug 9, 2016
2 parents 333671e + f5ea630 commit d4f091a
Show file tree
Hide file tree
Showing 172 changed files with 6,800 additions and 2,075 deletions.
1 change: 1 addition & 0 deletions log.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Total number of code lines for %1 = 0
5 changes: 3 additions & 2 deletions plugin/Raven.SQDev.Editors/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Editors
Bundle-SymbolicName: raven.sqdev.editors;singleton:=true
Bundle-Version: 0.4.0
Bundle-Version: 0.5.0
Bundle-Activator: raven.sqdev.editors.activator.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Expand Down Expand Up @@ -44,7 +44,8 @@ Export-Package: org.antlr.v4.runtime;
org.eclipse.swt.custom,
org.antlr.v4.runtime.tree,
raven.sqdev.interfaces,
org.eclipse.jface.text.rules"
org.eclipse.jface.text.rules",
raven.sqdev.editors.parser.preprocessor
Bundle-Vendor: Raven
Import-Package: raven.sqdev.preferences.util
Bundle-ClassPath: ANTLR/antlr-runtime-4.5.3.jar,
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
IF=1
IFN=2
ELSE=3
ENDIF=4
DEFINE=5
UNDEFINE=6
INCLUDE=7
UNKNOWN=8
NUMBER=9
STRING=10
ID=11
ESC_LINEBREAK=12
LINEBREAK=13
WS=14
COMMENT=15
ANY=16
'#ifdef'=1
'#ifndef'=2
'#else'=3
'#endif'=4
'#define'=5
'#undef'=6
'#include'=7
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
IF=1
IFN=2
ELSE=3
ENDIF=4
DEFINE=5
UNDEFINE=6
INCLUDE=7
UNKNOWN=8
NUMBER=9
STRING=10
ID=11
ESC_LINEBREAK=12
LINEBREAK=13
WS=14
COMMENT=15
ANY=16
'#ifdef'=1
'#ifndef'=2
'#else'=3
'#endif'=4
'#define'=5
'#undef'=6
'#include'=7
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,20 @@ public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int
int length = (offendingToken.getType() == Token.EOF) ? 0
: offendingToken.getText().length();

editor.createMarker(IMarker.PROBLEM, offendingToken.getStartIndex(), length, msg,
IMarker.SEVERITY_ERROR);
reportError(offendingToken.getStartIndex(), length, msg);
}

/**
* Reports an error to the respective editor
*
* @param offset
* The offset of the error start
* @param length
* The length of the error
* @param msg
* The error message
*/
public void reportError(int offset, int length, String msg) {
editor.createMarker(IMarker.PROBLEM, offset, length, msg, IMarker.SEVERITY_ERROR);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public class BasicFoldingManager implements IManager {
* The annotation model of the editor this manager should contribute to
*/
protected ProjectionAnnotationModel model;
/**
* Indicates that the annotation Queue has changed
*/
protected boolean annotationQueueChanged;


/**
Expand All @@ -53,17 +57,29 @@ public BasicFoldingManager(ProjectionAnnotationModel model) {
*/
public void addFoldingArea(Entry<ProjectionAnnotation, Position> entry) {
annotationQueue.put(entry.getKey(), entry.getValue());

// indicate change
annotationQueueChanged = true;
}

@Override
public void apply() {
annotationQueueChanged = false;

// clear
model.removeAllAnnotations();

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

while (mapIterator.hasNext()) {
if (annotationQueueChanged) {
// the queue has been modified by another thread -> reapply to
// avoid concurrent exception
apply();
break;
}

// add the foladable areas TODO: implement some overlap logic
Entry<ProjectionAnnotation, Position> entry = mapIterator.next();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public List<Keyword> getConfiguredKeywordsFor(char c) {
* The preference key for the color of the desired
* <code>KeywordScanner</code>
* @return The <code>KeywordScanner</code> working for the given preference
* key or <code>null</code> if no such scanne could be found
* key or <code>null</code> if no such scanner could be found
*/
public KeywordScanner getKeywordScanner(String colorPreferenceKey) {
if (!configuredKeywordScanners.containsKey(colorPreferenceKey)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package raven.sqdev.editors;

/**
* An interface describing a class that provides macro-support
*
* @author Raven
*
*/
public interface IMacroSupport {

/**
* Adds a macro to this <code>IMacroSupport</code>
*
* @param macro
* The <code>Macro</code> to add
*/
public void addMacro(Macro macro);

/**
* Removes the given macro
*
* @param macro
* The <code>Macro</code> to remove
*/
public void removeMacro(Macro macro);
}
54 changes: 54 additions & 0 deletions plugin/Raven.SQDev.Editors/src/raven/sqdev/editors/Macro.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package raven.sqdev.editors;

import raven.sqdev.infoCollection.base.Keyword;

/**
* A class representing a defined macro expression
*
* @author Raven
*
*/
public class Macro extends Keyword {

protected int arguments;

/**
* Creates a new macro that has no arguments
*
* @param name
* The name of the macro
*/
public Macro(String name) {
super(name);
arguments = 0;
}

/**
* Creates a new macro
*
* @param name
* The name of the macro
* @param arguments
* The number of arguments this macro can take
*/
public Macro(String name, int arguments) {
super(name);

this.arguments = arguments;
}

/**
* Gets the number of arguments this macro takes
*/
public int getArgumentCount() {
return arguments;
}

/**
* Checks whether this macro uses any arguments
*/
public boolean hasArguments() {
return getArgumentCount() != 0;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
IF=1
IFN=2
ELSE=3
ENDIF=4
DEFINE=5
UNDEFINE=6
INCLUDE=7
UNKNOWN=8
NUMBER=9
STRING=10
ID=11
ESC_LINEBREAK=12
LINEBREAK=13
WS=14
COMMENT=15
ANY=16
'#ifdef'=1
'#ifndef'=2
'#else'=3
'#endif'=4
'#define'=5
'#undef'=6
'#include'=7
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// Generated from Preprocessor.g4 by ANTLR 4.5.3
package raven.sqdev.editors.parser.preprocessor;

import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;

/**
* This class provides an empty implementation of {@link PreprocessorListener},
* which can be extended to create a listener which only needs to handle a subset
* of the available methods.
*/
public class PreprocessorBaseListener implements PreprocessorListener {
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStart(PreprocessorParser.StartContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStart(PreprocessorParser.StartContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPreprocessing(PreprocessorParser.PreprocessingContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPreprocessing(PreprocessorParser.PreprocessingContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIfBlock(PreprocessorParser.IfBlockContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIfBlock(PreprocessorParser.IfBlockContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDefine(PreprocessorParser.DefineContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDefine(PreprocessorParser.DefineContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterUndefine(PreprocessorParser.UndefineContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitUndefine(PreprocessorParser.UndefineContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterInclude(PreprocessorParser.IncludeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitInclude(PreprocessorParser.IncludeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterError(PreprocessorParser.ErrorContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitError(PreprocessorParser.ErrorContext ctx) { }

/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitTerminal(TerminalNode node) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitErrorNode(ErrorNode node) { }
}
Loading

0 comments on commit d4f091a

Please sign in to comment.