5)
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/editor/outline/OutlineContentBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2006 SchemeWay Project. All rights reserved.
3 | */
4 | package org.schemeway.plugins.schemescript.editor.outline;
5 |
6 | import org.eclipse.jface.text.*;
7 | import org.schemeway.plugins.schemescript.editor.*;
8 |
9 | /**
10 | * @author SchemeWay Project.
11 | *
12 | */
13 | public interface OutlineContentBuilder {
14 | OutlineNode[] buildNodes(SchemeEditor editor) throws BadLocationException, BadPositionCategoryException;
15 | }
16 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/interpreter/Interpreter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.interpreter;
7 |
8 | import org.eclipse.core.resources.*;
9 |
10 | public interface Interpreter {
11 | boolean isRunning();
12 | void start();
13 | void stop();
14 | void restart();
15 |
16 | boolean supportInterruption();
17 | void interrupt();
18 | void eval(String code);
19 | void load(IFile file);
20 |
21 | void showConsole();
22 | }
23 |
--------------------------------------------------------------------------------
/plugin/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/plugin/html/toc.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | SchemeScript User Guide
7 |
8 |
9 |
10 |
11 | SchemeScript User Guide
12 |
13 | SchemeScript is an industrial-strength Scheme editor plug-in for Eclipse.
14 |
15 | The UserGuide has been moved to our github repo's wiki
16 |
17 |
18 |
19 | Copyright (C) Dominique Boucher.
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/editor/outline/OutlineNodePositionComparator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2006 SchemeWay Project. All rights reserved.
3 | */
4 | package org.schemeway.plugins.schemescript.editor.outline;
5 |
6 | import java.util.*;
7 |
8 | class OutlineNodePositionComparator implements Comparator {
9 | public int compare(Object o1, Object o2) {
10 | OutlineNode s1 = (OutlineNode)o1;
11 | OutlineNode s2 = (OutlineNode)o2;
12 |
13 | if (s1.position.offset < s2.position.offset)
14 | return -1;
15 | else if (s1.position.offset > s2.position.offset)
16 | return 1;
17 | else
18 | return 0;
19 | }
20 | }
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/interpreter/RemoteInterpreter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2005 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.interpreter;
7 |
8 | import org.schemeway.plugins.schemescript.*;
9 |
10 | public class RemoteInterpreter extends AbstractInterpreter
11 | {
12 | public static final String CONFIG_TYPE = SchemeScriptPlugin.PLUGIN_NS + ".remoteInterpreter";
13 |
14 | public IInterpreterProcess getProcess()
15 | {
16 | return RemoteInterpreterProcess.getInstance();
17 | }
18 |
19 | public String getConfigurationType() {
20 | return CONFIG_TYPE;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/plugin/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | SchemeScript
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.ManifestBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.pde.SchemaBuilder
20 |
21 |
22 |
23 |
24 |
25 | org.eclipse.pde.PluginNature
26 | org.eclipse.jdt.core.javanature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/action/SchemeAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.action;
7 |
8 | import org.eclipse.jface.action.*;
9 | import org.schemeway.plugins.schemescript.editor.*;
10 |
11 | public class SchemeAction extends Action implements ISchemeEditorAction {
12 | private SchemeEditor mEditor = null;
13 |
14 | public SchemeAction(SchemeEditor editor) {
15 | super();
16 | setSchemeEditor(editor);
17 | }
18 |
19 | public void setSchemeEditor(SchemeEditor editor) {
20 | mEditor = editor;
21 | }
22 |
23 | public SchemeEditor getSchemeEditor() {
24 | return mEditor;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/preferences/IndentationSchemeListViewer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2006 SchemeWay Project. All rights reserved.
3 | */
4 | package org.schemeway.plugins.schemescript.preferences;
5 |
6 | import org.eclipse.jface.viewers.*;
7 | import org.eclipse.swt.widgets.*;
8 | import org.schemeway.plugins.schemescript.indentation.*;
9 |
10 |
11 | /**
12 | * @author SchemeWay Project.
13 | *
14 | */
15 | public class IndentationSchemeListViewer extends TableViewer {
16 |
17 | /**
18 | * @param table
19 | */
20 | public IndentationSchemeListViewer(Table table) {
21 | super(table);
22 | }
23 |
24 |
25 | public void addIndentationRule(IndentationRule rule) {
26 | int index = indexForElement(rule);
27 | add(rule);
28 | getControl().setFocus();
29 | doSetSelection(new int[] {index});
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/interpreter/SiscInterpreterDelegate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2006 SchemeWay Project. All rights reserved.
3 | */
4 | package org.schemeway.plugins.schemescript.interpreter;
5 |
6 | import org.eclipse.core.runtime.*;
7 | import org.eclipse.debug.core.*;
8 | import org.eclipse.debug.core.model.*;
9 |
10 | /**
11 | * @author SchemeWay Project.
12 | *
13 | */
14 | public class SiscInterpreterDelegate implements ILaunchConfigurationDelegate {
15 |
16 | public SiscInterpreterDelegate()
17 | {
18 | }
19 |
20 | public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
21 | throws CoreException
22 | {
23 | SiscProcess.getInstance().setLaunch(launch);
24 | launch.addProcess(SiscProcess.getInstance());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/interpreter/KawaInterpreterDelegate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.interpreter;
7 |
8 | import org.eclipse.core.runtime.*;
9 | import org.eclipse.debug.core.*;
10 | import org.eclipse.debug.core.model.*;
11 |
12 | public class KawaInterpreterDelegate implements ILaunchConfigurationDelegate
13 | {
14 | public KawaInterpreterDelegate()
15 | {
16 | super();
17 | }
18 |
19 | public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
20 | throws CoreException
21 | {
22 | KawaProcess.getInstance().setLaunch(launch);
23 | launch.addProcess(KawaProcess.getInstance());
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/editor/outline/DefinitionsContentBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2006 SchemeWay Project. All rights reserved.
3 | */
4 | package org.schemeway.plugins.schemescript.editor.outline;
5 |
6 | import java.util.*;
7 |
8 | import org.eclipse.jface.text.*;
9 | import org.schemeway.plugins.schemescript.editor.*;
10 |
11 | /**
12 | * @author SchemeWay Project.
13 | *
14 | */
15 | public class DefinitionsContentBuilder implements OutlineContentBuilder {
16 |
17 | public OutlineNode[] buildNodes(SchemeEditor editor) throws BadLocationException, BadPositionCategoryException {
18 | List nodes = new ArrayList();
19 |
20 | ContentUtilities.addDefinitions(editor, nodes, true);
21 | Collections.sort(nodes, ContentUtilities.NODE_COMPARATOR);
22 |
23 | return (OutlineNode[]) nodes.toArray(new OutlineNode[nodes.size()]);
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/editor/outline/SectionsContentBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2006 SchemeWay Project. All rights reserved.
3 | */
4 | package org.schemeway.plugins.schemescript.editor.outline;
5 |
6 | import java.util.*;
7 |
8 | import org.eclipse.jface.text.*;
9 | import org.schemeway.plugins.schemescript.editor.*;
10 |
11 | /**
12 | * @author SchemeWay Project.
13 | *
14 | */
15 | public class SectionsContentBuilder implements OutlineContentBuilder {
16 |
17 | public OutlineNode[] buildNodes(SchemeEditor editor) throws BadLocationException, BadPositionCategoryException {
18 | List nodes = new ArrayList();
19 |
20 | ContentUtilities.addSections(editor.getDocument(), nodes);
21 | Collections.sort(nodes, ContentUtilities.NODE_COMPARATOR);
22 |
23 | return (OutlineNode[]) nodes.toArray(new OutlineNode[nodes.size()]);
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/interpreter/RemoteInterpreterDelegate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.interpreter;
7 |
8 | import org.eclipse.core.runtime.*;
9 | import org.eclipse.debug.core.*;
10 | import org.eclipse.debug.core.model.*;
11 |
12 | public class RemoteInterpreterDelegate implements ILaunchConfigurationDelegate
13 | {
14 | public RemoteInterpreterDelegate()
15 | {
16 | super();
17 | }
18 |
19 | public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
20 | throws CoreException
21 | {
22 | RemoteInterpreterProcess.getInstance().setLaunch(launch);
23 | launch.addProcess(RemoteInterpreterProcess.getInstance());
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/interpreter/SiscInterpreter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2006 SchemeWay Project. All rights reserved.
3 | */
4 | package org.schemeway.plugins.schemescript.interpreter;
5 |
6 | import org.schemeway.plugins.schemescript.*;
7 |
8 | /**
9 | * @author SchemeWay Project.
10 | *
11 | */
12 | public class SiscInterpreter extends AbstractInterpreter {
13 | public static final String CONFIG_TYPE = SchemeScriptPlugin.PLUGIN_NS + ".siscInterpreter";
14 |
15 | public SiscInterpreter() {
16 | super();
17 | }
18 |
19 | public IInterpreterProcess getProcess() {
20 | return SiscProcess.getInstance();
21 | }
22 |
23 | public String getConfigurationType() {
24 | return CONFIG_TYPE;
25 | }
26 |
27 | public void stop() {
28 | }
29 |
30 | public void restart() {
31 | start();
32 | }
33 |
34 | public boolean supportInterruption() {
35 | return false;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/editor/ColorManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.editor;
7 |
8 | import java.util.*;
9 |
10 | import org.eclipse.swt.graphics.*;
11 | import org.eclipse.swt.widgets.*;
12 |
13 | public class ColorManager {
14 |
15 | protected Map fColorTable = new HashMap(10);
16 |
17 | public void dispose() {
18 | Iterator e = fColorTable.values().iterator();
19 | while (e.hasNext())
20 | ((Color) e.next()).dispose();
21 | }
22 |
23 | public Color getColor(RGB rgb) {
24 | Color color = (Color) fColorTable.get(rgb);
25 | if (color == null) {
26 | color = new Color(Display.getCurrent(), rgb);
27 | fColorTable.put(rgb, color);
28 | }
29 | return color;
30 | }
31 | }
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/editor/outline/NodeLabelProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2006 SchemeWay Project. All rights reserved.
3 | */
4 | package org.schemeway.plugins.schemescript.editor.outline;
5 |
6 | import org.eclipse.jface.viewers.*;
7 | import org.eclipse.swt.graphics.*;
8 |
9 | public class NodeLabelProvider extends LabelProvider {
10 | public String getText(Object element) {
11 | return ((OutlineNode)element).name;
12 | }
13 |
14 | public Image getImage(Object element)
15 | {
16 | OutlineNode section = (OutlineNode)element;
17 | if (section.type == OutlineNode.SECTION) {
18 | return SchemeOutlineImageProvider.getSectionImage();
19 | }
20 | else if (section.type == OutlineNode.CHAPTER ) {
21 | return SchemeOutlineImageProvider.getChapterImage();
22 | }
23 |
24 | return SchemeOutlineImageProvider.getDefinitionImage();
25 | }
26 | }
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/editor/outline/SectionsAndDefinitionsContentBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2006 SchemeWay Project. All rights reserved.
3 | */
4 | package org.schemeway.plugins.schemescript.editor.outline;
5 |
6 | import java.util.*;
7 |
8 | import org.eclipse.jface.text.*;
9 | import org.schemeway.plugins.schemescript.editor.*;
10 |
11 | /**
12 | * @author SchemeWay Project.
13 | *
14 | */
15 | public class SectionsAndDefinitionsContentBuilder implements OutlineContentBuilder {
16 |
17 | public OutlineNode[] buildNodes(SchemeEditor editor) throws BadLocationException, BadPositionCategoryException {
18 | List nodes = new ArrayList();
19 |
20 | ContentUtilities.addSections(editor.getDocument(), nodes);
21 | ContentUtilities.addDefinitions(editor, nodes, true);
22 | Collections.sort(nodes, ContentUtilities.NODE_COMPARATOR);
23 |
24 | return (OutlineNode[]) nodes.toArray(new OutlineNode[nodes.size()]);
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/interpreter/KawaInterpreter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.interpreter;
7 |
8 | import org.schemeway.plugins.schemescript.*;
9 |
10 | public class KawaInterpreter extends AbstractInterpreter {
11 | public static final String CONFIG_TYPE = SchemeScriptPlugin.PLUGIN_NS + ".kawaInterpreter";
12 |
13 | public KawaInterpreter() {
14 | super();
15 | }
16 |
17 | public IInterpreterProcess getProcess() {
18 | return KawaProcess.getInstance();
19 | }
20 |
21 | public String getConfigurationType() {
22 | return CONFIG_TYPE;
23 | }
24 |
25 | public void stop() {
26 | }
27 |
28 | public void restart() {
29 | start();
30 | }
31 |
32 | public boolean supportInterruption() {
33 | return false;
34 | }
35 | }
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/SchemeScriptImageRegistry.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript;
7 |
8 | import org.eclipse.core.runtime.Path;
9 | import org.eclipse.jface.resource.*;
10 | import org.eclipse.swt.graphics.*;
11 |
12 | public final class SchemeScriptImageRegistry {
13 |
14 | private SchemeScriptImageRegistry() {
15 | }
16 |
17 | // finds an image in the Plugin
18 | public static Image getImage(String relativePath) {
19 |
20 | ImageDescriptor descriptor = getImageDescriptor(relativePath);
21 | if (descriptor == null)
22 | return null;
23 | return descriptor.createImage();
24 | }
25 |
26 | public static ImageDescriptor getImageDescriptor(String relativePath) {
27 | return ImageDescriptor.createFromURL(SchemeScriptPlugin.findFile(new Path(relativePath)));
28 | }
29 | }
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/action/FileHeaderCommentAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.action;
7 |
8 | import org.eclipse.jface.text.*;
9 | import org.schemeway.plugins.schemescript.editor.*;
10 | import org.schemeway.plugins.schemescript.tools.*;
11 |
12 | public class FileHeaderCommentAction extends SchemeAction {
13 |
14 | public FileHeaderCommentAction(SchemeEditor editor) {
15 | super(editor);
16 | setText("Insert header comment");
17 | setToolTipText("Insert a Scheme file header comment");
18 | }
19 |
20 | public void run() {
21 | SchemeEditor editor = getSchemeEditor();
22 | if (editor == null) return;
23 |
24 | String newline = TextUtilities.getDefaultLineDelimiter(editor.getDocument());
25 |
26 | editor.insertText(0, Comments.createHeaderComment(newline));
27 | editor.setPoint(8 + newline.length());
28 | }
29 | }
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/editor/BrlPartitionScanner.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2006 SchemeWay Project. All rights reserved.
3 | */
4 | package org.schemeway.plugins.schemescript.editor;
5 |
6 | import org.eclipse.jface.text.rules.*;
7 |
8 | /**
9 | * @author SchemeWay Project.
10 | *
11 | */
12 | public class BrlPartitionScanner extends SchemePartitionScanner {
13 |
14 | public BrlPartitionScanner() {
15 | super();
16 | }
17 |
18 | protected Token scanToken() {
19 | if (getPosition() == 0 || lookahead() == ']') {
20 | if (getPosition() != 0)
21 | consume();
22 | return scanBrlString();
23 | }
24 | else
25 | return super.scanToken();
26 | }
27 |
28 | protected boolean endOfDefaultPartition() {
29 | return isEndPosition(getPosition()) || (lookahead() == ']');
30 | }
31 |
32 | private Token scanBrlString() {
33 | while (!isEndPosition(getPosition()) && lookahead() != '[') {
34 | consume();
35 | }
36 | if (lookahead() == '[') {
37 | consume();
38 | }
39 | return SchemePartitionScanner.TOKEN_STRING;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/action/DownSExpAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.action;
7 |
8 | import org.eclipse.jface.text.*;
9 | import org.schemeway.plugins.schemescript.editor.*;
10 | import org.schemeway.plugins.schemescript.parser.*;
11 |
12 | public class DownSExpAction extends SchemeAction {
13 |
14 | public DownSExpAction(SchemeEditor editor) {
15 | super(editor);
16 | setText("Enters the next enclosed S-expression");
17 | setToolTipText("Enters the next enclosed S-expression");
18 | }
19 |
20 | public void run() {
21 | SchemeEditor editor = getSchemeEditor();
22 | if (editor == null) return;
23 |
24 | Region selection = editor.getSelection();
25 |
26 | SexpNavigator explorer = editor.getExplorer();
27 | if (explorer.downSexpression(selection.getOffset()))
28 | editor.setPoint(explorer.getSexpStart());
29 | }
30 |
31 | }
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/editor/ISchemeColorConstants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.editor;
7 |
8 | import org.eclipse.swt.graphics.*;
9 |
10 | public interface ISchemeColorConstants {
11 | RGB SCHEME_PAREN = new RGB(0, 0, 0);
12 | RGB SCHEME_COMMENT = new RGB(0, 128, 0);
13 | RGB SCHEME_CONSTANT = new RGB(92, 0, 0);
14 | RGB SCHEME_DEFINE = new RGB(0, 0, 0);
15 | RGB SCHEME_KEYWORD = new RGB(50, 128, 50);
16 | RGB SCHEME_KEY = new RGB(0, 255, 0);
17 | RGB SCHEME_SPECIAL = new RGB(0, 0, 255);
18 | RGB SCHEME_MUTATOR = new RGB(196, 0, 0);
19 | RGB SCHEME_TYPE = new RGB(128, 0, 128);
20 | RGB SCHEME_ERROR = new RGB(255, 0, 0);
21 | RGB SCHEME_PUNCTUATION = new RGB(0, 0, 0);
22 |
23 | RGB SCHEME_STRING = new RGB(96, 96, 96);
24 | RGB SCHEME_DEFAULT = new RGB(0, 0, 0);
25 |
26 | RGB SCHEME_BACKGROUND = new RGB(255, 255, 255);
27 |
28 | RGB MATCHING_PARENS = new RGB(128, 196, 128);
29 | }
--------------------------------------------------------------------------------
/plugin/tests/indentation-tests.scm:
--------------------------------------------------------------------------------
1 | (define x
2 | ;;
3 | `(foo (foo x)
4 | print
5 | ,x
6 | ,x))
7 |
8 | ;;
9 | ;; asdfasdf
10 |
11 |
12 | (define (foo x . args) ; asdfasdf
13 | ;; sadfa
14 | 'machin)
15 |
16 |
17 | (foo a
18 | b
19 | c)
20 |
21 | (a b
22 | c
23 | d)
24 |
25 |
26 | `(a b c d e
27 | f g h i j)
28 |
29 |
30 | ("abc" "def"
31 | "ghi" "jkl"
32 | "mno" "pqr" "stu"
33 | "vw")
34 |
35 | ((foo)
36 | x y
37 | z)
38 |
39 |
40 | `(,@(a)
41 | ,@(a))
42 |
43 | (begin
44 | code code ; comment
45 | ; comment
46 | code)
47 |
48 | (define print display)
49 |
50 | (not-a-procedure ; a
51 | ; b = right
52 | (print a1
53 | ; c = wrong
54 | a2 ; d
55 | ; e
56 | )
57 | (print
58 | a1
59 | ; f = wrong
60 | ; g = wrong
61 | )
62 | '(not-a-procedure abc
63 | ; h = wrong
64 | def ; i = right
65 | ; j = right
66 | )
67 | )
68 |
69 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/preferences/IndentationSchemeSorter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.preferences;
7 |
8 | import org.eclipse.jface.viewers.*;
9 | import org.schemeway.plugins.schemescript.indentation.*;
10 |
11 | public class IndentationSchemeSorter extends ViewerSorter {
12 | private String mColumn;
13 |
14 | public IndentationSchemeSorter(String columnName) {
15 | mColumn = columnName;
16 | }
17 |
18 | public int compare(Viewer viewer, Object firstElement, Object secondElement) {
19 | IndentationRule firstScheme = (IndentationRule) firstElement;
20 | IndentationRule secondScheme = (IndentationRule) secondElement;
21 |
22 | if (mColumn == IndentationPreferences.ROW_SCHEME) {
23 | return firstScheme.getCategory().compareTo(secondScheme.getCategory());
24 | }
25 | else {
26 | return firstScheme.getSymbol().compareTo(secondScheme.getSymbol());
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/action/RestoreSelectionAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.action;
7 |
8 | import org.eclipse.core.runtime.Assert;
9 | import org.eclipse.jface.action.*;
10 | import org.eclipse.jface.text.*;
11 | import org.schemeway.plugins.schemescript.editor.*;
12 |
13 | public class RestoreSelectionAction extends Action
14 | {
15 | private SchemeEditor mEditor;
16 | private SelectionStack mStack;
17 |
18 | public RestoreSelectionAction(SchemeEditor editor, SelectionStack stack) {
19 | Assert.isNotNull(editor);
20 | setText("Restore the previous selection");
21 | setToolTipText("Restore the previous selection");
22 | mEditor = editor;
23 | mStack = stack;
24 | }
25 |
26 | public void run() {
27 | Region selection = mStack.pop();
28 | if (selection != null) {
29 | mEditor.setSelection(selection.getOffset(), selection.getOffset() + selection.getLength());
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/editor/outline/OutlineNodeContentProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2006 SchemeWay Project. All rights reserved.
3 | */
4 | package org.schemeway.plugins.schemescript.editor.outline;
5 |
6 | import org.eclipse.jface.viewers.*;
7 |
8 | class OutlineNodeContentProvider implements ITreeContentProvider {
9 |
10 | public Object[] getChildren(Object parentElement)
11 | {
12 | if (parentElement != null) {
13 | return ((OutlineNode)parentElement).getChildren();
14 | }
15 | return null;
16 | }
17 | public Object getParent(Object element)
18 | {
19 | return ((OutlineNode)element).parent;
20 | }
21 |
22 | public boolean hasChildren(Object element)
23 | {
24 | return ((OutlineNode)element).children.size() > 0;
25 | }
26 |
27 | public Object[] getElements(Object inputElement)
28 | {
29 | return getChildren(inputElement);
30 | }
31 |
32 | public void dispose()
33 | {
34 | }
35 |
36 | public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
37 | {
38 | }
39 | }
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/editor/BrlDocumentSetupParticipant.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2006 SchemeWay Project. All rights reserved.
3 | */
4 | package org.schemeway.plugins.schemescript.editor;
5 |
6 | import org.eclipse.core.filebuffers.*;
7 | import org.eclipse.jface.text.*;
8 | import org.eclipse.jface.text.rules.*;
9 |
10 | /**
11 | * @author SchemeWay Project.
12 | *
13 | */
14 | public class BrlDocumentSetupParticipant implements IDocumentSetupParticipant {
15 |
16 | public BrlDocumentSetupParticipant() {
17 | }
18 |
19 | public void setup(IDocument document) {
20 | String[] partitions = new String[]
21 | {
22 | SchemePartitionScanner.SCHEME_STRING, SchemePartitionScanner.SCHEME_COMMENT, SchemePartitionScanner.SCHEME_HERESTRING
23 | };
24 |
25 | IDocumentPartitioner partitioner = new FastPartitioner(new BrlPartitionScanner(), partitions);
26 | IDocumentExtension3 documentExtension3 = (IDocumentExtension3) document;
27 | documentExtension3.setDocumentPartitioner(SchemeDocumentSetupParticipant.SCHEME_PARTITIONING, partitioner);
28 | partitioner.connect(document);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/SchemeNature.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2002-2003 Nu Echo Inc. All rights reserved.
3 | */
4 | package org.schemeway.plugins.schemescript;
5 |
6 | import org.eclipse.core.resources.*;
7 | import org.eclipse.core.runtime.*;
8 |
9 | /**
10 | * @author Nu Echo Inc.
11 | */
12 | public class SchemeNature implements IProjectNature
13 | {
14 | private IProject mProject;
15 |
16 | public SchemeNature()
17 | {
18 | System.out.println("test");
19 | }
20 |
21 | public void configure() throws CoreException
22 | {
23 | System.out.println("Toto");
24 | }
25 |
26 | public void deconfigure() throws CoreException
27 | {
28 | }
29 |
30 | public IProject getProject()
31 | {
32 | return mProject;
33 | }
34 |
35 | public void setProject(IProject project)
36 | {
37 | mProject = project;
38 |
39 | try
40 | {
41 | IResource[] resources = project.members();
42 | System.out.println("number of resources = " + resources.length);
43 | }
44 | catch(CoreException exception)
45 | {
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/preferences/IndentationSchemeLabelProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.preferences;
7 |
8 | import org.eclipse.jface.viewers.*;
9 | import org.eclipse.swt.graphics.*;
10 | import org.schemeway.plugins.schemescript.indentation.*;
11 |
12 | public class IndentationSchemeLabelProvider extends LabelProvider implements ITableLabelProvider {
13 |
14 | public Image getColumnImage(Object element, int columnIndex) {
15 | return null;
16 | }
17 |
18 | public String getColumnText(Object element, int columnIndex) {
19 | IndentationRule scheme = (IndentationRule) element;
20 | if (columnIndex == 0)
21 | return scheme.getSymbol();
22 | else
23 | if (columnIndex == 1)
24 | return scheme.getCategory();
25 | else {
26 | if (scheme.getCategory() == IndentationRule.WITH)
27 | return Integer.toString(scheme.getHint());
28 | else
29 | return "";
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/preferences/SchemePreferencePage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.preferences;
7 |
8 | import org.eclipse.jface.preference.*;
9 | import org.eclipse.ui.*;
10 | import org.schemeway.plugins.schemescript.*;
11 |
12 | public abstract class SchemePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
13 |
14 | public SchemePreferencePage() {
15 | super();
16 | }
17 |
18 | public void init(IWorkbench workbench) {
19 | }
20 |
21 | protected IPreferenceStore doGetPreferenceStore() {
22 | return SchemeScriptPlugin.getDefault().getPreferenceStore();
23 | }
24 |
25 | public boolean performOk() {
26 | storeValues();
27 | return true;
28 | }
29 |
30 | public void performDefaults() {
31 | super.performDefaults();
32 |
33 | doPerformDefaults();
34 | }
35 |
36 | protected abstract void storeValues();
37 | protected abstract void doPerformDefaults();
38 | protected abstract void initializeValues();
39 | }
40 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/action/SelectionStack.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.action;
7 |
8 | import java.util.*;
9 |
10 | import org.eclipse.core.runtime.Assert;
11 | import org.eclipse.jface.text.*;
12 |
13 | public class SelectionStack {
14 | private List mStack;
15 |
16 | public SelectionStack() {
17 | mStack = new LinkedList();
18 | }
19 |
20 | public void push(Region selection, Region previousSelection){
21 | Assert.isNotNull(selection);
22 | if (mStack.size() > 0) {
23 | if (previousSelection == null || !previousSelection.equals(mStack.get(0))) {
24 | mStack.clear();
25 | }
26 | }
27 | mStack.add(0, selection);
28 | }
29 |
30 | public Region pop() {
31 | if (mStack.size() > 0) {
32 | Region element = (Region)mStack.get(0);
33 | mStack.remove(0);
34 | return element;
35 | }
36 | return null;
37 | }
38 |
39 | public void clear() {
40 | mStack.clear();
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/editor/SchemeDocumentSetupParticipant.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.editor;
7 |
8 | import org.eclipse.core.filebuffers.*;
9 | import org.eclipse.jface.text.*;
10 | import org.eclipse.jface.text.rules.*;
11 |
12 | public class SchemeDocumentSetupParticipant implements IDocumentSetupParticipant {
13 |
14 | public static final String SCHEME_PARTITIONING = "___scheme_partitioning_";
15 |
16 | public SchemeDocumentSetupParticipant() {
17 | }
18 |
19 | public void setup(IDocument document) {
20 | String[] partitions = new String[]
21 | {
22 | SchemePartitionScanner.SCHEME_STRING, SchemePartitionScanner.SCHEME_COMMENT, SchemePartitionScanner.SCHEME_HERESTRING
23 | };
24 |
25 | IDocumentPartitioner partitioner = new FastPartitioner(new SchemePartitionScanner(), partitions);
26 | IDocumentExtension3 documentExtension3 = (IDocumentExtension3) document;
27 | documentExtension3.setDocumentPartitioner(SCHEME_PARTITIONING, partitioner);
28 | partitioner.connect(document);
29 | }
30 | }
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/action/StartInterpreterAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.action;
7 |
8 | import org.eclipse.jface.action.*;
9 | import org.eclipse.jface.viewers.*;
10 | import org.eclipse.ui.*;
11 | import org.schemeway.plugins.schemescript.*;
12 | import org.schemeway.plugins.schemescript.interpreter.*;
13 |
14 | public class StartInterpreterAction extends Action implements IWorkbenchWindowActionDelegate
15 | {
16 | public StartInterpreterAction()
17 | {
18 | setText("Start the Scheme interpreter");
19 | setToolTipText("Start interpreter");
20 | }
21 |
22 | public void run()
23 | {
24 | Interpreter interp = SchemeScriptPlugin.getDefault().getInterpreter();
25 | if (interp == null)
26 | return;
27 |
28 | interp.start();
29 | }
30 |
31 |
32 | public void dispose() {
33 | }
34 |
35 | public void init(IWorkbenchWindow window) {
36 | }
37 |
38 | public void run(IAction action) {
39 | run();
40 | }
41 |
42 | public void selectionChanged(IAction action, ISelection selection) {
43 | }
44 | }
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/indentation/SchemeIndentationContext.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.indentation;
7 |
8 | import org.schemeway.plugins.schemescript.parser.*;
9 |
10 | public class SchemeIndentationContext {
11 | private SexpNavigator mExplorer;
12 | private SchemeIndentationManager mManager;
13 | private int mOffset;
14 |
15 | public SchemeIndentationContext(SexpNavigator explorer, SchemeIndentationManager manager, int offset) {
16 | this.mExplorer = explorer;
17 | this.mManager = manager;
18 | this.mOffset = offset;
19 | }
20 |
21 | public SexpNavigator getExplorer() {
22 | return mExplorer;
23 | }
24 |
25 | public SchemeIndentationManager getManager() {
26 | return mManager;
27 | }
28 |
29 | public int getOffset() {
30 | return mOffset;
31 | }
32 |
33 | public void setExplorer(SexpNavigator explorer) {
34 | mExplorer = explorer;
35 | }
36 |
37 | public void setManager(SchemeIndentationManager manager) {
38 | mManager = manager;
39 | }
40 |
41 | public void setOffset(int offset) {
42 | mOffset = offset;
43 | }
44 | }
--------------------------------------------------------------------------------
/plugin/build.properties:
--------------------------------------------------------------------------------
1 | bin.includes = plugin.xml,\
2 | COPYING,\
3 | license.html,\
4 | conf/,\
5 | ChangeLog,\
6 | KnownBugs,\
7 | html/,\
8 | toc.xml,\
9 | icons/,\
10 | plugin.properties,\
11 | examples/,\
12 | META-INF/,\
13 | schema/,\
14 | schemescript.jar,\
15 | lib/
16 | src.includes = src/,\
17 | plugin.xml,\
18 | license.html,\
19 | icons/,\
20 | build.properties,\
21 | COPYING,\
22 | .project,\
23 | .classpath,\
24 | conf/,\
25 | ChangeLog,\
26 | KnownBugs,\
27 | html/,\
28 | toc.xml,\
29 | lib/,\
30 | plugin.properties,\
31 | examples/
32 | jars.compile.order = schemescript.jar
33 | bin.excludes = examples/sisc/circles-sisc.scm,\
34 | examples/sisc/circles-sisc.old,\
35 | examples/sisc/scratchpad-sisc.old,\
36 | examples/sisc/scratchpad-sisc.scm,\
37 | examples/sisc/sedna.scm
38 | source.schemescript.jar = src/
39 | output.schemescript.jar = bin/
40 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/action/RestartInterpreterAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.action;
7 |
8 | import org.eclipse.jface.action.*;
9 | import org.eclipse.jface.viewers.*;
10 | import org.eclipse.ui.*;
11 | import org.schemeway.plugins.schemescript.*;
12 | import org.schemeway.plugins.schemescript.interpreter.*;
13 |
14 | public class RestartInterpreterAction extends Action implements IWorkbenchWindowActionDelegate
15 | {
16 | public RestartInterpreterAction()
17 | {
18 | setText("Restart the Scheme interpreter");
19 | setToolTipText("Restart interpreter");
20 | }
21 |
22 | public void run()
23 | {
24 | Interpreter interp = SchemeScriptPlugin.getDefault().getInterpreter();
25 | if (interp == null)
26 | return;
27 |
28 | interp.restart();
29 | interp.showConsole();
30 | }
31 |
32 |
33 | public void dispose() {
34 | }
35 |
36 | public void init(IWorkbenchWindow window) {
37 | }
38 |
39 | public void run(IAction action) {
40 | run();
41 | }
42 |
43 | public void selectionChanged(IAction action, ISelection selection) {
44 | }
45 | }
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/preferences/SchemePreferencesInitializer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2006 SchemeWay Project. All rights reserved.
3 | */
4 | package org.schemeway.plugins.schemescript.preferences;
5 |
6 | import org.eclipse.core.runtime.preferences.*;
7 | import org.eclipse.jface.preference.*;
8 | import org.schemeway.plugins.schemescript.*;
9 | import org.schemeway.plugins.schemescript.parser.*;
10 |
11 | /**
12 | * @author SchemeWay Project.
13 | *
14 | */
15 | public class SchemePreferencesInitializer extends AbstractPreferenceInitializer {
16 |
17 | public void initializeDefaultPreferences() {
18 | IPreferenceStore store = SchemeScriptPlugin.getDefault().getPreferenceStore();
19 |
20 | store.setDefault(SchemeScriptPlugin.INTERNAL_INTERPRETER_PREF, SchemeScriptPlugin.INTERNAL_INTERPRETER_NAME);
21 | SchemePreferences.initializeDefaults(store);
22 | CommentPreferences.initializeDefaults(store);
23 | ColorPreferences.initializeDefaults(store);
24 | SyntaxPreferences.initializeDefaults(store);
25 | IndentationPreferences.initializeDefaults(store);
26 | SchemeLexicalExtensionsPreferences.initializeDefaults(store);
27 | RemoteInterpreterPreferences.initializeDefaults(store);
28 | SchemeScannerUtilities.initializeScanner(store);
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/action/InterruptEvaluationAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.action;
7 |
8 | import org.eclipse.jface.action.*;
9 | import org.eclipse.jface.viewers.*;
10 | import org.eclipse.ui.*;
11 | import org.schemeway.plugins.schemescript.*;
12 | import org.schemeway.plugins.schemescript.interpreter.*;
13 |
14 | public class InterruptEvaluationAction extends Action implements IWorkbenchWindowActionDelegate
15 | {
16 | public InterruptEvaluationAction()
17 | {
18 | setText("Interrupt the Scheme interpreter");
19 | setToolTipText("Interrupt the interpreter");
20 | }
21 |
22 | public void run()
23 | {
24 | Interpreter interp = SchemeScriptPlugin.getDefault().getInterpreter();
25 | if (interp == null)
26 | return;
27 |
28 | interp.interrupt();
29 | interp.showConsole();
30 | }
31 |
32 |
33 | public void dispose() {
34 | }
35 |
36 | public void init(IWorkbenchWindow window) {
37 | }
38 |
39 | public void run(IAction action) {
40 | run();
41 | }
42 |
43 | public void selectionChanged(IAction action, ISelection selection) {
44 | }
45 | }
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/action/SwapSexpAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.action;
7 |
8 | import org.schemeway.plugins.schemescript.editor.*;
9 | import org.schemeway.plugins.schemescript.parser.*;
10 |
11 | public class SwapSexpAction extends SchemeAction {
12 |
13 | public SwapSexpAction(SchemeEditor editor) {
14 | super(editor);
15 | setText("Swaps S-expressions");
16 | setToolTipText("Swaps the S-expressions before and after the cursor");
17 | }
18 |
19 | public void run() {
20 | final SchemeEditor editor = getSchemeEditor();
21 | if (editor == null) return;
22 |
23 | int point = editor.getPoint();
24 | SexpNavigator explorer = editor.getExplorer();
25 | if (explorer.backwardSexpression(point)) {
26 | int previousStart = explorer.getSexpStart();
27 | int previousEnd = explorer.getSexpEnd();
28 | if (explorer.forwardSexpression(point)) {
29 | int nextStart = explorer.getSexpStart();
30 | int nextEnd = explorer.getSexpEnd();
31 | editor.swapText(previousStart, previousEnd - previousStart, nextStart, nextEnd - nextStart);
32 | }
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/action/ExpandSelectionToSexpressions.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005 SchemeWay.com
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.action;
7 |
8 | import org.eclipse.jface.text.*;
9 | import org.schemeway.plugins.schemescript.editor.*;
10 | import org.schemeway.plugins.schemescript.editor.autoedits.*;
11 |
12 | /**
13 | * @author SchemeWay.com
14 | */
15 | public class ExpandSelectionToSexpressions extends SchemeAction {
16 |
17 | public ExpandSelectionToSexpressions(SchemeEditor editor) {
18 | super(editor);
19 | }
20 |
21 | public void run() {
22 | SchemeEditor editor = getSchemeEditor();
23 | if (editor == null)
24 | return;
25 |
26 | IRegion selection = editor.getSelection();
27 | if (selection.getLength() > 1) {
28 | int start = selection.getOffset();
29 | int end = start + selection.getLength();
30 | IRegion expandedSelection = SexpUtils.findEnclosingSexpressions(editor.getDocument(), start, end);
31 | if (expandedSelection != null) {
32 | start = expandedSelection.getOffset();
33 | end = start + expandedSelection.getLength();
34 | editor.setSelection(start, end);
35 | }
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/editor/autoedits/DoubleQuoteInserter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.editor.autoedits;
7 |
8 | import org.eclipse.jface.text.*;
9 |
10 | public class DoubleQuoteInserter implements IAutoEditStrategy {
11 |
12 | public DoubleQuoteInserter() {
13 | }
14 |
15 | public void customizeDocumentCommand(IDocument document, DocumentCommand command) {
16 | try {
17 | if (command.text.equals("\\")) {
18 | if (document.getChar(command.offset) == '"') {
19 | command.text = "\\\\";
20 | command.doit = true;
21 | command.length = 0;
22 | command.shiftsCaret = true;
23 | command.caretOffset = command.offset;
24 | }
25 | }
26 | else if (command.text.equals("\"")) {
27 | if (document.getChar(command.offset) == '"') {
28 | command.doit = true;
29 | command.text = "";
30 | command.length = 0;
31 | command.shiftsCaret = true;
32 | command.caretOffset = command.offset + 1;
33 | }
34 | else {
35 | command.text = "\\\"";
36 | command.doit = true;
37 | command.length = 0;
38 | command.shiftsCaret = true;
39 | command.caretOffset = command.offset;
40 | }
41 | }
42 | } catch (BadLocationException exception) {
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/plugin/conf/user.scm:
--------------------------------------------------------------------------------
1 | ;;;
2 | ;;;; User initialization file
3 | ;;;
4 | ;;
5 | ;; @created "Tue Mar 15 10:17:44 EST 2005"
6 | ;; @author "Dominique Boucher"
7 | ;; @copyright "NuEcho Inc."
8 | ;;
9 |
10 |
11 | ;;;
12 | ;;;; * System initializations
13 | ;;;
14 |
15 | (require 'srfi-1)
16 | (require 'srfi-69)
17 |
18 | ;; -- DO NOT REMOVE THE FOLLOWING LINES --
19 | (load-relative "macros.scm")
20 | (load-relative "util.scm")
21 | (load-relative "plugin.scm")
22 | (load-relative "foreign.scm")
23 | (load-relative "bundles.scm")
24 | (load-relative "constants.scm")
25 | (load-relative "buffer.scm")
26 | (load-relative "commands.scm")
27 | (load-relative "widgets.scm")
28 | (load-relative "dialogs.scm")
29 | (load-relative "namespaces.scm")
30 | (load-relative "modules.scm")
31 | (load-relative "markers.scm")
32 | (load-relative "scratchpad.scm")
33 | (load-relative "reader.scm")
34 | (load-relative "stxmatch.scm")
35 | (load-relative "codewalkers.scm")
36 | (load-relative "forms.scm")
37 | (load-relative "refactoring.scm")
38 | (load-relative "dictionaries.scm")
39 |
40 |
41 |
42 | ;; -- ADD YOUR OWN INITIALIZATIONS HERE
43 | ;;;
44 | ;;;; * User initializations
45 | ;;;
46 |
47 | ;; uncomment the next line to enable Arc support
48 | ;(load-relative "languages/arc.scm")
49 |
50 | ;; uncomment the next line to enable Clojure support
51 | ;(load-relative "languages/clojure.scm")
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/action/CompressSpacesAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.action;
7 |
8 | import org.eclipse.jface.text.*;
9 | import org.schemeway.plugins.schemescript.editor.*;
10 |
11 | public class CompressSpacesAction extends SchemeAction {
12 |
13 | public CompressSpacesAction(SchemeEditor editor) {
14 | super(editor);
15 | setText("Compress spaces");
16 | setToolTipText("Replaces all surrounding whitespaces by a single space");
17 | }
18 |
19 | public void run() {
20 | SchemeEditor editor = getSchemeEditor();
21 | if (editor == null)
22 | return;
23 |
24 | IDocument document = editor.getDocument();
25 | try {
26 | int currentPoint = editor.getPoint();
27 | int docLength = document.getLength();
28 | int start = currentPoint;
29 | int end = currentPoint;
30 | while (start > 0 && Character.isWhitespace(document.getChar(start - 1)))
31 | start--;
32 | while (end < docLength && Character.isWhitespace(document.getChar(end)))
33 | end++;
34 | editor.replaceText(start, end - start, " ");
35 | }
36 | catch (BadLocationException exception)
37 | {
38 | }
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | SchemeScript
2 | ============
3 |
4 | SchemeScript is a Scheme/Lisp editor plug-in for Eclipse.
5 |
6 | The goal of this plug-in is to provide a robust Scheme/Lisp editor to the professional Scheme/Lisp developers who also happen to use Eclipse for Java programming. Also, the plug-in can be subclassed and extended to provide custom editors for Scheme/Lisp-based languages.
7 |
8 | SchemeScript embeds the Kawa and SISC interpreters, and can be readily used to connect to the SISC REPL of SISCweb-based web applications.
9 |
10 | The latest stable release is 1.3.0.rc1.
11 |
12 |
13 | Installation
14 | ------------
15 |
16 | To install the plugin:
17 |
18 | * click on `Help > Install New Software...`
19 | * click on `Add...` and enter the plugin update site location: `http://schemeway.github.io/SchemeScript/update-site`
20 | * select the latest SchemeScript feature
21 | * click `Next` and follow the instructions
22 |
23 | Usage
24 | ------------
25 |
26 | Check our [UserGuide](https://github.com/schemeway/SchemeScript/wiki) in the wiki section of our GitHub repo.
27 |
28 | More usage guidelines to be added, soon.
29 |
30 | Contributing
31 | ------------
32 |
33 | You can contribute by:
34 | * testing the latest version
35 | * creating bug reports
36 | * forking the repository on github and create pull requests.
37 |
38 |
39 | Bug Reports
40 | ------------
41 |
42 | Please file any bug reports in the bug tracker at github:
43 |
44 | https://github.com/schemeway/SchemeScript/issues
45 |
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/indentation/IndentationRule.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.indentation;
7 |
8 | public final class IndentationRule {
9 | public final static String DEFAULT = "default";
10 | public final static String DEFINITION = "definition";
11 | public final static String SEQUENCE = "sequence";
12 | public final static String WITH = "with";
13 | public final static String IF = "if";
14 | public final static String NONE = "none";
15 |
16 | public final static String[] ALL_SCHEMES = new String[] {
17 | DEFAULT, DEFINITION, SEQUENCE, IF, WITH, NONE
18 | };
19 |
20 | private String mSymbol;
21 | private String mCategory;
22 | private int mHint;
23 |
24 | public IndentationRule(String symbol, String category, int hint) {
25 | mSymbol = symbol;
26 | setCategory(category);
27 | setHint(hint);
28 | }
29 |
30 | public String getSymbol() {
31 | return mSymbol;
32 | }
33 |
34 | public String getCategory() {
35 | return mCategory;
36 | }
37 |
38 | public int getHint() {
39 | return mHint;
40 | }
41 |
42 | public final void setCategory(String category) {
43 | mCategory = category;
44 | }
45 |
46 | public final void setHint(int hint) {
47 | mHint = hint;
48 | }
49 | }
--------------------------------------------------------------------------------
/plugin/src/org/schemeway/plugins/schemescript/action/LoadFileAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004 Nu Echo Inc.
3 | *
4 | * This is free software. For terms and warranty disclaimer, see ./COPYING
5 | */
6 | package org.schemeway.plugins.schemescript.action;
7 |
8 | import org.eclipse.ui.*;
9 | import org.eclipse.ui.part.*;
10 | import org.schemeway.plugins.schemescript.*;
11 | import org.schemeway.plugins.schemescript.editor.*;
12 | import org.schemeway.plugins.schemescript.interpreter.*;
13 | import org.schemeway.plugins.schemescript.preferences.*;
14 |
15 | public class LoadFileAction extends SchemeAction {
16 |
17 | public LoadFileAction(SchemeEditor editor) {
18 | super(editor);
19 |
20 | setText("Load File in Interpreter");
21 | setToolTipText("Load file in interpreter");
22 | }
23 |
24 | public void run() {
25 | SchemeEditor editor = getSchemeEditor();
26 | if (editor == null)
27 | return;
28 |
29 | if (InterpreterPreferences.isSaveRequiredBeforeLoad()) {
30 | editor.doSave(null);
31 | }
32 | IEditorInput input = editor.getEditorInput();
33 | if (input instanceof FileEditorInput) {
34 | FileEditorInput fileInput = (FileEditorInput) input;
35 | Interpreter interp = SchemeScriptPlugin.getDefault().getInterpreter();
36 | interp.load(fileInput.getFile());
37 |
38 | try {
39 | PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(
40 | "org.eclipse.ui.console.ConsoleView");
41 | }
42 | catch (PartInitException e) {
43 | }
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/plugin/conf/languages/clojure.scm:
--------------------------------------------------------------------------------
1 | ;;;
2 | ;;;; Clojure-related definitions
3 | ;;;
4 | ;;
5 | ;; @created "Mon Sep 07 21:41:23 EDT 2009"
6 | ;;
7 |
8 | (def-indentation-rule 'def 'definition 0)
9 | (def-indentation-rule 'defn 'definition 0)
10 |
11 |
12 | (def-constant 'nil 'true 'false)
13 | (def-define 'def 'defn)
14 | (def-special 'var 'try 'catch 'throw 'finally 'loop 'recur)
15 |
16 | (define-code-walker '(def)
17 | (lambda (stx resource recurse)
18 | (stx-match stx
19 | ((_ ,var . ,rest)
20 | (when (stx-symbol? var)
21 | (parameterize ((current-dictionary-entry (new-dictionary-entry resource var 'variable (symbol-description var))))
22 | (recurse rest)))))))
23 |
24 | (define-code-walker '(defn)
25 | (lambda (stx resource recurse)
26 | (stx-match stx
27 | ((_ ,name ,args . ,body)
28 | (when (stx-symbol? name)
29 | (let ((proto (cl-prototype (stx-object->datum name) (stx-object->datum args) 'procedure)))
30 | (parameterize ((current-dictionary-entry (new-dictionary-entry resource name 'procedure proto)))
31 | (recurse body))))))))
32 |
33 | (define-code-walker '(defmulti)
34 | (lambda (stx resource recurse)
35 | (stx-match stx
36 | ((_ ,name ,dispatch)
37 | (when (stx-symbol? name)
38 | (let ((proto (cl-prototype (stx-object->datum name) "[]" 'multi-method)))
39 | (parameterize ((current-dictionary-entry (new-dictionary-entry resource name 'procedure proto)))
40 | (recurse body))))))))
41 |
--------------------------------------------------------------------------------
/plugin/conf/util.scm:
--------------------------------------------------------------------------------
1 | ;;;
2 | ;;;; Utility functions
3 | ;;;
4 | ;;
5 | ;; @created "Mon Mar 07 09:11:32 EST 2005"
6 | ;; @author "Dominique Boucher"
7 | ;; @copyright "NuEcho Inc."
8 | ;;
9 |
10 |
11 | (define (array->list (array ::