diff options
author | david_williams | 2004-11-11 08:37:49 +0000 |
---|---|---|
committer | david_williams | 2004-11-11 08:37:49 +0000 |
commit | cfdb2cdab3d25850ead6a1722c31a0ca30e8d885 (patch) | |
tree | 32ca55207a0d43a811a76933a2c2b8ccb6616f13 /bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser | |
parent | 6fdcc7185a155ce3b8eccaed32db98524c3c29f9 (diff) | |
download | webtools.sourceediting-cfdb2cdab3d25850ead6a1722c31a0ca30e8d885.tar.gz webtools.sourceediting-cfdb2cdab3d25850ead6a1722c31a0ca30e8d885.tar.xz webtools.sourceediting-cfdb2cdab3d25850ead6a1722c31a0ca30e8d885.zip |
refresh
Diffstat (limited to 'bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser')
11 files changed, 481 insertions, 0 deletions
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/BlockMarker.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/BlockMarker.java new file mode 100644 index 0000000000..e63adbfa10 --- /dev/null +++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/BlockMarker.java @@ -0,0 +1,107 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Jens Lukowski/Innoopract - initial renaming/restructuring + * + *******************************************************************************/ +package org.eclipse.wst.sse.core.parser; + + + +import org.eclipse.wst.sse.core.text.ITextRegion; + +public class BlockMarker extends TagMarker { + + // allow for JSP expressions within the block + protected boolean fAllowJSP = true; + + protected boolean fCaseSensitive = false; + + // the context for the contents of this tag (BLOCK_TEXT, JSP_CONTENT, + // etc.) + protected String fContext; + + /** + * It's not appropriate to make "empty" BlockMarker, so we'll mark as + * private. + */ + private BlockMarker() { + super(); + } + + public BlockMarker(String tagName, ITextRegion marker, String context) { + this(tagName, marker, context, true); + } + + public BlockMarker(String tagName, ITextRegion marker, String context, boolean caseSensitive) { + this(tagName, marker, context, caseSensitive, true); + } + + public BlockMarker(String tagName, ITextRegion marker, String context, boolean caseSensitive, boolean allowJSP) { + super(tagName, marker); + setContext(context); + setCaseSensitive(caseSensitive); + setAllowJSP(allowJSP); + } + + public BlockMarker(String tagName, String regionContext, boolean caseSensitive) { + this(tagName, null, regionContext, caseSensitive, false); + } + + /** + * Gets the allowJSP. + * + * @return Returns a boolean + */ + public boolean allowsJSP() { + return fAllowJSP; + } + + /** + * Gets the context. + * + * @return Returns a String + */ + public String getContext() { + return fContext; + } + + /** + * + * @return boolean + */ + public final boolean isCaseSensitive() { + return fCaseSensitive; + } + + /** + * Sets the allowJSP. + * + * @param allowJSP + * The allowJSP to set + */ + public void setAllowJSP(boolean allowJSP) { + fAllowJSP = allowJSP; + } + + public final void setCaseSensitive(boolean sensitive) { + fCaseSensitive = sensitive; + } + + /** + * Sets the context. + * + * @param context + * The context to set + */ + public void setContext(String context) { + fContext = context; + } + +} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/BlockTagParser.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/BlockTagParser.java new file mode 100644 index 0000000000..205323fff5 --- /dev/null +++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/BlockTagParser.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Jens Lukowski/Innoopract - initial renaming/restructuring + * + *******************************************************************************/ +package org.eclipse.wst.sse.core.parser; + + + +import java.util.List; + +public interface BlockTagParser { + + void addBlockMarker(BlockMarker marker); + + void beginBlockScan(String tagName); + + BlockMarker getBlockMarker(String tagName); + + List getBlockMarkers(); + + void removeBlockMarker(BlockMarker marker); + + void removeBlockMarker(String tagName); +} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/BlockTokenizer.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/BlockTokenizer.java new file mode 100644 index 0000000000..048f9fe5c6 --- /dev/null +++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/BlockTokenizer.java @@ -0,0 +1,58 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Jens Lukowski/Innoopract - initial renaming/restructuring + * + *******************************************************************************/ +package org.eclipse.wst.sse.core.parser; + + + +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; +import java.util.List; + +import org.eclipse.wst.sse.core.text.ITextRegion; + + +public interface BlockTokenizer { + + void addBlockMarker(BlockMarker marker); + + void beginBlockMarkerScan(String newTagName, String context); + + void beginBlockTagScan(String newTagName); + + List getBlockMarkers(); + + ITextRegion getNextToken() throws IOException; + + int getOffset(); + + boolean isEOF(); + + BlockTokenizer newInstance(); + + void removeBlockMarker(BlockMarker marker); + + void removeBlockMarker(String tagname); + + void reset(char[] charArray); + + void reset(char[] charArray, int newOffset); + + void reset(InputStream in); + + void reset(InputStream in, int newOffset); + + void reset(Reader in); + + void reset(Reader in, int newOffset); +} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/IBlockedStructuredDocumentRegion.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/IBlockedStructuredDocumentRegion.java new file mode 100644 index 0000000000..df2bc6e254 --- /dev/null +++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/IBlockedStructuredDocumentRegion.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Jens Lukowski/Innoopract - initial renaming/restructuring + * + *******************************************************************************/ +package org.eclipse.wst.sse.core.parser; + +import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion; + +/** + * + */ +public interface IBlockedStructuredDocumentRegion extends IStructuredDocumentRegion { + String getPartitionType(); + + void setPartitionType(String partitionType); +} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/JSPCapableParser.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/JSPCapableParser.java new file mode 100644 index 0000000000..048394fe6e --- /dev/null +++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/JSPCapableParser.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Jens Lukowski/Innoopract - initial renaming/restructuring + * + *******************************************************************************/ +package org.eclipse.wst.sse.core.parser; + +import java.util.List; + +public interface JSPCapableParser extends RegionParser, BlockTagParser { + void addNestablePrefix(TagMarker marker); + + /** + * returns the TagMarkers for prefixes that are allowed to be nestable + * + * @return + */ + List getNestablePrefixes(); + + void removeNestablePrefix(String tagName); +} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/RegionParser.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/RegionParser.java new file mode 100644 index 0000000000..935fba19cf --- /dev/null +++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/RegionParser.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Jens Lukowski/Innoopract - initial renaming/restructuring + * + *******************************************************************************/ +package org.eclipse.wst.sse.core.parser; + + + +import java.io.Reader; +import java.util.List; + +import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion; + + +public interface RegionParser { + + IStructuredDocumentRegion getDocumentRegions(); + + List getRegions(); + + /** + * The 'newInstance' method is similar to 'clone', but does not include + * the copying of any content. For a pure RegionParser itself, there would + * be little state to "clone", but for some subtypes, such as + * StructuredDocumentRegionParser and JSPCapableParser, there could the + * more internal data to "clone", such as the internal tokenizer should be + * cloned (including block tags, etc). + */ + RegionParser newInstance(); + + void reset(Reader reader); + + /** + * An additional offset for use with any position-dependant parsing rules + */ + void reset(Reader reader, int offset); + + void reset(String input); + + /** + * An additional offset for use with any position-dependant parsing rules + */ + void reset(String input, int offset); +} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/StructuredDocumentRegionHandler.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/StructuredDocumentRegionHandler.java new file mode 100644 index 0000000000..b9f098ce84 --- /dev/null +++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/StructuredDocumentRegionHandler.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Jens Lukowski/Innoopract - initial renaming/restructuring + * + *******************************************************************************/ +package org.eclipse.wst.sse.core.parser; + + + +import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion; + +public interface StructuredDocumentRegionHandler { + + // Sent when a IStructuredDocumentRegion is first parsed + public void nodeParsed(IStructuredDocumentRegion aCoreStructuredDocumentRegion); + + // Sent when the calling parser's model undergoes a full reset + // and any information based upon the old model should be + // cleared + public void resetNodes(); +} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/StructuredDocumentRegionHandlerExtension.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/StructuredDocumentRegionHandlerExtension.java new file mode 100644 index 0000000000..0e6b9bb423 --- /dev/null +++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/StructuredDocumentRegionHandlerExtension.java @@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Jens Lukowski/Innoopract - initial renaming/restructuring + * + *******************************************************************************/ +package org.eclipse.wst.sse.core.parser; + +import org.eclipse.wst.sse.core.text.IStructuredDocument; + + +public interface StructuredDocumentRegionHandlerExtension extends StructuredDocumentRegionHandler { + void setStructuredDocument(IStructuredDocument newDocument); +} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/StructuredDocumentRegionParser.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/StructuredDocumentRegionParser.java new file mode 100644 index 0000000000..d8e280d37d --- /dev/null +++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/StructuredDocumentRegionParser.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Jens Lukowski/Innoopract - initial renaming/restructuring + * + *******************************************************************************/ +package org.eclipse.wst.sse.core.parser; + + + +public interface StructuredDocumentRegionParser extends RegionParser { + + void addStructuredDocumentRegionHandler(StructuredDocumentRegionHandler handler); + + void removeStructuredDocumentRegionHandler(StructuredDocumentRegionHandler handler); + + void resetHandlers(); +} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/StructuredDocumentRegionParserExtension.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/StructuredDocumentRegionParserExtension.java new file mode 100644 index 0000000000..561b64d061 --- /dev/null +++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/StructuredDocumentRegionParserExtension.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Jens Lukowski/Innoopract - initial renaming/restructuring + * + *******************************************************************************/ +package org.eclipse.wst.sse.core.parser; + +import java.util.List; + + + +public interface StructuredDocumentRegionParserExtension extends StructuredDocumentRegionParser { + /** + * Returns the current list of StructuredDocumentRegionHandlers listening + * to this parser. + * + * @return List - the list of listeners, the list may not be null and each + * element in it must implement StructuredDocumentRegionHandler + */ + List getStructuredDocumentRegionHandlers(); +} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/TagMarker.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/TagMarker.java new file mode 100644 index 0000000000..f5dca4f39d --- /dev/null +++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/parser/TagMarker.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * Copyright (c) 2001, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Jens Lukowski/Innoopract - initial renaming/restructuring + * + *******************************************************************************/ +package org.eclipse.wst.sse.core.parser; + +import org.eclipse.wst.sse.core.text.ITextRegion; + +public class TagMarker { + + // a ITextRegion (meant to be updated with the model) marking the position + // where this tagname becomes effective + protected ITextRegion fMarker = null; + + // the tagname + protected String fTagName = null; + + /** + * + */ + public TagMarker() { + super(); + } + + public TagMarker(String tagname) { + super(); + setTagName(tagname); + } + + public TagMarker(String tagname, ITextRegion marker) { + super(); + setTagName(tagname); + setMarker(marker); + } + + /** + * @return com.ibm.sed.structuredDocument.ITextRegion + */ + public final ITextRegion getMarker() { + return fMarker; + } + + /** + * @return java.lang.String + */ + public final String getTagName() { + return fTagName; + } + + /** + * @return boolean + */ + public boolean isGlobal() { + return fMarker == null; + } + + /** + * @param newMarker + * com.ibm.sed.structuredDocument.ITextRegion + */ + public final void setMarker(ITextRegion newMarker) { + fMarker = newMarker; + } + + /** + * @param newTagname + * java.lang.String + */ + public final void setTagName(String newTagName) { + fTagName = newTagName; + } +} |