Updated Branches: refs/heads/develop e3a75ce56 -> 6b9c7bfd0
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7dd6fade/compiler/src/org/apache/flex/compiler/mxml/MXMLTagAttributeData.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/mxml/MXMLTagAttributeData.java b/compiler/src/org/apache/flex/compiler/mxml/MXMLTagAttributeData.java index 9b197b0..4176d91 100644 --- a/compiler/src/org/apache/flex/compiler/mxml/MXMLTagAttributeData.java +++ b/compiler/src/org/apache/flex/compiler/mxml/MXMLTagAttributeData.java @@ -1,20 +1,15 @@ /* - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + * or agreed to in writing, software distributed under the License is + * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. */ package org.apache.flex.compiler.mxml; @@ -40,7 +35,8 @@ import org.apache.flex.compiler.problems.SyntaxProblem; /** * Encapsulation of a tag attribute in MXML */ -public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttributeData +public class MXMLTagAttributeData extends SourceLocation implements + IMXMLTagAttributeData { /** * Constructor. @@ -62,12 +58,12 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr } MXMLToken token = null; - + // Look for "=" token if (tokenIterator.hasNext()) { token = tokenIterator.next(); - + if (token.getType() != MXMLTokenTypes.TOKEN_EQUALS) { problems.add(new SyntaxProblem(token)); @@ -77,12 +73,12 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr tokenIterator.previous(); return; } - + valueStart = token.getEnd() + 1; //set the attributes start to right after the equals until we have a value valueLine = token.getLine(); valueColumn = token.getColumn(); } - + // Look for value token ArrayList<IMXMLTagAttributeValue> values = new ArrayList<IMXMLTagAttributeValue>(3); while (tokenIterator.hasNext()) @@ -116,9 +112,9 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr break; } } - + this.values = values.toArray(new MXMLTagAttributeValue[0]); - + if (this.values.length > 0) { //set the start value @@ -175,7 +171,7 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr * The URI specified by this attribute's prefix. */ protected String uri; - + // // Object overrides. // @@ -188,13 +184,14 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr buildAttributeString(false); return sb.toString(); } - + /** - * For unit tests only. + * For unit tests only. * * @return name value and offsets in string form */ - public String buildAttributeString(boolean skipSrcPath) { + public String buildAttributeString(boolean skipSrcPath) + { StringBuilder sb = new StringBuilder(); sb.append(getName()); sb.append('='); @@ -205,13 +202,13 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr sb.append(' '); // Display line, column, start, and end as "17:5 160-188". - if(skipSrcPath) + if (skipSrcPath) sb.append(getOffsetsString()); else sb.append(super.toString()); return sb.toString(); } - + // // Other methods // @@ -245,7 +242,7 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr setStart(getAbsoluteStart() + offsetAdjustment); setEnd(getAbsoluteEnd() + offsetAdjustment); } - + if (hasValue()) { valueStart += offsetAdjustment; @@ -255,7 +252,7 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr ((MXMLTagAttributeValue)values[i]).setEnd(values[i].getAbsoluteEnd() + offsetAdjustment); } } - + if (stateName != null) stateStart += offsetAdjustment; } @@ -302,7 +299,7 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr public String getValueWithQuotes() { StringBuilder value = new StringBuilder(); - + final int size = values.length; IMXMLTagAttributeValue lastData = null; for (int i = 0; i < size; i++) @@ -317,7 +314,7 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr } value.append(data.getContent()); } - + return value.toString(); } @@ -325,7 +322,7 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr public String getRawValue() { String value = getValueWithQuotes(); - + if (value != null && value.length() > 0) { // length can be one in case of invalid data and then the substring() call fails @@ -335,7 +332,7 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr else value = value.substring(1); } - + return value; } @@ -364,8 +361,7 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr String value = getRawValue(); if (value != null) { - return new MXMLToken(MXMLTokenTypes.TOKEN_STRING, - getValueStart() + 1, getValueStart() + 1 + value.length(), -1, -1, value); + return new MXMLToken(MXMLTokenTypes.TOKEN_STRING, getValueStart() + 1, getValueStart() + 1 + value.length(), -1, -1, value); } } return null; @@ -423,13 +419,13 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr if (hasValue()) { String lastContent = values[values.length - 1].getContent(); - + if (lastContent.charAt(0) == lastContent.charAt(lastContent.length() - 1)) return getValueStart() + lastContent.length() - 2; - + return getValueStart() + lastContent.length(); } - + // If there is no valid "end", then we must return -1. Callers depend on this. // See MXMLTagData.findArttributeContainingOffset for an example return -1; @@ -450,8 +446,7 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr @Override public SourceLocation getValueLocation() { - return new SourceLocation(getSourcePath(), getValueStart(), getValueEnd(), - getValueLine(), getValueColumn()); + return new SourceLocation(getSourcePath(), getValueStart(), getValueEnd(), getValueLine(), getValueColumn()); } /** @@ -491,7 +486,7 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr String lastContent = values[values.length - 1].getContent(); return (lastContent.charAt(0) == lastContent.charAt(lastContent.length() - 1)); } - + return false; } @@ -519,7 +514,7 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr { if (attributeName != null) return MXMLData.contains(getNameStart(), getNameEnd(), offset); - + return false; } @@ -527,7 +522,7 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr { if (stateName != null) return MXMLData.contains(getStateStart(), getStateEnd(), offset); - + return false; } @@ -541,7 +536,7 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr { if (hasValue()) return MXMLData.contains(getValueStart() - 1, getValueEnd(), offset); - + return false; } @@ -576,9 +571,9 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr String prefix = getPrefix(); if (prefix == null) return null; - + IMXMLTagData lookingAt = parent; - + // For attributes with prefix, parent's parent can be null if // parent is the root tag while (lookingAt != null && lookingAt.getParent() != null) @@ -589,11 +584,11 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr uri = depth.getNamespaceForPrefix(prefix); break; } - + lookingAt = lookingAt.getParentTag(); } } - + return uri; } @@ -613,8 +608,7 @@ public class MXMLTagAttributeData extends SourceLocation implements IMXMLTagAttr { String languageURI = getMXMLDialect().getLanguageNamespace(); - return getName().equals(name) && - (getPrefix() == null || getURI() == languageURI); + return getName().equals(name) && (getPrefix() == null || getURI() == languageURI); } /** http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7dd6fade/compiler/src/org/apache/flex/compiler/mxml/MXMLTagAttributeValue.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/mxml/MXMLTagAttributeValue.java b/compiler/src/org/apache/flex/compiler/mxml/MXMLTagAttributeValue.java index 94b7fe3..82bb573 100644 --- a/compiler/src/org/apache/flex/compiler/mxml/MXMLTagAttributeValue.java +++ b/compiler/src/org/apache/flex/compiler/mxml/MXMLTagAttributeValue.java @@ -1,27 +1,23 @@ /* - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + * or agreed to in writing, software distributed under the License is + * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. */ package org.apache.flex.compiler.mxml; import org.apache.flex.compiler.common.SourceLocation; -public abstract class MXMLTagAttributeValue extends SourceLocation implements IMXMLTagAttributeValue +public abstract class MXMLTagAttributeValue extends SourceLocation implements + IMXMLTagAttributeValue { /** * Constructor. @@ -29,7 +25,7 @@ public abstract class MXMLTagAttributeValue extends SourceLocation implements IM public MXMLTagAttributeValue(IMXMLTagAttributeData parent) { this.parent = parent; - + if (parent != null) setSourcePath(parent.getSourcePath()); } @@ -42,7 +38,7 @@ public abstract class MXMLTagAttributeValue extends SourceLocation implements IM // // Other methods // - + public IMXMLTagAttributeData getContainingAttribute() { return parent; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7dd6fade/compiler/src/org/apache/flex/compiler/mxml/MXMLTagBlobData.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/mxml/MXMLTagBlobData.java b/compiler/src/org/apache/flex/compiler/mxml/MXMLTagBlobData.java index 4b4e23e..1ee9e0b 100644 --- a/compiler/src/org/apache/flex/compiler/mxml/MXMLTagBlobData.java +++ b/compiler/src/org/apache/flex/compiler/mxml/MXMLTagBlobData.java @@ -1,20 +1,15 @@ /* - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + * or agreed to in writing, software distributed under the License is + * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. */ package org.apache.flex.compiler.mxml; @@ -44,7 +39,7 @@ public class MXMLTagBlobData extends MXMLUnitData implements IMXMLTagBlobData pos++; } name = text.substring(1, pos - 1); - + setStart(token.getStart()); setEnd(token.getEnd()); setLine(token.getLine()); @@ -52,7 +47,7 @@ public class MXMLTagBlobData extends MXMLUnitData implements IMXMLTagBlobData } private String name; - + // // IMXMLTagBlobData implementations // http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7dd6fade/compiler/src/org/apache/flex/compiler/mxml/MXMLTagData.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/mxml/MXMLTagData.java b/compiler/src/org/apache/flex/compiler/mxml/MXMLTagData.java index a764c4e..f557471 100644 --- a/compiler/src/org/apache/flex/compiler/mxml/MXMLTagData.java +++ b/compiler/src/org/apache/flex/compiler/mxml/MXMLTagData.java @@ -1,20 +1,15 @@ /* - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + * or agreed to in writing, software distributed under the License is + * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. */ package org.apache.flex.compiler.mxml; @@ -93,9 +88,9 @@ public class MXMLTagData extends MXMLUnitData implements IMXMLTagData * The URI specified by this tag's prefix. */ protected String uri; - + protected String stateName; - + /** * In-order list of MXML attributes */ @@ -105,7 +100,7 @@ public class MXMLTagData extends MXMLUnitData implements IMXMLTagData * Map of attribute name to MXML attribute */ protected Map<String, IMXMLTagAttributeData> attributeMap; - + /* * offset where the tag name starts Note that we also use the for * offsetContains(), as it is the first "real" character in the tag @@ -125,7 +120,7 @@ public class MXMLTagData extends MXMLUnitData implements IMXMLTagData protected IMXMLToken commentToken; protected int stateStart; - + /** * Start of the attribute list (after the tag name + whitespace) */ @@ -287,10 +282,7 @@ public class MXMLTagData extends MXMLUnitData implements IMXMLTagData if (next != null) { // extend the end, but not the content end - setTagOffsets(getAbsoluteStart() == -1 ? next.getStart() : getAbsoluteStart(), - getAbsoluteEnd() == -1 ? next.getStart() : getAbsoluteEnd(), - nameStart == -1 ? next.getStart() : nameStart, - contentEnd == -1 ? next.getStart() : contentEnd); + setTagOffsets(getAbsoluteStart() == -1 ? next.getStart() : getAbsoluteStart(), getAbsoluteEnd() == -1 ? next.getStart() : getAbsoluteEnd(), nameStart == -1 ? next.getStart() : nameStart, contentEnd == -1 ? next.getStart() : contentEnd); tokenIterator.previous(); } } @@ -347,9 +339,7 @@ public class MXMLTagData extends MXMLUnitData implements IMXMLTagData private void setTagOffsets(int start, int end, int contentStart, int contentEnd) { - assert (start <= contentStart) && - ((contentStart <= contentEnd) || contentEnd == -1) - && ((contentEnd <= end) || (end == -1)); + assert (start <= contentStart) && ((contentStart <= contentEnd) || contentEnd == -1) && ((contentEnd <= end) || (end == -1)); setOffsets(start, end); nameStart = contentStart; @@ -405,7 +395,6 @@ public class MXMLTagData extends MXMLUnitData implements IMXMLTagData } } - @Override public boolean isTag() { @@ -713,8 +702,7 @@ public class MXMLTagData extends MXMLUnitData implements IMXMLTagData */ public boolean isOffsetInsideContents(int offset) { - return MXMLData.contains(getContentStart(), - getContentEnd(), // was getContentsEnd (plural) + return MXMLData.contains(getContentStart(), getContentEnd(), // was getContentsEnd (plural) offset); } @@ -1000,7 +988,8 @@ public class MXMLTagData extends MXMLUnitData implements IMXMLTagData /** * Get the start tags for all children of this tag. * - * @param includeEmptyTags <code>true</code> if empty tags should be included. + * @param includeEmptyTags <code>true</code> if empty tags should be + * included. * @return Array of children. */ public IMXMLTagData[] getChildren(boolean includeEmptyTags) @@ -1117,9 +1106,10 @@ public class MXMLTagData extends MXMLUnitData implements IMXMLTagData { return buildDumpString(false); } - + @Override - public String buildDumpString(boolean skipSrcPath) { + public String buildDumpString(boolean skipSrcPath) + { StringBuilder sb = new StringBuilder(); sb.append(super.buildDumpString(skipSrcPath)); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7dd6fade/compiler/src/org/apache/flex/compiler/mxml/MXMLTextData.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/mxml/MXMLTextData.java b/compiler/src/org/apache/flex/compiler/mxml/MXMLTextData.java index 7ee64e5..e0c84bf 100644 --- a/compiler/src/org/apache/flex/compiler/mxml/MXMLTextData.java +++ b/compiler/src/org/apache/flex/compiler/mxml/MXMLTextData.java @@ -1,20 +1,15 @@ /* - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + * or agreed to in writing, software distributed under the License is + * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. */ package org.apache.flex.compiler.mxml; @@ -43,11 +38,11 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData MXMLTextData(MXMLToken textToken) { text = textToken.getText(); - + setOffsets(textToken.getStart(), textToken.getEnd()); setLine(textToken.getLine()); setColumn(textToken.getColumn()); - + switch (textToken.getType()) { case MXMLTokenTypes.TOKEN_TEXT: @@ -87,13 +82,13 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData * The represented text */ private String text; - + private TextType type; - + // // Object overrides // - + // For debugging only. This format is nice in the Eclipse debugger. @Override public String toString() @@ -117,7 +112,7 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData return sb.toString(); } - + // // MXMLUnitData overrides // @@ -127,7 +122,7 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData { return true; } - + // For debugging only. @Override public String getTypeString() @@ -140,7 +135,7 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData return sb.toString(); } - + // For debugging only. This format is nice in a text file. @Override public String toDumpString() @@ -167,7 +162,7 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData { return text; } - + @Override public TextType getTextType() { @@ -224,7 +219,7 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData { return getContentsEnd(); } - + @Override public int getCompilableTextLine() { @@ -246,15 +241,14 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData public String getContents() { String tokenString = text; - + switch (type) { case CDATA: { if (tokenString.endsWith(cDataEnd)) { - tokenString = tokenString.substring( - cDataStart.length(), tokenString.length() - cDataEnd.length()); + tokenString = tokenString.substring(cDataStart.length(), tokenString.length() - cDataEnd.length()); } else { @@ -266,8 +260,7 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData { if (tokenString.endsWith(asDocEnd)) { - tokenString = tokenString.substring( - asDocStart.length(), tokenString.length() - asDocEnd.length()); + tokenString = tokenString.substring(asDocStart.length(), tokenString.length() - asDocEnd.length()); } else { @@ -279,8 +272,7 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData { if (tokenString.endsWith(commentEnd)) { - tokenString = tokenString.substring( - commentStart.length(), tokenString.length() - commentEnd.length()); + tokenString = tokenString.substring(commentStart.length(), tokenString.length() - commentEnd.length()); } else { @@ -306,17 +298,17 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData { case CDATA: return getAbsoluteStart() + cDataStart.length(); - + case ASDOC: return getAbsoluteStart() + asDocStart.length(); - + case COMMENT: return getAbsoluteStart() + commentStart.length(); - + case OTHER: return getAbsoluteStart(); } - + return getAbsoluteStart(); } @@ -329,17 +321,17 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData { case CDATA: return text.endsWith(cDataEnd) ? getAbsoluteEnd() - cDataEnd.length() : getAbsoluteEnd(); - + case ASDOC: return text.endsWith(asDocEnd) ? getAbsoluteEnd() - asDocEnd.length() : getAbsoluteEnd(); - + case COMMENT: return text.endsWith(commentEnd) ? getAbsoluteEnd() - commentEnd.length() : getAbsoluteEnd(); - + case OTHER: return getAbsoluteEnd(); } - + return getAbsoluteEnd(); } @@ -354,17 +346,17 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData { case CDATA: return getColumn() + cDataStart.length(); - + case ASDOC: return getColumn() + asDocStart.length(); - + case COMMENT: return getColumn() + commentStart.length(); - + case OTHER: return getColumn(); } - + return getColumn(); } @@ -393,8 +385,7 @@ public class MXMLTextData extends MXMLUnitData implements IMXMLTextData case CDATA: { // CDATA creates only a single fragment. - ISourceFragment fragment = new SourceFragment(text, getContents(), - getContentsStart(), getContentsLine(), getContentsColumn()); + ISourceFragment fragment = new SourceFragment(text, getContents(), getContentsStart(), getContentsLine(), getContentsColumn()); return new ISourceFragment[] {fragment}; } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7dd6fade/compiler/src/org/apache/flex/compiler/mxml/MXMLTextValue.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/mxml/MXMLTextValue.java b/compiler/src/org/apache/flex/compiler/mxml/MXMLTextValue.java index ffc11ab..7382f0b 100644 --- a/compiler/src/org/apache/flex/compiler/mxml/MXMLTextValue.java +++ b/compiler/src/org/apache/flex/compiler/mxml/MXMLTextValue.java @@ -1,20 +1,15 @@ /* - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + * or agreed to in writing, software distributed under the License is + * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. */ package org.apache.flex.compiler.mxml; @@ -22,7 +17,8 @@ package org.apache.flex.compiler.mxml; import org.apache.flex.compiler.internal.parsing.mxml.MXMLToken; import org.apache.flex.compiler.mxml.IMXMLTextData.TextType; -public class MXMLTextValue extends MXMLTagAttributeValue implements IMXMLTextValue +public class MXMLTextValue extends MXMLTagAttributeValue implements + IMXMLTextValue { /** * Constructor. http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7dd6fade/compiler/src/org/apache/flex/compiler/mxml/MXMLUnitData.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/mxml/MXMLUnitData.java b/compiler/src/org/apache/flex/compiler/mxml/MXMLUnitData.java index dfd0af6..3ad17b8 100644 --- a/compiler/src/org/apache/flex/compiler/mxml/MXMLUnitData.java +++ b/compiler/src/org/apache/flex/compiler/mxml/MXMLUnitData.java @@ -1,20 +1,15 @@ /* - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + * or agreed to in writing, software distributed under the License is + * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. */ package org.apache.flex.compiler.mxml; @@ -29,10 +24,11 @@ import org.apache.flex.utils.FastStack; * Encapsulation of an MXML unit: an open/close/empty tag, a chunk of text * (perhaps whitespace, CDATA, or a comment), or a processing instruction. * <p> - * An {@link MXMLData} object stores a linear list of MXML units, - * but it is possible to walk them in a hierarchical way. + * An {@link MXMLData} object stores a linear list of MXML units, but it is + * possible to walk them in a hierarchical way. */ -public abstract class MXMLUnitData extends SourceLocation implements IMXMLUnitData +public abstract class MXMLUnitData extends SourceLocation implements + IMXMLUnitData { /** * Constructor. @@ -40,7 +36,7 @@ public abstract class MXMLUnitData extends SourceLocation implements IMXMLUnitDa public MXMLUnitData() { super(); - + parent = null; index = -1; } @@ -58,16 +54,16 @@ public abstract class MXMLUnitData extends SourceLocation implements IMXMLUnitDa * The {@link MXMLData} object that owns this unit. */ private MXMLData parent; - + /** - * This position of this unit in the linear list of units - * owned by the {@link MXMLData}. + * This position of this unit in the linear list of units owned by the + * {@link MXMLData}. */ protected int index; - + /** - * The position of this unit's parent unit in the linear list of units - * owned by the {@link MXMLData}. + * The position of this unit's parent unit in the linear list of units owned + * by the {@link MXMLData}. */ private int parentIndex; @@ -214,7 +210,7 @@ public abstract class MXMLUnitData extends SourceLocation implements IMXMLUnitDa if (isOpenAndNotEmptyTag()) unit = ((IMXMLTagData)unit).findMatchingEndTag(); - + if (unit != null) { unit = unit.getNext(); @@ -229,15 +225,15 @@ public abstract class MXMLUnitData extends SourceLocation implements IMXMLUnitDa public final IMXMLTagData getNextTag() { IMXMLUnitData nextUnit = getNext(); - + while (true) { if (nextUnit == null) return null; - + if (nextUnit.isTag()) return (IMXMLTagData)nextUnit; - + nextUnit = nextUnit.getNext(); } } @@ -254,19 +250,19 @@ public abstract class MXMLUnitData extends SourceLocation implements IMXMLUnitDa FastStack<String> tagNames = new FastStack<String>(); IMXMLUnitData current = getPrevious(); IMXMLTagData containingTag = null; - + if (containsOffset(offset) && isCloseTag()) { IMXMLTagData tag = (IMXMLTagData)this; tagNames.push(tag.getName()); } - + while (current != null && containingTag == null) { if (current.isTag()) { IMXMLTagData currentTag = (IMXMLTagData)current; - + if (currentTag.isCloseTag()) { tagNames.push(currentTag.getName()); @@ -282,10 +278,10 @@ public abstract class MXMLUnitData extends SourceLocation implements IMXMLUnitDa containingTag = currentTag; } } - + current = current.getPrevious(); } - + return containingTag; } @@ -305,10 +301,11 @@ public abstract class MXMLUnitData extends SourceLocation implements IMXMLUnitDa */ public String toDumpString() { - return buildDumpString(false); + return buildDumpString(false); } - - public String buildDumpString(boolean skipSrcPath) { + + public String buildDumpString(boolean skipSrcPath) + { StringBuilder sb = new StringBuilder(); sb.append('['); @@ -316,7 +313,8 @@ public abstract class MXMLUnitData extends SourceLocation implements IMXMLUnitDa sb.append(']'); sb.append('\t'); - if(!skipSrcPath) { + if (!skipSrcPath) + { sb.append(getLine() + 1); sb.append('\t'); sb.append(getColumn() + 1); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7dd6fade/compiler/src/org/apache/flex/compiler/mxml/StateDefinition.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/mxml/StateDefinition.java b/compiler/src/org/apache/flex/compiler/mxml/StateDefinition.java index 34f1ab7..45abfd0 100644 --- a/compiler/src/org/apache/flex/compiler/mxml/StateDefinition.java +++ b/compiler/src/org/apache/flex/compiler/mxml/StateDefinition.java @@ -1,20 +1,15 @@ /* - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + * or agreed to in writing, software distributed under the License is + * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. */ package org.apache.flex.compiler.mxml; @@ -26,45 +21,42 @@ import org.apache.flex.compiler.scopes.IASScope; import org.apache.flex.compiler.tree.mxml.IMXMLStateNode; /** - * {@code StateDefinition} represents a state in MXML 2009 or later. - * States are per-class, so these objects are owned - * by the {@code ClassDefinitionNodes} that define classes in MXML. + * {@code StateDefinition} represents a state in MXML 2009 or later. States are + * per-class, so these objects are owned by the {@code ClassDefinitionNodes} + * that define classes in MXML. */ -public class StateDefinition extends StateDefinitionBase implements IStateDefinition +public class StateDefinition extends StateDefinitionBase implements + IStateDefinition { private IMXMLStateNode node; - + /** * Constructor. */ - public StateDefinition(IMXMLStateNode node, IASScope containingScope, - String name, int nameStart, int nameEnd) + public StateDefinition(IMXMLStateNode node, IASScope containingScope, String name, int nameStart, int nameEnd) { super(name, node.getClassDefinitionNode().getDefinition(), containingScope, nameStart, nameEnd); this.node = node; } - + /** - * A map mapping group names to {@code IStateGroup} objects. - * This is effectively the set of groups that include this state, - * but we use a map because we're interested in this set - * both as a set of group names (the String keys) - * and a set of group objects (the {@code IStateGroup} values). + * A map mapping group names to {@code IStateGroup} objects. This is + * effectively the set of groups that include this state, but we use a map + * because we're interested in this set both as a set of group names (the + * String keys) and a set of group objects (the {@code IStateGroup} values). */ private Map<String, IStateGroupDefinition> groupMap; - + @Override public IMXMLStateNode getNode() { return node; } - + @Override public String[] getStateGroups() { - return groupMap != null ? - groupMap.keySet().toArray(new String[0]) : - new String[0]; + return groupMap != null ? groupMap.keySet().toArray(new String[0]) : new String[0]; } @Override @@ -78,7 +70,7 @@ public class StateDefinition extends StateDefinitionBase implements IStateDefini { return groupMap.containsKey(group); } - + /** * Records that this state belongs to a specified group. * http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7dd6fade/compiler/src/org/apache/flex/compiler/mxml/StateDefinitionBase.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/mxml/StateDefinitionBase.java b/compiler/src/org/apache/flex/compiler/mxml/StateDefinitionBase.java index 8279ee8..94d6f54 100644 --- a/compiler/src/org/apache/flex/compiler/mxml/StateDefinitionBase.java +++ b/compiler/src/org/apache/flex/compiler/mxml/StateDefinitionBase.java @@ -1,20 +1,15 @@ /* - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + * or agreed to in writing, software distributed under the License is + * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. */ package org.apache.flex.compiler.mxml; @@ -24,11 +19,12 @@ import org.apache.flex.compiler.internal.definitions.DefinitionBase; import org.apache.flex.compiler.scopes.IASScope; /** - * {@code StateDefinitionBase} is an abstract base class - * for {@code StateDefinition} and {@code StateGroupDefinition}, - * which represent states and state groups in MXML 2009 and later. + * {@code StateDefinitionBase} is an abstract base class for + * {@code StateDefinition} and {@code StateGroupDefinition}, which represent + * states and state groups in MXML 2009 and later. */ -public abstract class StateDefinitionBase extends DefinitionBase implements IStateDefinitionBase +public abstract class StateDefinitionBase extends DefinitionBase implements + IStateDefinitionBase { /** * Constructor. @@ -40,20 +36,21 @@ public abstract class StateDefinitionBase extends DefinitionBase implements ISta setNameLocation(nameStart, nameEnd); setContainingScope(containingScope); } - + private final IClassDefinition containingClass; - + @Override - public boolean isImplicit() { + public boolean isImplicit() + { return true; //this node will always be implicit, even though it will have offsets } - + @Override public int compareTo(IStateDefinitionBase other) { - return getNameStart()- other.getNameStart(); + return getNameStart() - other.getNameStart(); } - + /** * For debugging only. */ @@ -62,7 +59,7 @@ public abstract class StateDefinitionBase extends DefinitionBase implements ISta { return getBaseName(); } - + @Override public IClassDefinition getContainingClass() { http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7dd6fade/compiler/src/org/apache/flex/compiler/mxml/StateGroupDefinition.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/mxml/StateGroupDefinition.java b/compiler/src/org/apache/flex/compiler/mxml/StateGroupDefinition.java index b52e8ac..d5894bc 100644 --- a/compiler/src/org/apache/flex/compiler/mxml/StateGroupDefinition.java +++ b/compiler/src/org/apache/flex/compiler/mxml/StateGroupDefinition.java @@ -1,20 +1,15 @@ /* - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + * or agreed to in writing, software distributed under the License is + * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. */ package org.apache.flex.compiler.mxml; @@ -27,7 +22,8 @@ import org.apache.flex.compiler.definitions.IClassDefinition; /** * {@code StateGroupDefinition} represents a state group in an MXML class. */ -public class StateGroupDefinition extends StateDefinitionBase implements IStateGroupDefinition +public class StateGroupDefinition extends StateDefinitionBase implements + IStateGroupDefinition { /** * Constructor. @@ -35,15 +31,15 @@ public class StateGroupDefinition extends StateDefinitionBase implements IStateG public StateGroupDefinition(String name, IClassDefinition containingClass) { super(name, containingClass, containingClass.getContainedScope(), -1, -1); - + } - + /** - * A map mapping state names to {@code IStateDefinition} objects. - * This is effectively the set of states included in this group, - * but we use a map because we're interested in this set - * both as a set of state names (the String keys) - * and a set of state objects (the {@code IStateDefinition} values). + * A map mapping state names to {@code IStateDefinition} objects. This is + * effectively the set of states included in this group, but we use a map + * because we're interested in this set both as a set of state names (the + * String keys) and a set of state objects (the {@code IStateDefinition} + * values). */ private Map<String, IStateDefinition> stateMap; @@ -64,7 +60,7 @@ public class StateGroupDefinition extends StateDefinitionBase implements IStateG { return stateMap.containsKey(state); } - + /** * Records that this group includes a specified state. * @@ -74,7 +70,7 @@ public class StateGroupDefinition extends StateDefinitionBase implements IStateG { if (stateMap == null) stateMap = new HashMap<String, IStateDefinition>(0); - + stateMap.put(state.getBaseName(), state); }
