Changeset 8a0050b3611b877b0c6c480dc26f48d9afa9c369
- Timestamp:
- 06/29/09 07:26:59 (9 months ago)
- Author:
- mb0 <mb0@…>
- Parents:
- 5c182b6e475d5851c54cdb2117f25af21723b62a
- Children:
- 1060b358e6c4605ad49cda48695fd5e5de4a39b3
- git-committer:
- mb0 <mb0@mb0.org> / 2009-06-29T07:26:59Z+0200
- Message:
-
minor changes (whitespaces, formatting, ..)
- as3 errors are not stable enough to be persisted
- added eclipse ui prefs to ignore problems in generated ast package
- moved templates and includes to org.axdt.as3.imp.parser.inc package/folder
- moved helper ast into lex helper
- Files:
-
- 2 added
- 2 removed
- 17 modified
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
|
r49cbb50
|
r8a0050b
|
|
| 126 | 126 | type="org.eclipse.core.resources.problemmarker"> |
| 127 | 127 | </super> |
| | 128 | <persistent |
| | 129 | value="true"> |
| | 130 | </persistent> |
| 128 | 131 | </extension> |
| 129 | 132 | <extension |
-
|
rae6129d
|
r8a0050b
|
|
| 5 | 5 | -- |
| 6 | 6 | %options package=org.axdt.as3.imp.parser |
| 7 | | %options template=KeywordTemplateF.gi |
| | 7 | %options template=inc/KeywordTemplate.ggg |
| 8 | 8 | |
| 9 | 9 | %Notice |
-
|
r5c182b6
|
r8a0050b
|
|
| 231 | 231 | return errorAction == parser.parse(new int[] { token1, token2 }, 0); |
| 232 | 232 | } |
| | 233 | public static abstract class HelperAst { |
| | 234 | public final int start; |
| | 235 | public final int end; |
| | 236 | |
| | 237 | public HelperAst(HelperAst ast) { |
| | 238 | this(ast.start, ast.end); |
| | 239 | } |
| | 240 | |
| | 241 | public HelperAst(int start, int end) { |
| | 242 | this.start = start; |
| | 243 | this.end = end; |
| | 244 | } |
| | 245 | |
| | 246 | public boolean equals(Object obj) { |
| | 247 | if (null == obj) return false; |
| | 248 | if (this == obj) return true; |
| | 249 | if (obj.getClass().equals(this.getClass())){ |
| | 250 | HelperAst other = (HelperAst) obj; |
| | 251 | return start == other.start |
| | 252 | && end == other.end; |
| | 253 | } |
| | 254 | return super.equals(obj); |
| | 255 | } |
| | 256 | |
| | 257 | public String toString() { |
| | 258 | return "helper ast: "+start+":"+end; |
| | 259 | } |
| | 260 | } |
| 233 | 261 | |
| 234 | 262 | } |
-
|
r5c182b6
|
r8a0050b
|
|
| 9 | 9 | %options single-productions |
| 10 | 10 | %options package=org.axdt.as3.imp.parser |
| 11 | | %options template=LexerTemplate.ggg |
| | 11 | %options template=inc/LexerTemplate.ggg |
| 12 | 12 | %options filter=AS3KWLexer.gi |
| 13 | 13 | |
| … |
… |
|
| 647 | 647 | ./%End |
| 648 | 648 | %Include |
| 649 | | UnicodeLexStream.ggg |
| | 649 | inc/UnicodeLexStream.ggg |
| 650 | 650 | %End |
-
|
r5c182b6
|
r8a0050b
|
|
| 75 | 75 | return key; |
| 76 | 76 | } |
| | 77 | @Override |
| | 78 | public String toString() { |
| | 79 | return "SymbolTable <"+nodeClass.getSimpleName()+">"; |
| | 80 | } |
| 77 | 81 | } |
-
|
rb32f7a4
|
r8a0050b
|
|
| 1 | 1 | package org.axdt.as3.imp.parser.regex; |
| 2 | 2 | |
| 3 | | import org.axdt.as3.imp.parser.HelperAst; |
| | 3 | import org.axdt.as3.imp.parser.AS3LexHelper.HelperAst; |
| 4 | 4 | |
| 5 | 5 | public class RegexAst extends HelperAst { |
-
|
rb32f7a4
|
r8a0050b
|
|
| 12 | 12 | %options single_productions |
| 13 | 13 | %options package=org.axdt.as3.imp.parser.regex |
| 14 | | %options template=LexerTemplate.ggg |
| | 14 | %options template=../inc/LexerTemplate.ggg |
| 15 | 15 | %options ast_type=RegexAst |
| 16 | 16 | |
| … |
… |
|
| 24 | 24 | |
| 25 | 25 | %Include |
| 26 | | ../UnicodeLexStream.ggg |
| | 26 | ../inc/UnicodeLexStream.ggg |
| 27 | 27 | %End |
| 28 | 28 | %Export |
-
|
rb32f7a4
|
r8a0050b
|
|
| 1 | 1 | package org.axdt.as3.imp.parser.xml; |
| 2 | 2 | |
| 3 | | import org.axdt.as3.imp.parser.HelperAst; |
| | 3 | import org.axdt.as3.imp.parser.AS3LexHelper.HelperAst; |
| 4 | 4 | |
| 5 | 5 | public class XmlAst extends HelperAst { |
-
|
rb32f7a4
|
r8a0050b
|
|
| 11 | 11 | %options single_productions |
| 12 | 12 | %options package=org.axdt.as3.imp.parser.xml |
| 13 | | %options template=LexerTemplate.ggg |
| | 13 | %options template=../inc/LexerTemplate.ggg |
| 14 | 14 | %options ast_type=XmlAst |
| 15 | 15 | |
| … |
… |
|
| 23 | 23 | |
| 24 | 24 | %Include |
| 25 | | ../UnicodeLexStream.ggg |
| | 25 | ../inc/UnicodeLexStream.ggg |
| 26 | 26 | %End |
| 27 | 27 | %Export |
| … |
… |
|
| 320 | 320 | |
| 321 | 321 | %Import |
| 322 | | XmlCharSubsets.ggg |
| | 322 | ../inc/XmlCharSubsets.ggg |
| 323 | 323 | %End |
| 324 | 324 | -- |
-
|
r25b5d22
|
r8a0050b
|
|
| 20 | 20 | import org.eclipse.imp.services.base.HoverHelperBase; |
| 21 | 21 | import org.eclipse.jface.text.BadLocationException; |
| | 22 | import org.eclipse.jface.text.source.Annotation; |
| 22 | 23 | import org.eclipse.jface.text.source.ISourceViewer; |
| 23 | 24 | |
| … |
… |
|
| 40 | 41 | // annotations; |
| 41 | 42 | // if that's all we have, then don't bother returning it |
| 42 | | String msg = AnnotationHoverBase.formatAnnotationList(annotations); |
| | 43 | String msg = formatAnnotationList(annotations); |
| 43 | 44 | if (msg != null) { |
| 44 | 45 | return msg; |
| … |
… |
|
| 115 | 116 | } |
| 116 | 117 | |
| | 118 | private String formatAnnotationList(List<Annotation> annotations) { |
| | 119 | if (annotations == null) return null; |
| | 120 | StringBuilder buf = new StringBuilder(); |
| | 121 | boolean first = true; |
| | 122 | String lastMessage = null; |
| | 123 | for (Annotation anno:annotations) { |
| | 124 | String message= anno.getText(); |
| | 125 | if (message == null || message.trim().length() <= 0 || message.equals(lastMessage)) |
| | 126 | continue; |
| | 127 | if (first) { |
| | 128 | first = false; |
| | 129 | } else { |
| | 130 | buf.append("<br/>"); |
| | 131 | } |
| | 132 | buf.append("<p>").append(message).append("</p>"); |
| | 133 | lastMessage = message; |
| | 134 | } |
| | 135 | return buf.length() > 0 ? buf.toString() : null; |
| | 136 | } |
| | 137 | |
| 117 | 138 | public static String getSubstring(IParseController parseController, int start, int end) { |
| 118 | 139 | return new String(((SimpleLPGParseController) parseController).getLexer().getILexStream().getIPrsStream() |
-
|
rb32f7a4
|
r8a0050b
|
|
| 75 | 75 | public Image getImage(Object element) { |
| 76 | 76 | if (element instanceof IFile) { |
| 77 | | // TODO: rewrite to provide more appropriate images |
| 78 | 77 | IFile file = (IFile) element; |
| 79 | 78 | int sev = MarkerUtils.getMaxProblemMarkerSeverity(file, IResource.DEPTH_ONE); |
-
|
rb32f7a4
|
r8a0050b
|
|
| 27 | 27 | } |
| 28 | 28 | |
| | 29 | public void dispose() { |
| | 30 | fModelRoot = null; |
| | 31 | } |
| | 32 | |
| 29 | 33 | private class AS3ModelVisitor extends AbstractVisitor { |
| 30 | 34 | // private StringBuffer fRHSLabel; |
| … |
… |
|
| 37 | 41 | if (n.getParent().getParent() instanceof VariableDefinition) { |
| 38 | 42 | createSubItem(n); |
| 39 | | return true; |
| 40 | 43 | } |
| 41 | 44 | return false; |
| … |
… |
|
| 55 | 58 | public boolean visit(ImportDirective n) { |
| 56 | 59 | createSubItem(n); |
| 57 | | return true; |
| | 60 | return false; |
| 58 | 61 | } |
| 59 | 62 | |
-
|
r2aa064d
|
r8a0050b
|
|
| 109 | 109 | assertTrue(ref instanceof AXType); |
| 110 | 110 | AXType type = (AXType) ref; |
| 111 | | assertEquals(AXEntryType.CLASS,type.getType()); |
| | 111 | assertEquals(AXEntryType.CLASS, type.getType()); |
| 112 | 112 | assertEquals("Array", type.getName()); |
| 113 | 113 | assertSame(type, getFixture().getOrCreateReference()); |
| … |
… |
|
| 119 | 119 | assertTrue(ref instanceof AXMember); |
| 120 | 120 | AXMember member = (AXMember) ref; |
| 121 | | assertEquals(AXEntryType.METHOD,member.getType()); |
| | 121 | assertEquals(AXEntryType.METHOD, member.getType()); |
| 122 | 122 | assertEquals("toString", member.getName()); |
| 123 | 123 | assertSame(member, entry.getOrCreateReference()); |
-
|
r2aa064d
|
r8a0050b
|
|
| 7 | 7 | package org.axdt.axdoc.model; |
| 8 | 8 | |
| | 9 | import junit.textui.TestRunner; |
| | 10 | |
| 9 | 11 | import org.axdt.axdoc.model.util.AXUtil; |
| 10 | | |
| 11 | | import junit.textui.TestRunner; |
| 12 | 12 | |
| 13 | 13 | /** |
-
|
r87f02d1
|
r8a0050b
|
|
| 62 | 62 | public InputSource getInputSource(String location) throws IOException { |
| 63 | 63 | URLConnection connection = new URL(location).openConnection(); |
| 64 | | connection.setUseCaches(true); |
| 65 | 64 | return new InputSource(connection.getInputStream()); |
| 66 | 65 | } |
-
|
rfc56e42
|
r8a0050b
|
|
| 3 | 3 | bin.includes = META-INF/,\ |
| 4 | 4 | .,\ |
| 5 | | epl-v10.html |
| | 5 | license.txt |
-
|
r9557fe2
|
r8a0050b
|
|
| 72 | 72 | createEditorPage(); |
| 73 | 73 | createDesignPage(); |
| 74 | | // TODO add preview page to Mxml Designer |
| 75 | 74 | } |
| 76 | 75 | |