Index: modules/antTasks/src/flex/ant/config/NestedAttributeElement.java =================================================================== --- modules/antTasks/src/flex/ant/config/NestedAttributeElement.java (revision 3507) +++ modules/antTasks/src/flex/ant/config/NestedAttributeElement.java (working copy) @@ -93,7 +93,7 @@ } else { - StringBuffer stringBuffer = new StringBuffer(); + StringBuilder stringBuffer = new StringBuilder(); for (int i = 0; i < attribs.length; i++) { Index: modules/antTasks/src/flex/ant/FlexTask.java =================================================================== --- modules/antTasks/src/flex/ant/FlexTask.java (revision 3507) +++ modules/antTasks/src/flex/ant/FlexTask.java (working copy) @@ -262,6 +262,7 @@ super.setClassname(toolClassName); super.setClasspath(new Path(getProject(), fileName)); + StringBuilder stringBuffer = new StringBuilder(); //converts arguments into a string for use by executeJava() for (int i = 0; i < temp.length; i++) Index: modules/asc/build/java/src/Downgrader.java =================================================================== --- modules/asc/build/java/src/Downgrader.java (revision 3507) +++ modules/asc/build/java/src/Downgrader.java (working copy) @@ -42,7 +42,7 @@ * make JDK 1.5 classfiles (version 49.0) compatible with JDK 1.3 (version 47.0) * by making the following changes: * - * 1. replace references to java.lang.StringBuilder with java.lang.StringBuffer + * 1. replace references to java.lang.StringBuilder with java.lang.StringBuilder * 2. replace Integer.valueOf(int) with macromedia.asc.util.Boxing.valueOf(int) * 3. reorder this$outer and super() code snippets in inner class constructors, * to please the 1.3 verifier. @@ -65,15 +65,15 @@ static { - // replace StringBuilder with StringBuffer - strings.put("java/lang/StringBuilder", "java/lang/StringBuffer"); - strings.put("(Ljava/lang/String;)Ljava/lang/StringBuilder;", "(Ljava/lang/String;)Ljava/lang/StringBuffer;"); - strings.put("(Ljava/lang/Object;)Ljava/lang/StringBuilder;", "(Ljava/lang/Object;)Ljava/lang/StringBuffer;"); - strings.put("(I)Ljava/lang/StringBuilder;", "(I)Ljava/lang/StringBuffer;"); - strings.put("(C)Ljava/lang/StringBuilder;", "(C)Ljava/lang/StringBuffer;"); - strings.put("(Z)Ljava/lang/StringBuilder;", "(Z)Ljava/lang/StringBuffer;"); - strings.put("(D)Ljava/lang/StringBuilder;", "(D)Ljava/lang/StringBuffer;"); - strings.put("(J)Ljava/lang/StringBuilder;", "(J)Ljava/lang/StringBuffer;"); + // replace StringBuilder with StringBuilder + strings.put("java/lang/StringBuilder", "java/lang/StringBuilder"); + strings.put("(Ljava/lang/String;)Ljava/lang/StringBuilder;", "(Ljava/lang/String;)Ljava/lang/StringBuilder;"); + strings.put("(Ljava/lang/Object;)Ljava/lang/StringBuilder;", "(Ljava/lang/Object;)Ljava/lang/StringBuilder;"); + strings.put("(I)Ljava/lang/StringBuilder;", "(I)Ljava/lang/StringBuilder;"); + strings.put("(C)Ljava/lang/StringBuilder;", "(C)Ljava/lang/StringBuilder;"); + strings.put("(Z)Ljava/lang/StringBuilder;", "(Z)Ljava/lang/StringBuilder;"); + strings.put("(D)Ljava/lang/StringBuilder;", "(D)Ljava/lang/StringBuilder;"); + strings.put("(J)Ljava/lang/StringBuilder;", "(J)Ljava/lang/StringBuilder;"); // replace java.lang.AssertionError with java/lang/Error strings.put("java/lang/AssertionError", "java/lang/Error"); Index: modules/asc/src/java/macromedia/abc/AbcParser.java =================================================================== --- modules/asc/src/java/macromedia/abc/AbcParser.java (revision 3507) +++ modules/asc/src/java/macromedia/abc/AbcParser.java (working copy) @@ -509,7 +509,7 @@ // Calculate the internal name - this matter because with get/set properties you can end up with // multiple methods with the same name, but they must each have different internal names. - StringBuffer internal_name = new StringBuffer(methName.length() + 5); + StringBuilder internal_name = new StringBuilder(methName.length() + 5); if( !fun_names.containsKey(methName) ) { fun_names.put(methName,0); Index: modules/asc/src/java/macromedia/abc/MultiName.java =================================================================== --- modules/asc/src/java/macromedia/abc/MultiName.java (revision 3507) +++ modules/asc/src/java/macromedia/abc/MultiName.java (working copy) @@ -89,7 +89,7 @@ public String toString() { // return "multiname{...}::" + localPart; - StringBuffer b = new StringBuffer("{"); + StringBuilder b = new StringBuilder("{"); for (int i = 0, length = (namespaceURI == null) ? 0 : namespaceURI.length; i < length; i++) { b.append(namespaceURI[i]); Index: modules/asc/src/java/macromedia/asc/embedding/avmplus/ActionBlockEmitter.java =================================================================== --- modules/asc/src/java/macromedia/asc/embedding/avmplus/ActionBlockEmitter.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/embedding/avmplus/ActionBlockEmitter.java (working copy) @@ -7754,7 +7754,7 @@ public String il_str() { - StringBuffer out = new StringBuffer(); + StringBuilder out = new StringBuilder(); if (bytecodeFactory.show_bytecode) { @@ -7772,7 +7772,7 @@ private static String cleanupString(ByteList bl) { - StringBuffer b = new StringBuffer(); + StringBuilder b = new StringBuilder(); for (int i=0, n=bl.size(); i < n; i++) { char c = (char) bl.get(i); Index: modules/asc/src/java/macromedia/asc/embedding/avmplus/ByteCodeFactory.java =================================================================== --- modules/asc/src/java/macromedia/asc/embedding/avmplus/ByteCodeFactory.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/embedding/avmplus/ByteCodeFactory.java (working copy) @@ -407,7 +407,7 @@ { if (show_bytecode) { - StringBuffer numStr = new StringBuffer(); + StringBuilder numStr = new StringBuilder(); IL_FormatDoubleAsString(value,numStr); cpool_out.write("\n ConstantDoubleInfo "+numStr.toString()); } @@ -1283,7 +1283,7 @@ // be consistent between the c++ and java based compilers. (which allows diffing // of a java produced .il file vs a c++ produced .il). // Only used by PushNumber() when show_instructions is true. - public static StringBuffer IL_FormatDoubleAsString(double val, StringBuffer buff) + public static StringBuilder IL_FormatDoubleAsString(double val, StringBuilder buff) { if (val == 0.0) { Index: modules/asc/src/java/macromedia/asc/embedding/Compiler.java =================================================================== --- modules/asc/src/java/macromedia/asc/embedding/Compiler.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/embedding/Compiler.java (working copy) @@ -247,7 +247,7 @@ MetaDataEvaluator printer = new MetaDataEvaluator(); node.evaluate(cx,printer); - StringBuffer out = new StringBuffer(); + StringBuilder out = new StringBuilder(); out.append("").append(newline); ObjectList comments = printer.doccomments; Index: modules/asc/src/java/macromedia/asc/embedding/LintEvaluator.java =================================================================== --- modules/asc/src/java/macromedia/asc/embedding/LintEvaluator.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/embedding/LintEvaluator.java (working copy) @@ -493,7 +493,7 @@ if( slot != null && !in_with ) { - warning(node.expr.pos()-1, cx.input, kWarning_DeleteOfFixedProperty, node.ref.name); + warning(node.expr.pos(), cx.input, kWarning_DeleteOfFixedProperty, node.ref.name); } return (node.void_result ? cx.voidType() : cx.booleanType() ); @@ -2799,7 +2799,7 @@ { for(WarningRecord pRec : locMap.values()) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); InputBuffer input = pRec.loc.input; createErrorMessage(pRec, sb, pRec.code); @@ -2831,7 +2831,7 @@ } else { - StringBuffer out = new StringBuffer(); + StringBuilder out = new StringBuilder(); out.append(newline).append("Warning Report:").append(newline); out.append("---------------").append(newline).append(newline); @@ -2880,7 +2880,7 @@ } } - private void createWarning(WarningRecord pRec, StringBuffer out, Integer code) + private void createWarning(WarningRecord pRec, StringBuilder out, Integer code) { InputBuffer input = pRec.loc.input; @@ -2893,7 +2893,7 @@ out.append(" ").append(InputBuffer.getLinePointer(pRec.colNum)).append(newline); } - private void createErrorMessage(WarningRecord pRec, StringBuffer out, Integer code) + private void createErrorMessage(WarningRecord pRec, StringBuilder out, Integer code) { // Just the arguments for sanities, no message (since they chang often) if(ContextStatics.useSanityStyleErrors) { @@ -2940,16 +2940,12 @@ { //TODO Review this for removal/revising later // remove this when there is no longer problems with sometimes having a - // large and wrong loc.pos as well as it being off by one + // large and wrong loc.pos int colPos = input.getColPos(loc.pos); if (colPos > 300) { colPos = 1; } - else - { - colPos = colPos - 1; - } WarningRecord rec = new WarningRecord( loc, input.getLnNum(loc.pos), colPos, code, Index: modules/asc/src/java/macromedia/asc/embedding/Main.java =================================================================== --- modules/asc/src/java/macromedia/asc/embedding/Main.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/embedding/Main.java (working copy) @@ -374,7 +374,7 @@ if (!f.exists()) { Context cx = new Context(new ContextStatics()); - StringBuffer error_msg = new StringBuffer(); + StringBuilder error_msg = new StringBuilder(); Context.replaceStringArg(error_msg, cx .errorString(ErrorConstants.kError_UnableToOpenFile), 0, filename); Index: modules/asc/src/java/macromedia/asc/embedding/Shell.java =================================================================== --- modules/asc/src/java/macromedia/asc/embedding/Shell.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/embedding/Shell.java (working copy) @@ -327,7 +327,7 @@ { Target s = (Target) targets.get(target); System.out.println("id: " + s.id); - StringBuffer b = new StringBuffer(); + StringBuilder b = new StringBuilder(); for (int i = 0, size = s.args.length; i < size; i++) { b.append(s.args[i]); @@ -483,7 +483,7 @@ public static String readFile(File f) { BufferedReader file = null; - StringBuffer buffer = new StringBuffer((int) f.length()); + StringBuilder buffer = new StringBuilder((int) f.length()); String lineSep = System.getProperty("line.separator"); try Index: modules/asc/src/java/macromedia/asc/parser/DocCommentNode.java =================================================================== --- modules/asc/src/java/macromedia/asc/parser/DocCommentNode.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/parser/DocCommentNode.java (working copy) @@ -39,7 +39,7 @@ return null; } - private StringBuffer emitMetaDataComment(StringBuffer buf, String debugName, MetaDataNode meta, boolean isAttributeOfDefinition) + private StringBuilder emitMetaDataComment(StringBuilder buf, String debugName, MetaDataNode meta, boolean isAttributeOfDefinition) { buf.append("\n\n"); String tagname = meta.id; @@ -113,7 +113,7 @@ return buf; } - public StringBuffer emit(Context cx,StringBuffer buf) + public StringBuilder emit(Context cx,StringBuilder buf) { String tagname = ""; StatementListNode metaData = null; @@ -528,7 +528,7 @@ public static String escapeXml(String s) { - StringBuffer out = new StringBuffer(s.length() + 16); + StringBuilder out = new StringBuilder(s.length() + 16); int length = s.length(); for(int i = 0; i < length; i++) { Index: modules/asc/src/java/macromedia/asc/parser/FunctionSignatureNode.java =================================================================== --- modules/asc/src/java/macromedia/asc/parser/FunctionSignatureNode.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/parser/FunctionSignatureNode.java (working copy) @@ -79,7 +79,7 @@ return "FunctionSignature"; } - public StringBuffer toCanonicalString(Context cx, StringBuffer buff) + public StringBuilder toCanonicalString(Context cx, StringBuilder buff) { if (parameter != null) parameter.toCanonicalString(cx, buff); Index: modules/asc/src/java/macromedia/asc/parser/IdentifierNode.java =================================================================== --- modules/asc/src/java/macromedia/asc/parser/IdentifierNode.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/parser/IdentifierNode.java (working copy) @@ -27,20 +27,46 @@ */ public class IdentifierNode extends Node { + private static final String ASTERISK = "*".intern(); + public String name; public ReferenceValue ref; public IdentifierNode(String name, int pos) { + this(name, true, pos); + } + + /** + * This constructor is used by Flex direct AST generation. + * + * @param intern Controls whether value will be interned. If + * name is an interned constant, + * intern should be false. Otherwise, + * it should be true. + */ + public IdentifierNode(String name, boolean intern, int pos) + { super(pos); - this.name = name.intern(); - - if (name.equals("*")) - { - setAny(true); - } - } + if (intern) + { + this.name = name.intern(); + } + else + { + assert name.intern() == name; + this.name = name; + } + + // It's safe to use == here, because name is interned above + // and ASTERISK is interned. + if (name == ASTERISK) + { + setAny(true); + } + } + int authOrigTypeToken = -1; public void setOrigTypeToken(int token){ @@ -74,7 +100,8 @@ public boolean hasAttribute(String name) { - if (this.name.equals(name)) + assert name.intern() == name; + if (this.name == name) { return true; } Index: modules/asc/src/java/macromedia/asc/parser/InputBuffer.java =================================================================== --- modules/asc/src/java/macromedia/asc/parser/InputBuffer.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/parser/InputBuffer.java (working copy) @@ -39,7 +39,7 @@ */ public final class InputBuffer { - private StringBuffer text; + private StringBuilder text; private IntList line_breaks; private boolean atEOF = false; @@ -47,9 +47,9 @@ private int pushBackChar = -1; public String origin; - public StringBuffer curr_line; - public StringBuffer prev_line; - public StringBuffer raw_curr_line; // un-normalized verison of curr_line + public StringBuilder curr_line; + public StringBuilder prev_line; + public StringBuilder raw_curr_line; // un-normalized verison of curr_line public int curr_line_offset; public int prev_line_offset; @@ -66,7 +66,7 @@ public InputBuffer(InputStream in, String encoding, String origin) // Init lineA to make distinct from curr_line (see nextchar) { this.in = createReader(in, encoding); - this.text = new StringBuffer(8192); + this.text = new StringBuilder(8192); init(origin, 0); } @@ -74,7 +74,7 @@ public InputBuffer(String in, String origin) { this.in = new StringReader(in); - this.text = new StringBuffer(in.length() + 10); + this.text = new StringBuilder(in.length() + 10); init(origin, 0); } @@ -82,13 +82,13 @@ private void init(String origin, int pos) { this.origin = origin; - curr_line = new StringBuffer(80); - prev_line = new StringBuffer(80); + curr_line = new StringBuilder(80); + prev_line = new StringBuilder(80); prev_line_offset = -1; this.pos = pos; lnNum = -1; colPos = 0; - raw_curr_line = new StringBuffer(80); + raw_curr_line = new StringBuilder(80); has_unixnewlines = false; @@ -255,7 +255,7 @@ // If the current character is a newline, then read // the next line of input into the other input buffer. - StringBuffer prevSave = prev_line; + StringBuilder prevSave = prev_line; prev_line = curr_line; prev_line_offset = curr_line_offset; @@ -384,7 +384,7 @@ { if ((--colPos) < 0) { - StringBuffer currSave = curr_line; + StringBuilder currSave = curr_line; curr_line = prev_line; prev_line = currSave; prev_line.setLength(0); @@ -560,10 +560,10 @@ Functionality split off from copy() so that we can call it on Parser's string_literal_buffer as well */ - public String escapeString(StringBuffer source, int from, int to) + public String escapeString(StringBuilder source, int from, int to) { // C: only 1 string in 1000 needs escaping and the lengths of these strings are usually small, - // so we can cut StringBuffer usage if we check '\\' up front. + // so we can cut StringBuilder usage if we check '\\' up front. int stop = to+1; boolean required = false; @@ -581,7 +581,7 @@ return source.substring(from, stop); } - final StringBuffer buf = new StringBuffer(stop-from); + final StringBuilder buf = new StringBuilder(stop-from); for (int i = from; i < stop; i++) { char c = source.charAt(i); @@ -800,7 +800,7 @@ public static String getLinePointer(int pos) { - final StringBuffer padding = new StringBuffer(pos); + final StringBuilder padding = new StringBuilder(pos); for (int i = 0; i < pos - 1; ++i) { padding.append("."); @@ -812,7 +812,7 @@ public void clearUnusedBuffers() { // TODO: remove this and pre-size text - text = new StringBuffer(text.toString()); + text = new StringBuilder(text.toString()); try { in.close(); } catch (IOException e) {} in = null; curr_line = null; Index: modules/asc/src/java/macromedia/asc/parser/LiteralStringNode.java =================================================================== --- modules/asc/src/java/macromedia/asc/parser/LiteralStringNode.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/parser/LiteralStringNode.java (working copy) @@ -30,11 +30,11 @@ public String value; // consts used to identify string delimiter type. - static final int SINGLE_QUOTE_DELIMITER = 2; - static final int DOUBLE_QUOTE_DELIMITER = 1; - static final int OTHER_DELIMITER=0; // this can occur in an xml literal expression, or in LiteralStringNodes synthesized by the compiler + private static final int SINGLE_QUOTE_DELIMITER = 2; + private static final int DOUBLE_QUOTE_DELIMITER = 1; + private static final int OTHER_DELIMITER=0; // this can occur in an xml literal expression, or in LiteralStringNodes synthesized by the compiler - int delimiterType; // one of the above delim types + private int delimiterType; // one of the above delim types public boolean isSingleQuote() { @@ -46,7 +46,6 @@ return delimiterType == DOUBLE_QUOTE_DELIMITER; } - public LiteralStringNode(String value) { void_result = false; @@ -56,8 +55,31 @@ public LiteralStringNode(String value, boolean singleQuoted) { + this(value, singleQuoted, true); + } + + /** + * This constructor is used by Flex direct AST generation. + * + * @param intern Controls whether value will be interned. If + * value is an interned constant, + * intern should be false. Otherwise, + * it should be true. + */ + public LiteralStringNode(String value, boolean singleQuoted, boolean intern) + { void_result = false; - this.value = value.intern(); + + if (intern) + { + this.value = value.intern(); + } + else + { + assert value.intern() == value; + this.value = value; + } + delimiterType = singleQuoted ? SINGLE_QUOTE_DELIMITER : DOUBLE_QUOTE_DELIMITER; } Index: modules/asc/src/java/macromedia/asc/parser/MemberExpressionNode.java =================================================================== --- modules/asc/src/java/macromedia/asc/parser/MemberExpressionNode.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/parser/MemberExpressionNode.java (working copy) @@ -127,7 +127,7 @@ return false; } - public StringBuffer toCanonicalString(Context cx, StringBuffer buf) + public StringBuilder toCanonicalString(Context cx, StringBuilder buf) { Slot s = ref.getSlot(cx, GET_TOKEN); buf.append( (s == null || s.getDebugName().length() == 0) ? ref.name : s.getDebugName() ); Index: modules/asc/src/java/macromedia/asc/parser/MetaDataEvaluator.java =================================================================== --- modules/asc/src/java/macromedia/asc/parser/MetaDataEvaluator.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/parser/MetaDataEvaluator.java (working copy) @@ -102,7 +102,7 @@ } else if (node.data.elementlist.size() > 1) { - cx.error(node.pos()-1, kError_MetaDataAttributesHasMoreThanOneElement); + cx.error(node.pos(), kError_MetaDataAttributesHasMoreThanOneElement); } else if( node.data.elementlist.items.get(0) instanceof MemberExpressionNode ) { @@ -132,7 +132,7 @@ Value value = n.evaluate(cx, this); if (value == null) { - cx.error(n.pos() - 1, kError_InvalidMetaData); + cx.error(n.pos(), kError_InvalidMetaData); } node.values[i] = value; } @@ -158,11 +158,11 @@ { if( node.data.elementlist.items.get(0) != null ) { - cx.error(node.data.elementlist.items.get(0).pos() - 1, kError_InvalidMetaData); + cx.error(node.data.elementlist.items.get(0).pos(), kError_InvalidMetaData); } else { - cx.error(node.pos() - 1, kError_InvalidMetaData); + cx.error(node.pos(), kError_InvalidMetaData); } } Index: modules/asc/src/java/macromedia/asc/parser/Node.java =================================================================== --- modules/asc/src/java/macromedia/asc/parser/Node.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/parser/Node.java (working copy) @@ -124,7 +124,7 @@ return "Node"; } - public StringBuffer toCanonicalString(Context cx, StringBuffer buf) + public StringBuilder toCanonicalString(Context cx, StringBuilder buf) { return buf; } Index: modules/asc/src/java/macromedia/asc/parser/NodeFactory.java =================================================================== --- modules/asc/src/java/macromedia/asc/parser/NodeFactory.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/parser/NodeFactory.java (working copy) @@ -738,7 +738,7 @@ else identifier = this.identifier("anonymous",pos); } - StringBuffer internal_name = new StringBuffer(identifier.name.length() + 6); + StringBuilder internal_name = new StringBuilder(identifier.name.length() + 6); if (!fun_names.containsKey(identifier.name)) { @@ -876,14 +876,30 @@ return identifier(name, -1); } + public IdentifierNode identifier(String name, boolean intern) + { + IdentifierNode node = new IdentifierNode(name, intern, -1); + return node; + } + + public IdentifierNode identifier(String name, boolean intern, int pos) + { + IdentifierNode node = new IdentifierNode(name, intern, pos); + return node; + } + + private static final String ARGUMENTS = "arguments".intern(); + public IdentifierNode identifier(String name, int pos) { - if ("arguments".equals(name)) + IdentifierNode node = new IdentifierNode(name, pos); + node.setPositionTerminal(pos); + + if (ARGUMENTS == node.name) { this.has_arguments = true; } - IdentifierNode node = new IdentifierNode(name, pos); - node.setPositionTerminal(pos); + return node; } @@ -1178,12 +1194,17 @@ return node; } - public LiteralStringNode literalString(String value) { return literalString(value, 0); } + public LiteralStringNode literalString(String value, boolean intern) + { + LiteralStringNode node = new LiteralStringNode(value, false, intern); + return node; + } + public LiteralStringNode literalString(String value, int pos) { LiteralStringNode node = new LiteralStringNode(value); @@ -1268,7 +1289,7 @@ } if( base_name != null && pname != null ) { - String compound_name = new StringBuffer(base_name.length() + pname.name.length() + 1).append(base_name).append(".").append(pname.name).toString(); + String compound_name = new StringBuilder(base_name.length() + pname.name.length() + 1).append(base_name).append(".").append(pname.name).toString(); if( compound_names.contains(compound_name) ) { selector = this.getExpression(this.identifier(compound_name,selector.pos())); @@ -1277,7 +1298,7 @@ } else if( compound_names.contains(base_name) ) { - LiteralStringNode nsn = literalString(bname.name,memb.pos()-1); + LiteralStringNode nsn = literalString(bname.name,memb.pos()); selector = this.getExpression(this.qualifiedIdentifier(nsn,pname,selector.pos())); base = memb.base; } @@ -1417,7 +1438,7 @@ public PackageDefinitionNode startPackage(Context cx,AttributeListNode attrs, PackageNameNode name) { if (cx.scriptAssistParsing) - return startPackage(cx, attrs, name, cx.input.pos); + return startPackage(cx, attrs, name, cx.input.getCurrentPos()); else return startPackage(cx, attrs, name, -1); } @@ -1637,7 +1658,7 @@ else { node = this.error(expr.getPosition(), kError_IncrementOperatorNotAReference);// todo: should be an cx.error, not an ErrorNode? - node.setPosition(node.getPosition() - 1); // since increment has two characters. + node.setPosition(node.getPosition()); } return node; Index: modules/asc/src/java/macromedia/asc/parser/PackageIdentifiersNode.java =================================================================== --- modules/asc/src/java/macromedia/asc/parser/PackageIdentifiersNode.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/parser/PackageIdentifiersNode.java (working copy) @@ -82,13 +82,15 @@ } } + private static final String ASTERISK = "*".intern(); + public String toIdentifierString() { if( pkg_part == null ) { boolean isDefinition = (flags & IS_DEFINITION_FLAG) != 0; - StringBuffer buf = new StringBuffer(); + StringBuiler buf = new StringBuilder(); //ListIterator it = list.listIterator(); //while( it.hasNext() ) int len = list.size(); @@ -98,7 +100,7 @@ if (x == len - 1 && isDefinition) { def_part = ""; - if (!"*".equals(item.name)) + if (ASTERISK != item.name) def_part = item.name; } else Index: modules/asc/src/java/macromedia/asc/parser/ParameterListNode.java =================================================================== --- modules/asc/src/java/macromedia/asc/parser/ParameterListNode.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/parser/ParameterListNode.java (working copy) @@ -68,7 +68,7 @@ return "ParameterList"; } - public StringBuffer toCanonicalString(Context cx, StringBuffer buf) + public StringBuilder toCanonicalString(Context cx, StringBuilder buf) { { buf.append(" param_names='"); Index: modules/asc/src/java/macromedia/asc/parser/Parser.java =================================================================== --- modules/asc/src/java/macromedia/asc/parser/Parser.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/parser/Parser.java (working copy) @@ -21,6 +21,8 @@ import java.util.HashSet; import java.util.ListIterator; +import macromedia.asc.semantics.NamespaceValue; +import macromedia.asc.semantics.ReferenceValue; import macromedia.asc.util.*; import static macromedia.asc.parser.Tokens.*; import static macromedia.asc.embedding.avmplus.RuntimeConstants.*; @@ -40,6 +42,19 @@ { private static final boolean debug = false; + private static final String PUBLIC = "public".intern(); + private static final String PRIVATE = "private".intern(); + private static final String PROTECTED = "protected".intern(); + private static final String ASTERISK = "*".intern(); + private static final String DEFAULT = "default".intern(); + private static final String AS3 = "AS3".intern(); + private static final String CONFIG = "CONFIG".intern(); + private static final String GET = "get".intern(); + private static final String NAMESPACE = "namespace".intern(); + private static final String SET = "set".intern(); + private static final String VEC = "vec".intern(); + private static final String VECTOR = "Vector".intern(); + private static final String __AS3__ = "__AS3__".intern(); private static final int abbrevIfElse_mode = ELSE_TOKEN; // lookahead uses this value. don't change. private static final int abbrevDoWhile_mode = WHILE_TOKEN; // ditto. @@ -153,7 +168,7 @@ private Node error(int kind, int errCode, String arg1, String arg2,int pos) { String origin = this.scanner.input.origin; - StringBuffer out = new StringBuffer(); + StringBuilder out = new StringBuilder(); if(debug) out.append("[Parser] "); @@ -175,16 +190,10 @@ int column; if( pos < 0 ) { - lineno = scanner.input.markLn + 1; - column = scanner.input.markCol; pos = scanner.input.positionOfMark(); - } - else - { - lineno = scanner.input.getLnNum(pos); - column = scanner.input.getColPos(pos); - } + lineno = scanner.input.getLnNum(pos); + column = scanner.input.getColPos(pos); if (kind == syntax_error || kind == syntax_eos_error ) { @@ -204,11 +213,6 @@ * whitespace or end of input. */ - private void skiperror() - { - skiperror(syntax_error); - } - private void skiperror(int kind) { // If kind is < 0 then it is a token class to be advanced to, @@ -353,7 +357,7 @@ public Parser(Context cx, InputStream in, String origin, String encoding, boolean emit_doc_info, boolean save_comment_nodes, IntList block_kind_stack) { init(cx, origin, emit_doc_info, save_comment_nodes, block_kind_stack); - scanner = new Scanner(cx, in, encoding, origin); + scanner = new Scanner(cx, in, encoding, origin, save_comment_nodes); this.encoding = encoding; } @@ -366,7 +370,7 @@ public Parser(Context cx, String in, String origin) { init(cx, origin, false, false, null); - scanner = new Scanner(cx, in, origin); + scanner = new Scanner(cx, in, origin, false); } public Parser(Context cx, String in, String origin, boolean emit_doc_info, boolean save_comment_nodes) @@ -377,14 +381,23 @@ public Parser(Context cx, String in, String origin, boolean emit_doc_info, boolean save_comment_nodes, IntList block_kind_stack) { init(cx, origin, emit_doc_info, save_comment_nodes, block_kind_stack); - scanner = new Scanner(cx, in, origin); + scanner = new Scanner(cx, in, origin, save_comment_nodes); } public Parser(Context cx, String in, String origin, boolean emit_doc_info, boolean save_comment_nodes, IntList block_kind_stack, boolean is_include) { this(cx, in, origin, emit_doc_info, save_comment_nodes, block_kind_stack); this.parsing_include = is_include; + } + /** + * This contructor is used by Flex direct AST generation. It + * allows Flex to pass in a specialized InputBuffer. + */ + public Parser(Context cx, InputBuffer inputBuffer, String origin) + { + init(cx, origin, false, false, null); + scanner = new Scanner(cx, inputBuffer); } public boolean newline() @@ -725,17 +738,17 @@ if (lookahead(GET_TOKEN)) { match(GET_TOKEN); - result = nodeFactory.identifier("get",ctx.input.positionOfMark()); + result = nodeFactory.identifier(GET,false,ctx.input.positionOfMark()); } else if (lookahead(SET_TOKEN)) { match(SET_TOKEN); - result = nodeFactory.identifier("set",ctx.input.positionOfMark()); + result = nodeFactory.identifier(SET,false,ctx.input.positionOfMark()); } else if (lookahead(NAMESPACE_TOKEN)) { match(NAMESPACE_TOKEN); - result = nodeFactory.identifier("namespace",ctx.input.positionOfMark()); + result = nodeFactory.identifier(NAMESPACE,false,ctx.input.positionOfMark()); } else { @@ -768,27 +781,27 @@ if (lookahead(DEFAULT_TOKEN)) { match(DEFAULT_TOKEN); - result = nodeFactory.identifier("default",ctx.input.positionOfMark()); + result = nodeFactory.identifier(DEFAULT,false,ctx.input.positionOfMark()); } else if (lookahead(GET_TOKEN)) { match(GET_TOKEN); - result = nodeFactory.identifier("get",ctx.input.positionOfMark()); + result = nodeFactory.identifier(GET,false,ctx.input.positionOfMark()); } else if (lookahead(SET_TOKEN)) { match(SET_TOKEN); - result = nodeFactory.identifier("set",ctx.input.positionOfMark()); + result = nodeFactory.identifier(SET,false,ctx.input.positionOfMark()); } else if (lookahead(NAMESPACE_TOKEN)) { match(NAMESPACE_TOKEN); - result = nodeFactory.identifier("namespace",ctx.input.positionOfMark()); + result = nodeFactory.identifier(NAMESPACE,false,ctx.input.positionOfMark()); } else if (HAS_WILDCARDSELECTOR && lookahead(MULT_TOKEN)) { match(MULT_TOKEN); - result = nodeFactory.identifier("*",ctx.input.positionOfMark()); + result = nodeFactory.identifier(ASTERISK,false,ctx.input.positionOfMark()); } else { @@ -821,17 +834,17 @@ if (lookahead(PUBLIC_TOKEN)) { match(PUBLIC_TOKEN); - result = nodeFactory.identifier("public",ctx.input.positionOfMark()); + result = nodeFactory.identifier(PUBLIC,false,ctx.input.positionOfMark()); } else if (lookahead(PRIVATE_TOKEN)) { match(PRIVATE_TOKEN); - result = nodeFactory.identifier("private",ctx.input.positionOfMark()); + result = nodeFactory.identifier(PRIVATE,false,ctx.input.positionOfMark()); } else if (lookahead(PROTECTED_TOKEN)) { match(PROTECTED_TOKEN); - result = nodeFactory.identifier("protected",ctx.input.positionOfMark()); + result = nodeFactory.identifier(PROTECTED,false,ctx.input.positionOfMark()); } else { @@ -1018,17 +1031,17 @@ else if (lookahead(PRIVATE_TOKEN)) { match(PRIVATE_TOKEN); - result = nodeFactory.identifier("private",ctx.input.positionOfMark()); + result = nodeFactory.identifier(PRIVATE,false,ctx.input.positionOfMark()); } else if (lookahead(PUBLIC_TOKEN)) { match(PUBLIC_TOKEN); - result = nodeFactory.identifier("public",ctx.input.positionOfMark()); + result = nodeFactory.identifier(PUBLIC,false,ctx.input.positionOfMark()); } else if (lookahead(PROTECTED_TOKEN)) { match(PROTECTED_TOKEN); - result = nodeFactory.identifier("protected",ctx.input.positionOfMark()); + result = nodeFactory.identifier(PROTECTED,false,ctx.input.positionOfMark()); } else if (lookahead(NUMBERLITERAL_TOKEN)) { @@ -1178,14 +1191,14 @@ { scanner.exitSlashDivContext(); error(kError_Lexical_NoMatchingTag); - return nodeFactory.error(ctx.input.positionOfMark()-1,kError_Lexical_NoMatchingTag); + return nodeFactory.error(ctx.input.positionOfMark(),kError_Lexical_NoMatchingTag); } match(XMLTAGSTARTEND_TOKEN); // "()); - config_namespaces.last().add("CONFIG"); + config_namespaces.last().add(CONFIG); configs = parseConfigValues(); } @@ -7613,7 +7638,7 @@ if( (ctx.dialect(10) /*|| ctx.dialect(11)*/) && !parsing_include && second != null ) // don't insert a statement for includes because will screw up metadata parsing { - Node udn = nodeFactory.useDirective(null,nodeFactory.memberExpression(null,nodeFactory.getExpression(nodeFactory.identifier("AS3")))); + Node udn = generateAs3UseDirective(ctx); second.items.add(0,udn); } ProgramNode result = nodeFactory.program(ctx,second,ctx.input.positionOfMark()); @@ -7636,7 +7661,7 @@ // Add tool chain added values if( configs != null ) result.statements.items.addAll(0, configs.items); - NamespaceDefinitionNode configdef = nodeFactory.configNamespaceDefinition(null, nodeFactory.identifier("CONFIG"), -1); + NamespaceDefinitionNode configdef = nodeFactory.configNamespaceDefinition(null, nodeFactory.identifier(CONFIG, false), -1); // Add the default CONFIG namespace result.statements.items.add(0, configdef); } Index: modules/asc/src/java/macromedia/asc/parser/Scanner.java =================================================================== --- modules/asc/src/java/macromedia/asc/parser/Scanner.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/parser/Scanner.java (working copy) @@ -16,7 +16,7 @@ */ package macromedia.asc.parser; - +import java.util.concurrent.*; import macromedia.asc.util.*; import macromedia.asc.embedding.ErrorConstants; @@ -41,73 +41,200 @@ private ObjectList tokens; // vector of token instances. private IntList slash_context = new IntList(); // slashdiv_context or slashregexp_context private boolean isFirstTokenOnLine; - //private Writer err; + private boolean save_comments; private Context ctx; public InputBuffer input; + private static final String[][] rsvd = { + {"as"}, + {"break"}, + {"case","catch","class","const","continue"}, + {"default","delete","do"}, + {"else","extends"}, + {"false","finally","for","function"}, + {"get"}, + {""},//h + {"if","implements","import","in","include","instanceof","interface","is"}, + {""},//j + {""},//k + {""},//l + {""},//m + {"namespace","new","null"}, + {""},//o + {"package","private","protected","public"}, + {""},//q + {"return"}, + {"set","super","switch"}, + {"this","throw","true","try","typeof"}, + {"use"}, + {"var","void"}, + {"while","with"}, + {""},//x + {""},//y + {""}//z + }; + + // ??? too fragile...come up with a better way + + private static final int[][] rsvd_token = { + {AS_TOKEN}, + {BREAK_TOKEN}, + {CASE_TOKEN,CATCH_TOKEN,CLASS_TOKEN,CONST_TOKEN,CONTINUE_TOKEN}, + {DEFAULT_TOKEN,DELETE_TOKEN,DO_TOKEN}, + {ELSE_TOKEN,EXTENDS_TOKEN}, + {FALSE_TOKEN,FINALLY_TOKEN,FOR_TOKEN,FUNCTION_TOKEN}, + {GET_TOKEN}, + {},//h + {IF_TOKEN,IMPLEMENTS_TOKEN,IMPORT_TOKEN,IN_TOKEN,INCLUDE_TOKEN,INSTANCEOF_TOKEN,INTERFACE_TOKEN,IS_TOKEN}, + {},//j + {},//k + {},//l + {},//m + {NAMESPACE_TOKEN,NEW_TOKEN,NULL_TOKEN}, + {},//o + {PACKAGE_TOKEN,PRIVATE_TOKEN,PROTECTED_TOKEN,PUBLIC_TOKEN}, + {},//q + {RETURN_TOKEN}, + {SET_TOKEN,SUPER_TOKEN,SWITCH_TOKEN}, + {THIS_TOKEN,THROW_TOKEN,TRUE_TOKEN,TRY_TOKEN,TYPEOF_TOKEN}, + {USE_TOKEN}, + {VAR_TOKEN,VOID_TOKEN}, + {WHILE_TOKEN,WITH_TOKEN}, + {},//x + {},//y + {}//z + }; + + private final int screen_rsvd() + { + char c; + int row; + int row_length; + int text_length = input.markLength(); + int i,j; + + if ( text_length < 2 ) + return 0; + + c = input.markCharAt(0); + assert(c >= 'a' && c <= 'z'); + row = (int) c - 'a'; + assert(row >= 0 && row < rsvd.length); + row_length = rsvd[row].length; + + for (i = 0; i < row_length; i++ ) + { + if ( rsvd[row][i].length() != text_length ) + continue; + + for ( j = 1; j < text_length; j++ ) + { + c = input.markCharAt(j); + if ( c != rsvd[row][i].charAt(j) ) + break; + } + if ( j == text_length ) + return rsvd_token[row][i]; + } + return 0; + } + + private static final ConcurrentHashMap reservedWord; + + static { + reservedWord = new ConcurrentHashMap(64); + reservedWord.put("as",AS_TOKEN); // ??? predicated on HAS_ASOPERATOR + reservedWord.put("break",BREAK_TOKEN); + reservedWord.put("case",CASE_TOKEN); + reservedWord.put("catch",CATCH_TOKEN); + reservedWord.put("class",CLASS_TOKEN); + reservedWord.put("const",CONST_TOKEN); + reservedWord.put("continue",CONTINUE_TOKEN); + reservedWord.put("default",DEFAULT_TOKEN); + reservedWord.put("delete",DELETE_TOKEN); + reservedWord.put("do",DO_TOKEN); + reservedWord.put("else",ELSE_TOKEN); + reservedWord.put("extends",EXTENDS_TOKEN); + reservedWord.put("false",FALSE_TOKEN); + reservedWord.put("finally",FINALLY_TOKEN); + reservedWord.put("for",FOR_TOKEN); + reservedWord.put("function",FUNCTION_TOKEN); + reservedWord.put("get",GET_TOKEN); + reservedWord.put("if",IF_TOKEN); + reservedWord.put("implements",IMPLEMENTS_TOKEN); + reservedWord.put("import",IMPORT_TOKEN); + reservedWord.put("in",IN_TOKEN); + reservedWord.put("include",INCLUDE_TOKEN); + reservedWord.put("instanceof",INSTANCEOF_TOKEN); + reservedWord.put("interface",INTERFACE_TOKEN); + reservedWord.put("is",IS_TOKEN); //??? predicated on HAS_ISOPERATOR + reservedWord.put("namespace",NAMESPACE_TOKEN); + reservedWord.put("new",NEW_TOKEN); + reservedWord.put("null",NULL_TOKEN); + reservedWord.put("package",PACKAGE_TOKEN); + reservedWord.put("private",PRIVATE_TOKEN); + reservedWord.put("protected",PROTECTED_TOKEN); + reservedWord.put("public",PUBLIC_TOKEN); + reservedWord.put("return",RETURN_TOKEN); + reservedWord.put("set",SET_TOKEN); + reservedWord.put("super",SUPER_TOKEN); + reservedWord.put("switch",SWITCH_TOKEN); + reservedWord.put("this",THIS_TOKEN); + reservedWord.put("throw",THROW_TOKEN); + reservedWord.put("true",TRUE_TOKEN); + reservedWord.put("try",TRY_TOKEN); + reservedWord.put("typeof",TYPEOF_TOKEN); + reservedWord.put("use",USE_TOKEN); + reservedWord.put("var",VAR_TOKEN); + reservedWord.put("void",VOID_TOKEN); + reservedWord.put("while",WHILE_TOKEN); + reservedWord.put("with",WITH_TOKEN); + } + /* * Scanner constructors. */ - private void init(Context cx) + private void init(Context cx, boolean save_comments) { ctx = cx; - tokens = new ObjectList(200); + tokens = new ObjectList(2048); state = start_state; level = 0; slash_context.add(slashregexp_context); states = new IntList(); levels = new IntList(); slashcontexts = new ObjectList(); + this.save_comments = save_comments; } - public Scanner(Context cx, InputStream in, String encoding, String origin) + + public Scanner(Context cx, InputStream in, String encoding, String origin){this(cx,in,encoding,origin,true);} + public Scanner(Context cx, InputStream in, String encoding, String origin, boolean save_comments) { - init(cx); - + init(cx,save_comments); this.input = new InputBuffer(in, encoding, origin); cx.input = this.input; } - - public Scanner(Context cx, String in, String origin) + + public Scanner(Context cx, String in, String origin){this(cx,in,origin,true);} + public Scanner(Context cx, String in, String origin, boolean save_comments) { - init(cx); - + init(cx,save_comments); this.input = new InputBuffer(in, origin); cx.input = this.input; } - - /* - * nextchar() -- - * Get the next character that has lexical significance. If get_unnormalized == false, - * WhiteSpace, LineTerminators are normalized to various combinations - * of ' ' and '\n'. Unicode format control character are not significant - * in the lexical grammar and so are removed from the character stream. - * If the end of the input stream is reached, then 0 is returned. - * - * TODO: Unicode format control characters may be significant to string literals, and - * thus should be included when get_unnormalized=true. That requires supporting two - * seperate colPos indicies in InputBuffer, however. For now, get_unnormalized only - * avoids the normalization of whitespace, allowing us to use the same colPos for both - * the normalized and unnormalized buffers. + + /** + * nextchar() --just fetch the next char */ - public char nextchar() + private char nextchar() { - return (char) input.nextchar(false); + return (char) input.nextchar(); } - public char nextchar(boolean get_unnormalized) - { - return (char) input.nextchar(get_unnormalized); - } - - - public String lexeme() - { - return input.copy(); // Copies text since last mark. - } - + /* * retract() -- * Causes one character of input to be 'put back' onto the @@ -119,13 +246,28 @@ input.retract(); } + /** + * @return +1 from current char pos in InputBuffer + */ + + private int pos() + { + return input.textPos(); + } + + /** + * set mark position + */ + private void mark() + { + input.textMark(); + } + /* * Various helper methods for managing and testing the * scanning context for slashes. */ - - public void enterSlashDivContext() { slash_context.add(slashdiv_context); @@ -151,7 +293,7 @@ return slash_context.last() == slashdiv_context; } - public boolean isSlashRegexpContext() + public boolean isSlashRegexpContext() // ??? this method is not used. { return slash_context.last() == slashregexp_context; } @@ -162,12 +304,12 @@ * Return the index of the token which is its identifier. */ - public int makeTokenInstance(int token_class, String lexeme) + private int makeTokenInstance(int token_class, String lexeme) { tokens.add(new Token(token_class, lexeme)); return tokens.size() - 1; /* return the tokenid */ } - + /* * getTokenClass() -- * Get the class of a token instance. @@ -175,7 +317,6 @@ public int getTokenClass(int token_id) { - // if the token id is negative, it is a token_class. if (token_id < 0) { @@ -189,12 +330,10 @@ /* * getTokenText() -- * Get the text of a token instance. - * */ public String getTokenText(int token_id) { - // if the token id is negative, it is a token_class. if (token_id < 0) { @@ -210,7 +349,8 @@ * Get text of literal string token as well as info about whether it was single quoted or not * */ - String getStringTokenText( int token_id, boolean[] is_single_quoted ) + + public String getStringTokenText( int token_id, boolean[] is_single_quoted ) { // if the token id is negative, it is a token_class. if( token_id < 0 ) @@ -228,27 +368,18 @@ } /* - * getLinePointer() -- - * Generate a string that contains a carat character at - * a specified position. - */ - - public String getLinePointer() - { - return InputBuffer.getLinePointer(0); - } - - /* * Record an error. */ - public void error(int kind, String arg, int tokenid) + private void error(int kind, String arg, int tokenid) { - StringBuffer out = new StringBuffer(); + StringBuilder out = new StringBuilder(); String origin = this.input.origin; - int ln = this.input.markLn + 1; - int col = this.input.markCol; + + int errPos = input.positionOfMark(); // note use of source adjusted position + int ln = input.getLnNum(errPos); + int col = input.getColPos(errPos); String msg = (ContextStatics.useVerboseErrors ? "[Compiler] Error #" + kind + ": " : "") + ctx.errorString(kind); @@ -261,17 +392,17 @@ if (nextLoc != -1) // append msg remainder after replacement point, if any out.append(msg.substring(nextLoc, msg.length())); - ctx.localizedError(origin,ln,col,out.toString(),input.getLineText(input.positionOfMark()), kind); + ctx.localizedError(origin,ln,col,out.toString(),input.getLineText(errPos), kind); skiperror(kind); } - public void error(String msg) + private void error(String msg) { ctx.internalError(msg); error(kError_Lexical_General, msg, ERROR_TOKEN); } - public void error(int kind) + private void error(int kind) { error(kind, "", ERROR_TOKEN); } @@ -281,12 +412,12 @@ * whitespace or end of input. */ - public void skiperror() + private void skiperror() { skiperror(kError_Lexical_General); } - public void skiperror(int kind) + private void skiperror(int kind) { //Debugger::trace("skipping error\n"); switch (kind) @@ -319,7 +450,7 @@ while (true) { char nc = nextchar(); - if (nc == ';' || nc == '\n' || nc == 0) + if (nc == ';' || nc == '\n' || nc == '\r' || nc == 0) { return; } @@ -329,16 +460,7 @@ /* * - */ - - public boolean test_skiperror() - { - return true; - } - - /* * - * */ public boolean followsLineTerminator() @@ -386,43 +508,54 @@ slash_context = slashcontexts.removeLast(); } - private StringBuffer getDocTextBuffer(String doctagname) + private StringBuilder getDocTextBuffer(String doctagname) { - StringBuffer doctextbuf = new StringBuffer(); + StringBuilder doctextbuf = new StringBuilder(); doctextbuf.append("<").append(doctagname).append("> 0 ) { - xmltext = input.source(begin,end); + xmltext = input.copy(begin,end); } return xmltext; } + + public void clearUnusedBuffers() { + // input.clearUnusedBuffers(); + input = null; + } + /* + * + * + */ + public int nexttoken(boolean resetState) { + String xmltagname = null, doctagname = "description"; + StringBuilder doctextbuf = null; + int startofxml = pos(); + StringBuilder blockcommentbuf = null; + char regexp_flags =0; // used to track option flags encountered in a regexp expression. Initialized in regexp_state + boolean maybe_reserved = false; + if (resetState) { isFirstTokenOnLine = false; } - String xmltagname = null, doctagname = "description"; - StringBuffer doctextbuf = null; - int startofxml = input.positionOfNext()+1; - StringBuffer blockcommentbuf = null; - StringBuffer stringliteralbuf = null; - char regexp_flags =0; // used to track option flags encountered in a regexp expression. Initialized in regexp_state - + while (true) { if (debug) { - System.out.println("state = " + state + ", next = " + input.positionOfNext()); + System.out.println("state = " + state + ", next = " + pos()); } switch (state) @@ -431,37 +564,123 @@ case start_state: { int c = nextchar(); - input.mark(); + mark(); + switch (c) { + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': + case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': + case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': + maybe_reserved = true; + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': + case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': + case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': + case '_': case '$': + state = A_state; + continue; + case 0xffffffef: state = utf8sig_state; continue; + case '@': - state = start_state; return AMPERSAND_TOKEN; + case '\'': - stringliteralbuf = new StringBuffer(); - stringliteralbuf.append((char)c); - state = singlequote_state; - continue; case '\"': - stringliteralbuf = new StringBuffer(); - stringliteralbuf.append((char)c); - state = doublequote_state; - continue; - case '-': - state = minus_state; - continue; - case '!': - state = not_state; - continue; - case '%': - state = remainder_state; - continue; - case '&': - state = and_state; - continue; + { + char startquote = (char) c; + boolean needs_escape = false; + + while ( (c=nextchar()) != startquote ) + { + if ( c == '\\' ) + { + needs_escape = true; + c = nextchar(); + + // special case: escaped eol strips crlf or lf + + if ( c == '\r' ) + c = nextchar(); + if ( c == '\n' ) + continue; + } + else if ( c == '\r' || c == '\n' ) + { + if ( startquote == '\'' ) + error(kError_Lexical_LineTerminatorInSingleQuotedStringLiteral); + else + error(kError_Lexical_LineTerminatorInDoubleQuotedStringLiteral); + break; + } + else if ( c == 0 ) + { + error(kError_Lexical_EndOfStreamInStringLiteral); + return EOS_TOKEN; + } + } + return makeTokenInstance(STRINGLITERAL_TOKEN, input.copy(needs_escape)); + } + + case '-': // tokens: -- -= - + switch (nextchar()) + { + case '-': + return MINUSMINUS_TOKEN; + case '=': + return MINUSASSIGN_TOKEN; + default: + retract(); + return MINUS_TOKEN; + } + + case '!': // tokens: ! != !=== + switch (nextchar()) + { + case '=': + switch (nextchar()) + { + case '=': + return STRICTNOTEQUALS_TOKEN; + default: + retract(); + return NOTEQUALS_TOKEN; + } + default: + retract(); + return NOT_TOKEN; + } + + case '%': // tokens: % %= + switch (nextchar()) + { + case '=': + return MODULUSASSIGN_TOKEN; + default: + retract(); + return MODULUS_TOKEN; + } + + case '&': // tokens: & &= && &&= + switch (nextchar()) + { + case '&': + switch (nextchar()) + { + case '=': + return LOGICALANDASSIGN_TOKEN; + default: + retract(); + return LOGICALAND_TOKEN; + } + case '=': + return BITWISEANDASSIGN_TOKEN; + default: + retract(); + return BITWISEAND_TOKEN; + } + case '#': if (HAS_HASHPRAGMAS) { @@ -472,182 +691,150 @@ state = error_state; continue; } // # is short for use + case '(': - state = start_state; return LEFTPAREN_TOKEN; + case ')': - state = start_state; return RIGHTPAREN_TOKEN; - case '*': - state = star_state; - continue; + + case '*': // tokens: *= * + switch (nextchar()) + { + case '=': + return MULTASSIGN_TOKEN; + default: + retract(); + return MULT_TOKEN; + } + case ',': - state = start_state; return COMMA_TOKEN; + case '.': state = dot_state; continue; + case '/': state = slash_state; continue; - case ':': - state = colon_state; - continue; + + case ':': // tokens: : :: + switch (nextchar()) + { + case ':': + return DOUBLECOLON_TOKEN; + default: + retract(); + return COLON_TOKEN; + } + case ';': - state = start_state; return SEMICOLON_TOKEN; + case '?': - state = start_state; return QUESTIONMARK_TOKEN; + case '[': - state = start_state; return LEFTBRACKET_TOKEN; + case ']': - state = start_state; return RIGHTBRACKET_TOKEN; + case '^': state = bitwisexor_state; continue; + case '{': - state = start_state; return LEFTBRACE_TOKEN; - case '|': - state = or_state; - continue; + + case '|': // tokens: | |= || ||= + switch (nextchar()) + { + case '|': + switch (nextchar()) + { + case '=': + return LOGICALORASSIGN_TOKEN; + default: + retract(); + return LOGICALOR_TOKEN; + } + case '=': + return BITWISEORASSIGN_TOKEN; + default: + retract(); + return BITWISEOR_TOKEN; + } + case '}': - state = start_state; return RIGHTBRACE_TOKEN; + case '~': - state = start_state; return BITWISENOT_TOKEN; - case '+': - state = plus_state; - continue; + + case '+': // tokens: ++ += + + switch (nextchar()) + { + case '+': + return PLUSPLUS_TOKEN; + case '=': + return PLUSASSIGN_TOKEN; + default: + retract(); + return PLUS_TOKEN; + } + case '<': state = lessthan_state; continue; - case '=': - state = equal_state; - continue; + + case '=': // tokens: === == = + switch (nextchar()) + { + case '=': + switch (nextchar()) + { + case '=': + return STRICTEQUALS_TOKEN; + default: + retract(); + return EQUALS_TOKEN; + } + default: + retract(); + return ASSIGN_TOKEN; + } + case '>': state = greaterthan_state; - continue; - case 'a': - state = a_state; - continue; - case 'b': - state = b_state; - continue; - case 'c': - state = c_state; - continue; - case 'd': - state = d_state; - continue; - case 'e': - state = e_state; - continue; - case 'f': - state = f_state; - continue; - case 'g': - state = g_state; - continue; - case 'i': - state = i_state; - continue; - case 'l': - state = l_state; - continue; - case 'n': - state = n_state; - continue; - case 'p': - state = p_state; - continue; - case 'r': - state = r_state; - continue; - case 's': - state = s_state; - continue; - case 't': - state = t_state; - continue; - case 'u': - state = u_state; - continue; - case 'v': - state = v_state; - continue; - case 'w': - state = w_state; - continue; - case 'x': - state = x_state; - continue; - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'h': - case 'I': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'M': - case 'm': - case 'N': - case 'O': - case 'o': - case 'P': - case 'Q': - case 'q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - state = A_state; - continue; + continue; + case '0': state = zero_state; continue; - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': + + case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': state = decimalinteger_state; continue; - case ' ': - state = start_state; + + case ' ': // White space + case 0x0009: + case 0x000b: + case 0x000c: + case 0x00a0: continue; - case '\n': - state = start_state; + + case '\n': // Line terminators. + case '\r': + case 0x2028: + case 0x2029: isFirstTokenOnLine = true; continue; + case 0: - state = start_state; return EOS_TOKEN; + default: switch (input.classOfNext()) { @@ -657,6 +844,7 @@ case Lm: case Lo: case Nl: + maybe_reserved = false; state = A_state; continue; default: @@ -666,252 +854,75 @@ } } - /* - * prefix: - */ + /* + * prefix: + */ case A_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; + + while ( true ){ + int c = nextchar(); + if ( c >= 'a' && c <= 'z' ) + { continue; - case 0: - case ' ': - case '\n': - default: - switch (input.classOfNext()) - { - case Lu: - case Ll: - case Lt: - case Lm: - case Lo: - case Nl: - case Mn: - case Mc: - case Nd: - case Pc: - state = A_state; - continue; - default: - retract(); - state = start_state; - return makeTokenInstance(IDENTIFIER_TOKEN, input.copy()); - } - } - - /* - * prefix: - */ - - case eol_state: - isFirstTokenOnLine = true; - switch (nextchar()) - { - case '\n': - System.err.println("eating eol"); - state = eol_state; - continue; /* eat extra eols */ - default: - System.err.println("returning eol"); - state = start_state; /*first = input.positionOfNext();*/ - retract(); - state = start_state; + } + if ( (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '$' || c == '_' ){ + maybe_reserved = false; continue; - } + } + if ( c == 0 ) + { + break; + } - /* - * prefix: ' - */ - - case singlequote_state: - { - int c = nextchar(true /*get unnormalized*/); - // string literals can span multiple lines, which InputBuffer doesn't handle - // copy all characters in the string literal into a local buffer instead. - stringliteralbuf.append((char)c); - - switch (c) - { - case '\'': - state = start_state; - return makeTokenInstance(STRINGLITERAL_TOKEN, input.escapeString(stringliteralbuf, 0, stringliteralbuf.length()-1) ); - case '\\': - c = nextchar(true /*get unnormalized*/); - if (c == '\r') // escaped newline is the line continuation character. Continue string with input from next line. - { - c = nextchar(true /*get unnormalized*/); - if (c != '\n') - stringliteralbuf.deleteCharAt(stringliteralbuf.length()-1); - } - if (c == '\n') // escaped newline (or escacped CR,NL) is the line continuation character. Continue string with input from next line. - { - stringliteralbuf.deleteCharAt(stringliteralbuf.length()-1); - c = nextchar(true /*get unnormalized*/); - } - stringliteralbuf.append((char)c); - state = singlequote_state; + switch (input.classOfNext()) + { + case Lu: case Ll: case Lt: case Lm: case Lo: case Nl: case Mn: case Mc: case Nd: case Pc: + maybe_reserved = false; continue; - case '\n': - error(kError_Lexical_LineTerminatorInSingleQuotedStringLiteral); - state = start_state; - continue; - case 0: - error(kError_Lexical_EndOfStreamInStringLiteral); - state = start_state; - return EOS_TOKEN; - default: - state = singlequote_state; - continue; + } + break; } - } - - /* - * prefix: " - */ - - case doublequote_state: - { - int c = nextchar(true /*get unnormalized*/); - // string literals can span multiple lines, which InputBuffer doesn't handle - // copy all characters in the string literal into a local buffer instead. - stringliteralbuf.append((char)c); - - switch (c) + retract(); + state = start_state; + String s = input.copy(); + if ( maybe_reserved ) { - case '\"': - state = start_state; - return makeTokenInstance(STRINGLITERAL_TOKEN, input.escapeString(stringliteralbuf, 0, stringliteralbuf.length()-1)); - // case '\\': error(kError_Lexical_BackSlashInDoubleQuotedString); state = start_state; continue; - case '\\': - c = nextchar(true /*get unnormalized*/); - if (c == '\r') // escaped newline is the line continuation character. Continue string with input from next line. - { - c = nextchar(true /*get unnormalized*/); - if (c != '\n') - stringliteralbuf.deleteCharAt(stringliteralbuf.length()-1); - } - if (c == '\n') // escaped newline (or escaped CR,NL) is the line continuation character. Continue string with input from next line. - { - stringliteralbuf.deleteCharAt(stringliteralbuf.length()-1); - c = nextchar(true /*get unnormalized*/); - } - stringliteralbuf.append((char)c); - state = doublequote_state; - continue; - case '\n': - error(kError_Lexical_LineTerminatorInDoubleQuotedStringLiteral); - state = start_state; - continue; - case 0: - error(kError_Lexical_EndOfStreamInStringLiteral); - state = start_state; - return EOS_TOKEN; - default: - state = doublequote_state; - continue; + Integer i = reservedWord.get(s); + if ( i != null ) + return (int) i; + + //int r = screen_rsvd(); + //if ( r != 0 ) + // return r; } - } - /* - * prefix: 0 - * accepts: 0x... | 0X... | 01... | 0... | 0 - */ + //String s = input.copy(); + return makeTokenInstance(IDENTIFIER_TOKEN,s); + + /* + * prefix: 0 + * accepts: 0x... | 0X... | 01... | 0... | 0 + */ case zero_state: switch (nextchar()) { case 'x': case 'X': - switch(nextchar()) // check that first character is legal + switch(nextchar()) { - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - case '8': case '9': case 'a': case 'b': - case 'c': case 'd': case 'e': case 'f': - case 'A': case 'B': case 'C': case 'D': - case 'E': case 'F': - retract(); - state = hexinteger_state; - continue; - default: - error(kError_Lexical_General); - state = start_state; - continue; + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'A': case 'B': case 'C': case 'D': + case 'E': case 'F': + state = hexinteger_state; + break; + default: + state = start_state; + error(kError_Lexical_General); } - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': + continue; + + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '.': state = decimalinteger_state; continue; @@ -933,28 +944,9 @@ case hexinteger_state: switch (nextchar()) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'A': case 'B': case 'C': case 'D': + case 'E': case 'F': state = hexinteger_state; continue; default: @@ -971,16 +963,7 @@ case dot_state: switch (nextchar()) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': state = decimal_state; continue; case '.': @@ -997,17 +980,13 @@ */ case doubledot_state: - switch (nextchar()) - { - case '.': - state = start_state; + state = start_state; + if ( nextchar() == '.' ) return TRIPLEDOT_TOKEN; - default: - retract(); - state = start_state; - return DOUBLEDOT_TOKEN; - } + retract(); + return DOUBLEDOT_TOKEN; + /* * prefix: N * accepts: 0.123 | 1.23 | 123 | 1e23 | 1e-23 @@ -1016,16 +995,7 @@ case decimalinteger_state: switch (nextchar()) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': state = decimalinteger_state; continue; case '.': @@ -1049,16 +1019,7 @@ case decimal_state: switch (nextchar()) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': state = decimal_state; continue; case 'E': @@ -1079,16 +1040,7 @@ case exponentstart_state: switch (nextchar()) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '+': case '-': state = exponent_state; @@ -1108,16 +1060,7 @@ case exponent_state: switch (nextchar()) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': state = exponent_state; continue; default: @@ -1127,125 +1070,6 @@ } /* - * tokens: -- -= - - */ - - case minus_state: - switch (nextchar()) - { - case '-': - state = start_state; - return MINUSMINUS_TOKEN; - case '=': - state = start_state; - return MINUSASSIGN_TOKEN; - default: - retract(); - state = start_state; - return MINUS_TOKEN; - } - - /* - * prefix: ! - */ - - case not_state: - switch (nextchar()) - { - case '=': - state = notequals_state; - continue; - default: - retract(); - state = start_state; - return NOT_TOKEN; - } - - /* - * prefix: != - */ - - case notequals_state: - switch (nextchar()) - { - case '=': - state = start_state; - return STRICTNOTEQUALS_TOKEN; - default: - retract(); - state = start_state; - return NOTEQUALS_TOKEN; - } - - /* - * prefix: % - * tokens: %= % - */ - - case remainder_state: - switch (nextchar()) - { - case '=': - state = start_state; - return MODULUSASSIGN_TOKEN; - default: - retract(); - state = start_state; - return MODULUS_TOKEN; - } - - /* - * prefix: & - */ - - case and_state: - switch (nextchar()) - { - case '&': - state = logicaland_state; - continue; - case '=': - state = start_state; - return BITWISEANDASSIGN_TOKEN; - default: - retract(); - state = start_state; - return BITWISEAND_TOKEN; - } - - /* - * prefix: && - */ - - case logicaland_state: - switch (nextchar()) - { - case '=': - state = start_state; - return LOGICALANDASSIGN_TOKEN; - default: - retract(); - state = start_state; - return LOGICALAND_TOKEN; - } - - /* - * tokens: *= * - */ - - case star_state: - switch (nextchar()) - { - case '=': - state = start_state; - return MULTASSIGN_TOKEN; - default: - retract(); - state = start_state; - return MULT_TOKEN; - } - - /* * prefix: / */ @@ -1253,18 +1077,17 @@ switch (nextchar()) { case '/': - if (blockcommentbuf == null) blockcommentbuf = new StringBuffer(); + if (blockcommentbuf == null) blockcommentbuf = new StringBuilder(); state = linecomment_state; continue; case '*': - if (blockcommentbuf == null) blockcommentbuf = new StringBuffer(); + if (blockcommentbuf == null) blockcommentbuf = new StringBuilder(); blockcommentbuf.append("/*"); state = blockcommentstart_state; continue; default: { - retract(); /* since we didn't use the current character - for this decision. */ + retract(); // since we didn't use the current character for this decision. if (isSlashDivContext()) { state = slashdiv_state; @@ -1282,37 +1105,19 @@ */ case slashdiv_state: + state = start_state; switch (nextchar()) { case '>': - state = start_state; return XMLTAGENDEND_TOKEN; case '=': - state = start_state; return DIVASSIGN_TOKEN; default: retract(); - state = start_state; return DIV_TOKEN; } /* - * tokens: : :: - */ - - case colon_state: - switch (nextchar()) - { - case ':': - state = start_state; - return DOUBLECOLON_TOKEN; - default: - retract(); - state = start_state; - return COLON_TOKEN; - } - - /* * tokens: // */ @@ -1328,6 +1133,7 @@ continue; case 0: case '\n': + case '\r': error(kError_Lexical_General); state = start_state; continue; @@ -1457,13 +1263,11 @@ error(kError_Lexical_General); state = start_state; continue; - case 0: - case ' ': - case '\n': + default: retract(); state = start_state; - return makeTokenInstance( REGEXPLITERAL_TOKEN, input.copyWithoutInterpretingEscapedChars() ); + return makeTokenInstance( REGEXPLITERAL_TOKEN, input.copy(false) ); } /* * tokens: ^^ ^^= ^= ^ @@ -1503,61 +1307,6 @@ } /* - * prefix: | - */ - - case or_state: - switch (nextchar()) - { - case '|': - state = logicalor_state; - continue; - case '=': - state = start_state; - return BITWISEORASSIGN_TOKEN; - default: - retract(); - state = start_state; - return BITWISEOR_TOKEN; - } - - /* - * prefix: || - */ - - case logicalor_state: - switch (nextchar()) - { - case '=': - state = start_state; - return LOGICALORASSIGN_TOKEN; - default: - retract(); - state = start_state; - return LOGICALOR_TOKEN; - } - - /* - * tokens: ++ += + - */ - - case plus_state: - switch (nextchar()) - { - case '+': - state = start_state; - return PLUSPLUS_TOKEN; - case '=': - state = start_state; - return PLUSASSIGN_TOKEN; - default: - retract(); - state = start_state; - return PLUS_TOKEN; - } - - - /* * prefix: < */ @@ -1608,8 +1357,9 @@ } /* - * prefix: ': { state = start_state; - return makeTokenInstance(XMLMARKUP_TOKEN,getXMLText(startofxml,input.positionOfNext()+1)); + return makeTokenInstance(XMLMARKUP_TOKEN,getXMLText(startofxml,pos()-1)); } default: state = xmlcdata_state; continue; } @@ -1710,7 +1460,7 @@ case '>': { state = start_state; - return makeTokenInstance(XMLMARKUP_TOKEN,getXMLText(startofxml,input.positionOfNext()+1)); + return makeTokenInstance(XMLMARKUP_TOKEN,getXMLText(startofxml,pos()-1)); } default: error(kError_Lexical_General); state = start_state; continue; } @@ -1729,7 +1479,7 @@ case '>': { state = start_state; - return makeTokenInstance(XMLMARKUP_TOKEN,getXMLText(startofxml,input.positionOfNext()+1)); + return makeTokenInstance(XMLMARKUP_TOKEN,getXMLText(startofxml,pos()-1)); } default: error(kError_Lexical_General); state = start_state; continue; } @@ -1740,7 +1490,7 @@ case '<': case '{': { retract(); - String xmltext = getXMLText(startofxml,input.positionOfNext()+1); + String xmltext = getXMLText(startofxml,pos()-1); if( xmltext != null ) { state = start_state; @@ -1758,12 +1508,19 @@ case '?': state = xmlpi_state; continue; default: retract(); state = start_state; return LESSTHAN_TOKEN; } - case '{': state = start_state; return LEFTBRACE_TOKEN; + case '{': + state = start_state; + return LEFTBRACE_TOKEN; } } } - case 0: state = start_state; return EOS_TOKEN; - default: state = xmltext_state; continue; + case 0: + state = start_state; + return EOS_TOKEN; + + default: + state = xmltext_state; + continue; } } @@ -1772,7 +1529,7 @@ { case '{': // return XMLPART_TOKEN { - String xmltext = input.source(startofxml, input.positionOfNext()); + String xmltext = input.copy(startofxml, pos()-2); return makeTokenInstance(XMLPART_TOKEN, xmltext); } case '<': @@ -1781,13 +1538,13 @@ case '/': --level; nextchar(); - input.mark(); + mark(); retract(); state = endxmlname_state; continue; default: ++level; - state = xmlliteral_state; /*first = input.positionOfNext();*/ + state = xmlliteral_state; continue; } case '/': @@ -1799,7 +1556,7 @@ --level; if (level == 0) { - String xmltext = input.source(startofxml, input.positionOfNext() + 2); + String xmltext = input.copy(startofxml, pos()); state = start_state; return makeTokenInstance(XMLLITERAL_TOKEN, xmltext); } @@ -1817,6 +1574,7 @@ error(kError_Lexical_NoMatchingTag); state = start_state; continue; + default: continue; } @@ -1824,18 +1582,12 @@ case endxmlname_state: // scan name and compare it to start name switch (nextchar()) { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': + case 'A': case 'a': + case 'B': case 'b': + case 'C': case 'c': + case 'D': case 'd': + case 'E': case 'e': + case 'F': case 'f': case 'G': case 'g': case 'H': @@ -1909,7 +1661,7 @@ { xmltagname = null; } - String xmltext = input.source(startofxml, input.positionOfNext()); + String xmltext = input.copy(startofxml, pos()-2); return makeTokenInstance(XMLPART_TOKEN, xmltext); } case '>': @@ -1923,14 +1675,14 @@ { if (temp.equals(xmltagname)) { - String xmltext = input.source(startofxml, input.positionOfNext() + 2); + String xmltext = input.copy(startofxml, pos()); state = start_state; return makeTokenInstance(XMLLITERAL_TOKEN, xmltext); } } else { - String xmltext = input.source(startofxml, input.positionOfNext() + 2); + String xmltext = input.copy(startofxml, pos()); state = start_state; return makeTokenInstance(XMLLITERAL_TOKEN, xmltext); } @@ -1960,38 +1712,6 @@ } /* - * tokens: == = - */ - - case equal_state: - switch (nextchar()) - { - case '=': - state = equalequal_state; - break; - default: - retract(); - state = start_state; - return ASSIGN_TOKEN; - } - - /* - * tokens: === == - */ - - case equalequal_state: - switch (nextchar()) - { - case '=': - state = start_state; - return STRICTEQUALS_TOKEN; - default: - retract(); - state = start_state; - return EQUALS_TOKEN; - } - - /* * prefix: > */ @@ -2013,8265 +1733,30 @@ } /* - * prefix: >> + * prefix: >> >>> >>>= */ case rightshift_state: + state = start_state; switch (nextchar()) { case '>': - state = unsignedrightshift_state; - break; + switch (nextchar()) + { + case '=': + return UNSIGNEDRIGHTSHIFTASSIGN_TOKEN; + default: + retract(); + return UNSIGNEDRIGHTSHIFT_TOKEN; + } case '=': - state = start_state; return RIGHTSHIFTASSIGN_TOKEN; default: retract(); - state = start_state; return RIGHTSHIFT_TOKEN; } - - /* - * prefix: >>> - */ - - case unsignedrightshift_state: - switch (nextchar()) - { - case '=': - state = start_state; - return UNSIGNEDRIGHTSHIFTASSIGN_TOKEN; - default: - retract(); - state = start_state; - return UNSIGNEDRIGHTSHIFT_TOKEN; - } - - /* - * prefix: a - */ - - case a_state: - switch (nextchar()) - { - case 's': - state = as_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: as - */ - - case as_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return (HAS_ASOPERATOR) ? AS_TOKEN : makeTokenInstance(IDENTIFIER_TOKEN, input.copy()); - } - - /* - * prefix: b - */ - - case b_state: - switch (nextchar()) - { - case 'r': - state = br_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: bo - */ - - case bo_state: - switch (nextchar()) - { - case 'o': - state = boo_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: boo - */ - - case boo_state: - switch (nextchar()) - { - case 'l': - state = bool_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: bool - */ - - case bool_state: - switch (nextchar()) - { - case 'e': - state = boole_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: boole - */ - - case boole_state: - switch (nextchar()) - { - case 'a': - state = boolea_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: boolea - */ - - case boolea_state: - switch (nextchar()) - { - case 'n': - state = boolean_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: boolean - */ - - case boolean_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return makeTokenInstance(IDENTIFIER_TOKEN, input.copy()); - } - - /* - * prefix: br - */ - - case br_state: - switch (nextchar()) - { - case 'e': - state = bre_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: bre - */ - - case bre_state: - switch (nextchar()) - { - case 'a': - state = brea_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: brea - */ - - case brea_state: - switch (nextchar()) - { - case 'k': - state = break_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: break - */ - - case break_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return BREAK_TOKEN; - } - - /* - * prefix: by - */ - - case by_state: - switch (nextchar()) - { - case 't': - state = byt_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: byt - */ - - case byt_state: - switch (nextchar()) - { - case 'e': - state = byte_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: byte - */ - - case byte_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return makeTokenInstance(IDENTIFIER_TOKEN, input.copy()); - } - - /* - * prefix: c - */ - - case c_state: - switch (nextchar()) - { - case 'a': - state = ca_state; - continue; - case 'l': - state = cl_state; - continue; - case 'o': - state = co_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: ca - */ - - case ca_state: - switch (nextchar()) - { - case 's': - state = cas_state; - continue; - case 't': - state = cat_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: cas - */ - - case cas_state: - switch (nextchar()) - { - case 'e': - state = case_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: case - */ - - case case_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return CASE_TOKEN; - } - - /* - * prefix: cat - */ - - case cat_state: - switch (nextchar()) - { - case 'c': - state = catc_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: catc - */ - - case catc_state: - switch (nextchar()) - { - case 'h': - state = catch_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: catch - */ - - case catch_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return CATCH_TOKEN; - } - - /* - * prefix: ch - */ - - case ch_state: - switch (nextchar()) - { - case 'a': - state = cha_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: cha - */ - - case cha_state: - switch (nextchar()) - { - case 'r': - state = char_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: char - */ - - case char_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return makeTokenInstance(IDENTIFIER_TOKEN, input.copy()); - } - - /* - * prefix: cl - */ - - case cl_state: - switch (nextchar()) - { - case 'a': - state = cla_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: cla - */ - - case cla_state: - switch (nextchar()) - { - case 's': - state = clas_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: clas - */ - - case clas_state: - switch (nextchar()) - { - case 's': - state = class_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: class - */ - - case class_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return CLASS_TOKEN; - } - - /* - * prefix: co - */ - - case co_state: - switch (nextchar()) - { - case 'n': - state = con_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: con - */ - - case con_state: - switch (nextchar()) - { - case 's': - state = cons_state; - continue; - case 't': - state = cont_state; - continue; -/* case 'f': - state = conf_state; - continue; -*/ default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: cons - */ - - case cons_state: - switch (nextchar()) - { - case 't': - state = const_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: const - */ - - case const_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return CONST_TOKEN; - } - - /* - * prefix: conf - */ - case conf_state: - switch(nextchar()) - { - case 'i': - state = confi_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: confi - */ - case confi_state: - switch(nextchar()) - { - case 'g': - state = config_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: config - */ - - case config_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return CONFIG_TOKEN; - } - - /* - * prefix: cont - */ - - case cont_state: - switch (nextchar()) - { - case 'i': - state = conti_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: conti - */ - - case conti_state: - switch (nextchar()) - { - case 'n': - state = contin_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: contin - */ - - case contin_state: - switch (nextchar()) - { - case 'u': - state = continu_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: continu - */ - - case continu_state: - switch (nextchar()) - { - case 'e': - state = continue_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: continue - */ - - case continue_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return CONTINUE_TOKEN; - } - - /* - * prefix: d - */ - - case d_state: - switch (nextchar()) - { - case 'e': - state = de_state; - continue; - case 'o': - state = do_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: de - */ - - case de_state: - switch (nextchar()) - { - case 'b': - state = deb_state; - continue; - case 'f': - state = def_state; - continue; - case 'l': - state = del_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: deb - */ - - case deb_state: - switch (nextchar()) - { - case 'u': - state = debu_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: debu - */ - - case debu_state: - switch (nextchar()) - { - case 'g': - state = debug_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: debug - */ - - case debug_state: - switch (nextchar()) - { - case 'g': - state = debugg_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: debugg - */ - - case debugg_state: - switch (nextchar()) - { - case 'e': - state = debugge_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: debugge - */ - - case debugge_state: - switch (nextchar()) - { - case 'r': - state = debugger_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: debugger - */ - - case debugger_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - retract(); - state = start_state; - return makeTokenInstance(IDENTIFIER_TOKEN, input.copy()); - } - - /* - * prefix: def - */ - - case def_state: - switch (nextchar()) - { - case 'a': - state = defa_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: defa - */ - - case defa_state: - switch (nextchar()) - { - case 'u': - state = defau_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: defau - */ - - case defau_state: - switch (nextchar()) - { - case 'l': - state = defaul_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: defaul - */ - - case defaul_state: - switch (nextchar()) - { - case 't': - state = default_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: default - */ - - case default_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return DEFAULT_TOKEN; - } - - /* - * prefix: del - */ - - case del_state: - switch (nextchar()) - { - case 'e': - state = dele_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: dele - */ - - case dele_state: - switch (nextchar()) - { - case 't': - state = delet_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: delet - */ - - case delet_state: - switch (nextchar()) - { - case 'e': - state = delete_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: delete - */ - - case delete_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return DELETE_TOKEN; - } - - /* - * prefix: do - */ - - case do_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return DO_TOKEN; - } - - /* - * prefix: dou - */ - - case dou_state: - switch (nextchar()) - { - case 'b': - state = doub_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: doub - */ - - case doub_state: - switch (nextchar()) - { - case 'l': - state = doubl_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: doubl - */ - - case doubl_state: - switch (nextchar()) - { - case 'e': - state = double_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: double - */ - - case double_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return makeTokenInstance(IDENTIFIER_TOKEN, input.copy()); - } - - /* - * prefix: e - */ - - case e_state: - switch (nextchar()) - { - case 'l': - state = el_state; - continue; - case 'v': - state = ev_state; - continue; - case 'x': - state = ex_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: el - */ - - case el_state: - switch (nextchar()) - { - case 's': - state = els_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: els - */ - - case els_state: - switch (nextchar()) - { - case 'e': - state = else_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: else - */ - - case else_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return ELSE_TOKEN; - } - - /* - * prefix: ev - */ - - case ev_state: - switch (nextchar()) - { - case 'a': - state = eva_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: eva - */ - - case eva_state: - switch (nextchar()) - { - case 'l': - state = eval_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: eval - */ - - case eval_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - retract(); - state = start_state; - return makeTokenInstance(IDENTIFIER_TOKEN, input.copy()); - } - - /* - * prefix: ex - */ - - case ex_state: - switch (nextchar()) - { - case 't': - state = ext_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: ext - */ - - case ext_state: - switch (nextchar()) - { - case 'e': - state = exte_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: exte - */ - - case exte_state: - switch (nextchar()) - { - case 'n': - state = exten_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: exten - */ - - case exten_state: - switch (nextchar()) - { - case 'd': - state = extend_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: extend - */ - - case extend_state: - switch (nextchar()) - { - case 's': - state = extends_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: extends - */ - - case extends_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return EXTENDS_TOKEN; - } - - /* - * prefix: f - */ - - case f_state: - switch (nextchar()) - { - case 'a': - state = fa_state; - continue; - case 'i': - state = fi_state; - continue; - case 'o': - state = fo_state; - continue; - case 'u': - state = fu_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: fa - */ - - case fa_state: - switch (nextchar()) - { - case 'l': - state = fal_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: fal - */ - - case fal_state: - switch (nextchar()) - { - case 's': - state = fals_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: fals - */ - - case fals_state: - switch (nextchar()) - { - case 'e': - state = false_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: false - */ - - case false_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return FALSE_TOKEN; - } - - /* - * prefix: fi - */ - - case fi_state: - switch (nextchar()) - { - case 'n': - state = fin_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: fin - */ - - case fin_state: - switch (nextchar()) - { - case 'a': - state = fina_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: fina - */ - - case fina_state: - switch (nextchar()) - { - case 'l': - state = final_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: final - */ - - case final_state: - switch (nextchar()) - { - case 'l': - state = finall_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: finall - */ - - case finall_state: - switch (nextchar()) - { - case 'y': - state = finally_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: finally - */ - - case finally_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return FINALLY_TOKEN; - } - - /* - * prefix: fl - */ - - case fl_state: - switch (nextchar()) - { - case 'o': - state = flo_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: flo - */ - - case flo_state: - switch (nextchar()) - { - case 'a': - state = floa_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: floa - */ - - case floa_state: - switch (nextchar()) - { - case 't': - state = float_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: float - */ - - case float_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return makeTokenInstance(IDENTIFIER_TOKEN, input.copy()); - } - - /* - * prefix: fo - */ - - case fo_state: - switch (nextchar()) - { - case 'r': - state = for_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: for - */ - - case for_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return FOR_TOKEN; - } - - /* - * prefix: fu - */ - - case fu_state: - switch (nextchar()) - { - case 'n': - state = fun_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: fun - */ - - case fun_state: - switch (nextchar()) - { - case 'c': - state = func_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: func - */ - - case func_state: - switch (nextchar()) - { - case 't': - state = funct_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: funct - */ - - case funct_state: - switch (nextchar()) - { - case 'i': - state = functi_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: functi - */ - - case functi_state: - switch (nextchar()) - { - case 'o': - state = functio_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: functio - */ - - case functio_state: - switch (nextchar()) - { - case 'n': - state = function_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: function - */ - - case function_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return FUNCTION_TOKEN; - } - - /* - * prefix: g - */ - - case g_state: - switch (nextchar()) - { - case 'e': - state = ge_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: ge - */ - - case ge_state: - switch (nextchar()) - { - case 't': - state = get_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: get - */ - - case get_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return GET_TOKEN; - } - - /* - * prefix: i - */ - - case i_state: - switch (nextchar()) - { - case 'f': - state = if_state; - continue; - case 'm': - state = im_state; - continue; - case 'n': - state = in_state; - continue; - case 's': - state = is_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: if - */ - - case if_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return IF_TOKEN; - } - - /* - * prefix: im - */ - - case im_state: - switch (nextchar()) - { - case 'p': - state = imp_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: imp - */ - - case imp_state: - switch (nextchar()) - { - case 'l': - state = impl_state; - continue; - case 'o': - state = impo_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: impl - */ - - case impl_state: - switch (nextchar()) - { - case 'e': - state = imple_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: imple - */ - - case imple_state: - switch (nextchar()) - { - case 'm': - state = implem_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: implem - */ - - case implem_state: - switch (nextchar()) - { - case 'e': - state = impleme_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: impleme - */ - - case impleme_state: - switch (nextchar()) - { - case 'n': - state = implemen_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: implemen - */ - - case implemen_state: - switch (nextchar()) - { - case 't': - state = implement_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: implement - */ - - case implement_state: - switch (nextchar()) - { - case 's': - state = implements_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: implements - */ - - case implements_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return IMPLEMENTS_TOKEN; - } - - /* - * prefix: impo - */ - - case impo_state: - switch (nextchar()) - { - case 'r': - state = impor_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: impor - */ - - case impor_state: - switch (nextchar()) - { - case 't': - state = import_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: import - */ - - case import_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return IMPORT_TOKEN; - } - - /* - * prefix: in - */ - - case in_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 'T': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - case 'c': - state = inc_state; - continue; - case 's': - state = ins_state; - continue; - case 't': - state = int_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return IN_TOKEN; - } - - /* - * prefix: inc - */ - - case inc_state: - switch (nextchar()) - { - case 'l': - state = incl_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: incl - */ - - case incl_state: - switch (nextchar()) - { - case 'u': - state = inclu_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: inclu - */ - - case inclu_state: - switch (nextchar()) - { - case 'd': - state = includ_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: includ - */ - - case includ_state: - switch (nextchar()) - { - case 'e': - state = include_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: include - */ - - case include_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return INCLUDE_TOKEN; - } - - /* - * prefix: ins - */ - - case ins_state: - switch (nextchar()) - { - case 't': - state = inst_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: inst - */ - - case inst_state: - switch (nextchar()) - { - case 'a': - state = insta_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: insta - */ - - case insta_state: - switch (nextchar()) - { - case 'n': - state = instan_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: instan - */ - - case instan_state: - switch (nextchar()) - { - case 'c': - state = instanc_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: instanc - */ - - case instanc_state: - switch (nextchar()) - { - case 'e': - state = instance_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: instance - */ - - case instance_state: - switch (nextchar()) - { - case 'o': - state = instanceo_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: instanceo - */ - - case instanceo_state: - switch (nextchar()) - { - case 'f': - state = instanceof_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: instanceof - */ - - case instanceof_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return INSTANCEOF_TOKEN; - } - - /* - * prefix: int - */ - - case int_state: - switch (nextchar()) - { - case 'e': - state = inte_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: inte - */ - - case inte_state: - switch (nextchar()) - { - case 'r': - state = inter_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: inter - */ - - case inter_state: - switch (nextchar()) - { - case 'f': - state = interf_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: interf - */ - - case interf_state: - switch (nextchar()) - { - case 'a': - state = interfa_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: interfa - */ - - case interfa_state: - switch (nextchar()) - { - case 'c': - state = interfac_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: interfac - */ - - case interfac_state: - switch (nextchar()) - { - case 'e': - state = interface_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: interface - */ - - case interface_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return INTERFACE_TOKEN; - } - - /* - * prefix: is - */ - - case is_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return (HAS_ISOPERATOR) ? IS_TOKEN : makeTokenInstance(IDENTIFIER_TOKEN, input.copy()); - } - - /* - * prefix: l - */ - - case l_state: - switch (nextchar()) - { - case '\0': - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: lo - */ - - case lo_state: - switch (nextchar()) - { - case 'n': - state = lon_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: lon - */ - - case lon_state: - switch (nextchar()) - { - case 'g': - state = long_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: long - */ - - case long_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return makeTokenInstance(IDENTIFIER_TOKEN, input.copy()); - } - - /* - * prefix: n - */ - - case n_state: - switch (nextchar()) - { - case 'a': - state = na_state; - continue; - case 'e': - state = ne_state; - continue; - case 'u': - state = nu_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: na - */ - - case na_state: - switch (nextchar()) - { - case 't': - state = nat_state; - continue; - case 'm': - state = nam_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: nam - */ - - case nam_state: - switch (nextchar()) - { - case 'e': - state = name_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: name - */ - - case name_state: - switch (nextchar()) - { - case 's': - state = names_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: names - */ - - case names_state: - switch (nextchar()) - { - case 'p': - state = namesp_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: namesp - */ - - case namesp_state: - switch (nextchar()) - { - case 'a': - state = namespa_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: namespa - */ - - case namespa_state: - switch (nextchar()) - { - case 'c': - state = namespac_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: namespac - */ - - case namespac_state: - switch (nextchar()) - { - case 'e': - state = namespace_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: namespace - */ - - case namespace_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return NAMESPACE_TOKEN; - } - - /* - * prefix: nat - */ - - case nat_state: - switch (nextchar()) - { - case 'i': - state = nati_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: nati - */ - - case nati_state: - switch (nextchar()) - { - case 'v': - state = nativ_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: nativ - */ - - case nativ_state: - switch (nextchar()) - { - case 'e': - state = native_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: native - */ - - case native_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return makeTokenInstance(IDENTIFIER_TOKEN, input.copy());//return native_token; - } - - /* - * prefix: ne - */ - - case ne_state: - switch (nextchar()) - { - case 'w': - state = new_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: new - */ - - case new_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return NEW_TOKEN; - } - - /* - * prefix: nu - */ - - case nu_state: - switch (nextchar()) - { - case 'l': - state = nul_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: nul - */ - - case nul_state: - switch (nextchar()) - { - case 'l': - state = null_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: null - */ - - case null_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return NULL_TOKEN; - } - - /* - * prefix: p - */ - - case p_state: - switch (nextchar()) - { - case 'a': - state = pa_state; - continue; - case 'r': - state = pr_state; - continue; - case 'u': - state = pu_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: pa - */ - - case pa_state: - switch (nextchar()) - { - case 'c': - state = pac_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: pac - */ - - case pac_state: - switch (nextchar()) - { - case 'k': - state = pack_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: pack - */ - - case pack_state: - switch (nextchar()) - { - case 'a': - state = packa_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: packa - */ - - case packa_state: - switch (nextchar()) - { - case 'g': - state = packag_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: packag - */ - - case packag_state: - switch (nextchar()) - { - case 'e': - state = package_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: package - */ - - case package_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return PACKAGE_TOKEN; - } - - /* - * prefix: pr - */ - - case pr_state: - switch (nextchar()) - { - case 'i': - state = pri_state; - continue; - case 'o': - state = pro_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: pri - */ - - case pri_state: - switch (nextchar()) - { - case 'v': - state = priv_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: priv - */ - - case priv_state: - switch (nextchar()) - { - case 'a': - state = priva_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: priva - */ - - case priva_state: - switch (nextchar()) - { - case 't': - state = privat_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: privat - */ - - case privat_state: - switch (nextchar()) - { - case 'e': - state = private_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: private - */ - - case private_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return PRIVATE_TOKEN; - } - - /* - * prefix: pro - */ - - case pro_state: - switch (nextchar()) - { - case 't': - state = prot_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: prot - */ - - case prot_state: - switch (nextchar()) - { - case 'e': - state = prote_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: prote - */ - - case prote_state: - switch (nextchar()) - { - case 'c': - state = protec_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: protec - */ - - case protec_state: - switch (nextchar()) - { - case 't': - state = protect_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: protect - */ - - case protect_state: - switch (nextchar()) - { - case 'e': - state = protecte_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: protecte - */ - - case protecte_state: - switch (nextchar()) - { - case 'd': - state = protected_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: protected - */ - - case protected_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return PROTECTED_TOKEN; - } - - /* - * prefix: public - */ - - case pu_state: - switch (nextchar()) - { - case 'b': - state = pub_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: pub - */ - - case pub_state: - switch (nextchar()) - { - case 'l': - state = publ_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: publ - */ - - case publ_state: - switch (nextchar()) - { - case 'i': - state = publi_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: publi - */ - - case publi_state: - switch (nextchar()) - { - case 'c': - state = public_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: public - */ - - case public_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return PUBLIC_TOKEN; - } - - /* - * prefix: r - */ - - case r_state: - switch (nextchar()) - { - case 'e': - state = re_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: re - */ - - case re_state: - switch (nextchar()) - { - case 't': - state = ret_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: ret - */ - - case ret_state: - switch (nextchar()) - { - case 'u': - state = retu_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: retu - */ - - case retu_state: - switch (nextchar()) - { - case 'r': - state = retur_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: retur - */ - - case retur_state: - switch (nextchar()) - { - case 'n': - state = return_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: return - */ - - case return_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return RETURN_TOKEN; - } - - /* - * prefix: s - */ - - case s_state: - switch (nextchar()) - { - case 'e': - state = se_state; - continue; - case 't': - state = st_state; - continue; - case 'u': - state = su_state; - continue; - case 'w': - state = sw_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: se - */ - - case se_state: - switch (nextchar()) - { - case 't': - state = set_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: get - */ - - case set_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return SET_TOKEN; - } - - /* - * prefix: sh - */ - - case sh_state: - switch (nextchar()) - { - case 'o': - state = sho_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: sho - */ - - case sho_state: - switch (nextchar()) - { - case 'r': - state = shor_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: shor - */ - - case shor_state: - switch (nextchar()) - { - case 't': - state = short_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: short - */ - - case short_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return makeTokenInstance(IDENTIFIER_TOKEN, input.copy()); - } - - /* - * prefix: st - */ - - case st_state: - switch (nextchar()) - { - case 'a': - state = sta_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: sta - */ - - case sta_state: - switch (nextchar()) - { - case 't': - state = stat_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: stat - */ - - case stat_state: - switch (nextchar()) - { - case 'i': - state = stati_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: stati - */ - - case stati_state: - switch (nextchar()) - { - case 'c': - state = static_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: static - */ - - case static_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return makeTokenInstance(IDENTIFIER_TOKEN, input.copy()); - } - - /* - * prefix: su - */ - - case su_state: - switch (nextchar()) - { - case 'p': - state = sup_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: sup - */ - - case sup_state: - switch (nextchar()) - { - case 'e': - state = supe_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: supe - */ - - case supe_state: - switch (nextchar()) - { - case 'r': - state = super_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: super - */ - - case super_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return SUPER_TOKEN; - } - - /* - * prefix: sw - */ - - case sw_state: - switch (nextchar()) - { - case 'i': - state = swi_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: swi - */ - - case swi_state: - switch (nextchar()) - { - case 't': - state = swit_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: swit - */ - - case swit_state: - switch (nextchar()) - { - case 'c': - state = switc_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: switc - */ - - case switc_state: - switch (nextchar()) - { - case 'h': - state = switch_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: switch - */ - - case switch_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return SWITCH_TOKEN; - } - - /* - * prefix: t - */ - - case t_state: - switch (nextchar()) - { - case 'h': - state = th_state; - continue; - case 'r': - state = tr_state; - continue; - case 'y': - state = ty_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: th - */ - - case th_state: - switch (nextchar()) - { - case 'i': - state = thi_state; - continue; - case 'r': - state = thr_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: thi - */ - - case thi_state: - switch (nextchar()) - { - case 's': - state = this_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: this - */ - - case this_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return THIS_TOKEN; - } - - /* - * prefix: thr - */ - - case thr_state: - switch (nextchar()) - { - case 'o': - state = thro_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: thro - */ - - case thro_state: - switch (nextchar()) - { - case 'w': - state = throw_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: throw - */ - - case throw_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return THROW_TOKEN; - } - - /* - * prefix: tr - */ - - case tr_state: - switch (nextchar()) - { - case 'u': - state = tru_state; - continue; - case 'y': - state = try_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: tru - */ - - case tru_state: - switch (nextchar()) - { - case 'e': - state = true_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: true - */ - - case true_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return TRUE_TOKEN; - } - - /* - * prefix: try - */ - - case try_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return TRY_TOKEN; - } - - /* - * prefix: ty - */ - - case ty_state: - switch (nextchar()) - { - case 'p': - state = typ_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: typ - */ - - case typ_state: - switch (nextchar()) - { - case 'e': - state = type_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: type - */ - - case type_state: - switch (nextchar()) - { - case 'o': - state = typeo_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: typeo - */ - - case typeo_state: - switch (nextchar()) - { - case 'f': - state = typeof_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: typeof - */ - - case typeof_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return TYPEOF_TOKEN; - } - - /* - * prefix: u - */ - - case u_state: - switch (nextchar()) - { - case 's': - state = us_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: us - */ - - case us_state: - switch (nextchar()) - { - case 'e': - state = use_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: use - */ - - case use_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return USE_TOKEN; - } - - /* - * prefix: v - */ - - case v_state: - switch (nextchar()) - { - case 'a': - state = va_state; - continue; - case 'o': - state = vo_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: va - */ - - case va_state: - switch (nextchar()) - { - case 'r': - state = var_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: var - */ - - case var_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return VAR_TOKEN; - } - - /* - * prefix: vo - */ - - case vo_state: - switch (nextchar()) - { - case 'i': - state = voi_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: voi - */ - - case voi_state: - switch (nextchar()) - { - case 'd': - state = void_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: void - */ - - case void_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return VOID_TOKEN; - } - - /* - * prefix: w - */ - - case w_state: - switch (nextchar()) - { - case 'h': - state = wh_state; - continue; - case 'i': - state = wi_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: wh - */ - - case wh_state: - switch (nextchar()) - { - case 'i': - state = whi_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: whi - */ - - case whi_state: - switch (nextchar()) - { - case 'l': - state = whil_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: whil - */ - - case whil_state: - switch (nextchar()) - { - case 'e': - state = while_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: while - */ - - case while_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return WHILE_TOKEN; - } - - /* - * prefix: wi - */ - - case wi_state: - switch (nextchar()) - { - case 't': - state = wit_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: wit - */ - - case wit_state: - switch (nextchar()) - { - case 'h': - state = with_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: with - */ - - case with_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = A_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return WITH_TOKEN; - } - - - /* - * prefix: x - */ - - case x_state: - switch ( nextchar() ) - { - case 'm': state = xm_state; continue; - default: retract(); state = A_state; continue; - } - - /* - * prefix: xm - */ - - case xm_state: - switch ( nextchar() ) - { - case 'l': state = xml_state; continue; - default: retract(); state = A_state; continue; - } - - /* - * prefix: xml - */ - - case xml_state: - switch ( nextchar() ) - { - case 'A': case 'a': case 'B': case 'b': case 'C': case 'c': - case 'D': case 'd': case 'E': case 'e': case 'F': case 'f': - case 'G': case 'g': case 'H': case 'h': case 'I': case 'i': - case 'J': case 'j': case 'K': case 'k': case 'L': case 'l': - case 'M': case 'm': case 'N': case 'n': case 'O': case 'o': - case 'P': case 'p': case 'Q': case 'q': case 'R': case 'r': - case 'S': case 's': case 'T': case 't': case 'U': case 'u': - case 'V': case 'v': case 'W': case 'w': case 'X': case 'x': - case 'Y': case 'y': case 'Z': case 'z': case '$': case '_': - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - state = A_state; continue; - default: retract(); state = start_state; return makeTokenInstance( IDENTIFIER_TOKEN, input.copy() ); - } - - /* - * prefix: # - */ - - case pound_state: - switch (nextchar()) - { - case 'i': - state = pound_i_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: #i - */ - - case pound_i_state: - switch (nextchar()) - { - case 'n': - state = pound_in_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: #in - */ - - case pound_in_state: - switch (nextchar()) - { - case 'c': - state = pound_inc_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: #inc - */ - - case pound_inc_state: - switch (nextchar()) - { - case 'l': - state = pound_incl_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: #incl - */ - - case pound_incl_state: - switch (nextchar()) - { - case 'u': - state = pound_inclu_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: #inclu - */ - - case pound_inclu_state: - switch (nextchar()) - { - case 'd': - state = pound_includ_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: #includ - */ - - case pound_includ_state: - switch (nextchar()) - { - case 'e': - state = pound_include_state; - continue; - default: - retract(); - state = A_state; - continue; - } - - /* - * prefix: #include - */ - - case pound_include_state: - switch (nextchar()) - { - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - case '$': - case '_': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - state = error_state; - continue; - default: - if( isNextIdentifierPart() ) - { - state = A_state; - continue; - } - retract(); - state = start_state; - return INCLUDE_TOKEN; - } - - /* + + /* * prefix: /* */ @@ -10281,47 +1766,53 @@ blockcommentbuf.append(c); switch ( c ) { - case '*': - switch(nextchar()) - { - case '/': - { - state = start_state; - return makeTokenInstance( BLOCKCOMMENT_TOKEN, new String()); - } - default: retract(); state = doccomment_state; continue; - } - case '\n': isFirstTokenOnLine = true; - state = blockcomment_state; continue; - case 0: error(kError_BlockCommentNotTerminated); state = start_state; continue; - default: state = blockcomment_state; continue; + case '*': + if ( nextchar() == '/' ){ + state = start_state; + return makeTokenInstance( BLOCKCOMMENT_TOKEN, new String()); + } + retract(); + state = doccomment_state; + continue; + + case 0: + error(kError_BlockCommentNotTerminated); + state = start_state; + continue; + + case '\n': + case '\r': + isFirstTokenOnLine = true; + default: + state = blockcomment_state; + continue; } } /* - * prefix: /** - */ + * prefix: /** + */ case doccomment_state: - { + { int c = nextchar(); blockcommentbuf.append(c); switch ( c ) { - case '*': state = doccommentstar_state; continue; - case '@': - if (doctextbuf == null) doctextbuf = getDocTextBuffer(doctagname); - if( doctagname.length() > 0 ) { doctextbuf.append("]]>"); }; - doctagname = ""; - state = doccommenttag_state; continue; - case '\n': isFirstTokenOnLine = true; - if (doctextbuf == null) doctextbuf = getDocTextBuffer(doctagname); - doctextbuf.append('\n'); - state = doccomment_state; continue; - case 0: error(kError_BlockCommentNotTerminated); state = start_state; continue; - default: - if (doctextbuf == null) doctextbuf = getDocTextBuffer(doctagname); - doctextbuf.append((char)(c)); state = doccomment_state; continue; + case '*': state = doccommentstar_state; continue; + case '@': + if (doctextbuf == null) doctextbuf = getDocTextBuffer(doctagname); + if( doctagname.length() > 0 ) { doctextbuf.append("]]>"); }; + doctagname = ""; + state = doccommenttag_state; continue; + case '\r': case '\n': isFirstTokenOnLine = true; + if (doctextbuf == null) doctextbuf = getDocTextBuffer(doctagname); + doctextbuf.append('\n'); + state = doccomment_state; continue; + case 0: error(kError_BlockCommentNotTerminated); state = start_state; continue; + default: + if (doctextbuf == null) doctextbuf = getDocTextBuffer(doctagname); + doctextbuf.append((char)(c)); state = doccomment_state; continue; } } @@ -10355,7 +1846,7 @@ switch ( c ) { case '*': state = doccommentstar_state; continue; - case ' ': case '\n': + case ' ': case '\r': case '\n': { if (doctextbuf == null) doctextbuf = getDocTextBuffer(doctagname); if( doctagname.length() > 0 ) { doctextbuf.append("\n<").append(doctagname).append(">(); } - cx.error(node.baseclass.pos()-1, kError_ForwardReferenceToBaseClass,baseClassNode.name.name); + cx.error(node.baseclass.pos(), kError_ForwardReferenceToBaseClass,baseClassNode.name.name); baseClassNode.deferred_subclasses.add(node); return null; } @@ -4744,10 +4744,14 @@ public boolean checkFeature(Context cx, Node node) { - int pos = node.pos(); - int line = cx.input.getLnNum(pos); - int col = cx.input.getColPos(pos, line); - setPosition(line,col,pos); + if (cx.input != null) + { + int pos = node.pos(); + int line = cx.input.getLnNum(pos); + int col = cx.input.getColPos(pos); + setPosition(line,col,pos); + } + return true; //Evaluator::checkFeature(cx,node); } Index: modules/asc/src/java/macromedia/asc/semantics/ConfigurationEvaluator.java =================================================================== --- modules/asc/src/java/macromedia/asc/semantics/ConfigurationEvaluator.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/semantics/ConfigurationEvaluator.java (working copy) @@ -1134,7 +1134,7 @@ { if( !isTopLevel() ) { - cx.error(node.pos()-1, kError_InvalidConfigLocation); + cx.error(node.pos(), kError_InvalidConfigLocation); return null; } @@ -1150,12 +1150,12 @@ Slot slot = obj.getSlot(cx,slot_id); if( node.kind != Tokens.CONST_TOKEN) { - cx.error(node.attrs.pos()-1,kError_NonConstConfigVar ); + cx.error(node.attrs.pos(),kError_NonConstConfigVar ); } slot.setConst(true); if( node.initializer == null ) { - cx.error(node.pos()-1, kError_NonConstantConfigInit); + cx.error(node.pos(), kError_NonConstantConfigInit); } else { @@ -1166,7 +1166,7 @@ fold_expressions = old_fold; if( init_val == null || !init_val.hasValue() ) { - cx.error(node.initializer.pos()-1, kError_NonConstantConfigInit); + cx.error(node.initializer.pos(), kError_NonConstantConfigInit); } slot.setValue(init_val); } @@ -1174,7 +1174,7 @@ } else { - cx.error(node.variable.identifier.pos()-1, kError_ConflictingNameInNamespace, ref.name, ref.namespaces.at(0).name); + cx.error(node.variable.identifier.pos(), kError_ConflictingNameInNamespace, ref.name, ref.namespaces.at(0).name); } } else @@ -1280,7 +1280,7 @@ if( !isTopLevel() ) { - cx.error(node.pos()-1, kError_InvalidConfigLocation); + cx.error(node.pos(), kError_InvalidConfigLocation); return null; } Namespaces namespaces = new Namespaces(); Index: modules/asc/src/java/macromedia/asc/semantics/ConstantEvaluator.java =================================================================== --- modules/asc/src/java/macromedia/asc/semantics/ConstantEvaluator.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/semantics/ConstantEvaluator.java (working copy) @@ -478,7 +478,7 @@ ObjectValue base = node.ref.getBase(); if( base == null ) { - if( cx.statics.withDepth == -1 ) cx.error(node.pos()-1, kError_Strict_PlainUndefinedMethod,node.ref.name); + if( cx.statics.withDepth == -1 ) cx.error(node.pos(), kError_Strict_PlainUndefinedMethod,node.ref.name); } // Note: Function is dynamic, but methods of a class are MethodClosures, a non-dynamic subclass of Function. // The compiler doesn't have an internal representation of MethodClosure, though the only reason it would @@ -492,9 +492,9 @@ String className = (base instanceof TypeValue) ? "Class" : base.getType(cx).getName(cx).toString(); if (base.hasNameUnqualified(cx, node.ref.name, GET_TOKEN)) - cx.error(node.pos()-1, kError_InaccessibleMethodReference, node.ref.name, className); + cx.error(node.pos(), kError_InaccessibleMethodReference, node.ref.name, className); else - cx.error(node.pos()-1, kError_Strict_UndefinedMethod, node.ref.name, className); + cx.error(node.pos(), kError_Strict_UndefinedMethod, node.ref.name, className); } } } @@ -513,7 +513,7 @@ if ( callSlot != null && getSlot != null && getSlot.declaredBy != null && ((getSlot.declaredBy.builder instanceof ClassBuilder) || (getSlot.declaredBy.builder instanceof InstanceBuilder)) ) { - cx.error(node.pos()-1, kError_MethodIsNotAConstructor); + cx.error(node.pos(), kError_MethodIsNotAConstructor); } } type = type != null ? type : cx.noType().getDefaultTypeInfo(); @@ -522,7 +522,7 @@ Builder bui = slot.getType().getBuilder(); if (bui instanceof ClassBuilder && ((ClassBuilder)bui).is_interface) { - cx.error(node.pos()-1, kError_CannotInstantiateInterface); + cx.error(node.pos(), kError_CannotInstantiateInterface); } } } @@ -587,7 +587,7 @@ if (slot.getDeclStyles().at(expected_num_args-1) == PARAM_Required) break; } - StringBuffer err_arg_buf = new StringBuffer(); + StringBuilder err_arg_buf = new StringBuilder(); err_arg_buf.append(expected_num_args); cx.error(node.pos(), kError_WrongNumberOfArguments, err_arg_buf.toString()); } @@ -675,9 +675,9 @@ if( base != null && (!base.isDynamic() || (base.getType(cx).getTypeValue() == cx.functionType() && !(base.builder instanceof GlobalBuilder)) ) ) { if (base.hasNameUnqualified(cx, node.ref.name, GET_TOKEN)) - cx.error(node.expr.pos()-1, kError_InaccessiblePropertyReference, node.ref.name, base.getType(cx).getName(cx).toString()); + cx.error(node.expr.pos(), kError_InaccessiblePropertyReference, node.ref.name, base.getType(cx).getName(cx).toString()); else - cx.error(node.expr.pos()-1, kError_UndefinedProperty,node.ref.name,base.getType(cx).getName(cx).toString()); + cx.error(node.expr.pos(), kError_UndefinedProperty,node.ref.name,base.getType(cx).getName(cx).toString()); } } @@ -686,7 +686,7 @@ if( slot != null && !in_with && !isDynamic ) { - cx.error(node.expr.pos()-1, kError_Strict_AttemptToDeleteFixedProperty, node.ref.name); + cx.error(node.expr.pos(), kError_Strict_AttemptToDeleteFixedProperty, node.ref.name); } } @@ -743,9 +743,9 @@ if( base != null && (!base.isDynamic() || (base.getType(cx).getTypeValue() == cx.functionType() && !(base.builder instanceof GlobalBuilder)) ) ) { if (base.hasNameUnqualified(cx, node.ref.name, GET_TOKEN)) - cx.error(node.pos()-1, kError_InaccessiblePropertyReference, node.ref.name, base.getType(cx).getName(cx).toString()); + cx.error(node.pos(), kError_InaccessiblePropertyReference, node.ref.name, base.getType(cx).getName(cx).toString()); else - cx.error(node.pos()-1, kError_UndefinedProperty,node.ref.name,base.getType(cx).getName(cx).toString()); + cx.error(node.pos(), kError_UndefinedProperty,node.ref.name,base.getType(cx).getName(cx).toString()); } } } @@ -770,7 +770,7 @@ if (node.base == null && !node.expr.isLValue()) { - cx.error(node.pos()-1,kError_AssignmentToNonRefVar); + cx.error(node.pos(),kError_AssignmentToNonRefVar); } else { @@ -852,7 +852,7 @@ { if (slot.getObjectValue() != null) // slot will only have a value if this is a class slot { - cx.error(node.pos()-1, kError_AssignmentToDefinedClass, node.ref.name); + cx.error(node.pos(), kError_AssignmentToDefinedClass, node.ref.name); } } } @@ -874,13 +874,13 @@ } if (!isXMLProp && slot.getObjectValue() != null) { - cx.error(node.pos()-1, kError_AssignmentToDefinedFunction, node.ref.name); + cx.error(node.pos(), kError_AssignmentToDefinedFunction, node.ref.name); } } } else if( slot != null && slot.isConst() && (slot.isImported() || scope_index != base_index || val.hasValue() || rchkill_bits_count > 0) ) { - cx.error(node.pos()-1, kError_AssignmentToConstVar); + cx.error(node.pos(), kError_AssignmentToConstVar); } else if( cx.useStaticSemantics() && slot == null ) { @@ -912,7 +912,7 @@ } else { - cx.error(node.pos()-1, kError_PropertyIsReadOnly); + cx.error(node.pos(), kError_PropertyIsReadOnly); } } else @@ -922,9 +922,9 @@ if( base != null && (!base.isDynamic() || (base.getType(cx).getTypeValue() == cx.functionType() && !(base.builder instanceof GlobalBuilder)) ) ) { if (base.hasNameUnqualified(cx, node.ref.name, GET_TOKEN)) - cx.error(node.expr.pos()-1, kError_InaccessiblePropertyReference, node.ref.name, base.getType(cx).getName(cx).toString()); + cx.error(node.expr.pos(), kError_InaccessiblePropertyReference, node.ref.name, base.getType(cx).getName(cx).toString()); else - cx.error(node.expr.pos()-1, kError_UndefinedProperty,node.ref.name,base.getType(cx).getName(cx).toString()); + cx.error(node.expr.pos(), kError_UndefinedProperty,node.ref.name,base.getType(cx).getName(cx).toString()); } } } @@ -1145,7 +1145,7 @@ !(node.selector.expr instanceof QualifiedIdentifierNode) && // If it was qualified then fall through to the normal unfound property error scope.hasNameUnqualified(cx, node.ref.name, GET_TOKEN) ) { - cx.error(node.selector.expr.pos()-1, kError_InaccessiblePropertyReference,node.ref.name, scope.type.getName(cx).toString()); + cx.error(node.selector.expr.pos(), kError_InaccessiblePropertyReference,node.ref.name, scope.type.getName(cx).toString()); break; } } @@ -1167,18 +1167,18 @@ if( !( slot != null && slot.getType()!= null && slot.getType().getTypeValue() == cx.functionType() && slot.getObjectValue() != null) ) { if( qualified_pkg_name != null ) - cx.error(node.selector.expr.pos()-1, kError_UnfoundPackageProperty, node.ref.name, qualified_pkg_name); + cx.error(node.selector.expr.pos(), kError_UnfoundPackageProperty, node.ref.name, qualified_pkg_name); else // Attempting to set a function will be caught by the SetExpressionNode - cx.error(node.selector.expr.pos()-1, kError_UnfoundProperty,node.ref.name); + cx.error(node.selector.expr.pos(), kError_UnfoundProperty,node.ref.name); } } else { if( qualified_pkg_name != null ) - cx.error(node.selector.expr.pos()-1, kError_UnfoundPackageProperty, node.ref.name, qualified_pkg_name); + cx.error(node.selector.expr.pos(), kError_UnfoundPackageProperty, node.ref.name, qualified_pkg_name); else - cx.error(node.selector.expr.pos()-1, kError_UnfoundProperty,node.ref.name); + cx.error(node.selector.expr.pos(), kError_UnfoundProperty,node.ref.name); } } } @@ -1186,7 +1186,7 @@ } if( node.selector.is_package && node.ref.getSlotIndex(GET_TOKEN) < 0 ) { - cx.error(node.selector.expr.pos()-1,kError_IllegalPackageReference,node.ref.name); + cx.error(node.selector.expr.pos(),kError_IllegalPackageReference,node.ref.name); } } @@ -1304,9 +1304,9 @@ if( base != null && (!base.isDynamic() || (base.getType(cx).getTypeValue() == cx.functionType() && !(base.builder instanceof GlobalBuilder))) ) { if (base.hasNameUnqualified(cx, node.ref.name, GET_TOKEN)) - cx.error(node.pos()-1, kError_InaccessiblePropertyReference, node.ref.name, base.getType(cx).getName(cx).toString()); + cx.error(node.pos(), kError_InaccessiblePropertyReference, node.ref.name, base.getType(cx).getName(cx).toString()); else - cx.error(node.pos()-1, kError_UndefinedProperty,node.ref.name,base.getType(cx).getName(cx).toString()); + cx.error(node.pos(), kError_UndefinedProperty,node.ref.name,base.getType(cx).getName(cx).toString()); } } } @@ -1315,7 +1315,7 @@ !(slot instanceof VariableSlot) && // FIXME: tpr added this since var's don't get a set slot, node.ref.getSlot(cx,SET_TOKEN) == null) { - cx.error(node.pos()-1, node.op == PLUSPLUS_TOKEN ? kError_InvalidIncrementOperand : kError_InvalidDecrementOperand); + cx.error(node.pos(), node.op == PLUSPLUS_TOKEN ? kError_InvalidIncrementOperand : kError_InvalidDecrementOperand); } } else @@ -1323,7 +1323,7 @@ QualifiedExpressionNode qen = node.getIdentifier() instanceof QualifiedExpressionNode? (QualifiedExpressionNode)node.getIdentifier() : null; if (qen != null && qen.nss != null ) { - cx.error(node.pos()-1, node.op == PLUSPLUS_TOKEN ? kError_InvalidIncrementOperand : kError_InvalidDecrementOperand); + cx.error(node.pos(), node.op == PLUSPLUS_TOKEN ? kError_InvalidIncrementOperand : kError_InvalidDecrementOperand); // this is a case we just don't handle. might need a more descriptive message } @@ -1432,14 +1432,14 @@ (rhstype[0].getTypeValue() == cx.numberType() || rhstype[0].getTypeValue() == cx.intType() || rhstype[0].getTypeValue() == cx.uintType() || rhstype[0].getTypeValue() == cx.booleanType() )) { - cx.error(node.pos()-1, kError_IncompatableValueComparison, lhstype[0].getName(cx).toString(), rhstype[0].getName(cx).toString()); + cx.error(node.pos(), kError_IncompatableValueComparison, lhstype[0].getName(cx).toString(), rhstype[0].getName(cx).toString()); } // yes, this could be combined with the above, but it would be hard to read else if (rhstype[0].getTypeValue() == cx.nullType() && (lhstype[0].getTypeValue() == cx.numberType() || lhstype[0].getTypeValue() == cx.intType() || lhstype[0].getTypeValue() == cx.uintType() || lhstype[0].getTypeValue() == cx.booleanType() )) { - cx.error(node.pos()-1, kError_IncompatableValueComparison, lhstype[0].getName(cx).toString(), rhstype[0].getName(cx).toString()); + cx.error(node.pos(), kError_IncompatableValueComparison, lhstype[0].getName(cx).toString(), rhstype[0].getName(cx).toString()); } // else no problem } @@ -1453,7 +1453,7 @@ else if ( !((lhstype[0].getTypeValue() == cx.numberType() || lhstype[0].getTypeValue() == cx.intType() || lhstype[0].getTypeValue() == cx.uintType()) && (rhstype[0].getTypeValue() == cx.numberType() || rhstype[0].getTypeValue() == cx.intType() || rhstype[0].getTypeValue() == cx.uintType())) ) { - cx.error(node.pos()-1, kError_IncompatableValueComparison, lhstype[0].getName(cx).toString(), rhstype[0].getName(cx).toString()); + cx.error(node.pos(), kError_IncompatableValueComparison, lhstype[0].getName(cx).toString(), rhstype[0].getName(cx).toString()); } break; @@ -1825,7 +1825,7 @@ if ( tooManyArgs || tooFewArgs) { - StringBuffer err_arg_buf = new StringBuffer(); + StringBuilder err_arg_buf = new StringBuilder(); int expected_num_args = node.decl_styles.at(0) == PARAM_Void?0:types_size; if (tooFewArgs) { @@ -2242,7 +2242,7 @@ Slot typeSlot = node.typeref.getSlot(cx); if (typeSlot == null || typeSlot.getValue() == null) { - cx.error(node.variable.type.pos()-1, kError_UnknownType, node.typeref.name); + cx.error(node.variable.type.pos(), kError_UnknownType, node.typeref.name); slot.setType(type = cx.noType().getDefaultTypeInfo()); } else @@ -2260,7 +2260,7 @@ else { // The value of the slot is not a type, so it's an unknown type - cx.error(node.variable.type.pos()-1, kError_UnknownType, node.typeref.name); + cx.error(node.variable.type.pos(), kError_UnknownType, node.typeref.name); slot.setType(type = cx.noType().getDefaultTypeInfo()); } } @@ -2291,7 +2291,7 @@ ObjectValue checked = checkDefaultValue(cx, type, ov); if( checked == null ) { - cx.error(node.initializer.pos()-1, kError_IncompatibleDefaultValue,ov.type.getName(cx).toString(),type.getName(cx).toString()); + cx.error(node.initializer.pos(), kError_IncompatibleDefaultValue,ov.type.getName(cx).toString(),type.getName(cx).toString()); } slot.setObjectValue((ObjectValue) val); } @@ -2352,7 +2352,7 @@ //String kind_str = node.name.kind == GET_TOKEN ? "Getter" : "Setter"; //String otherkind_str = node.name.kind == GET_TOKEN ? "setter" : "getter"; node.ref.getSlot(cx,SET_TOKEN); - cx.error(pos-1, kError_AccessorTypesMustMatch); + cx.error(pos, kError_AccessorTypesMustMatch); } } } @@ -2365,19 +2365,19 @@ if( node.fexpr.signature.result != null && rt2.getTypeValue() != cx.voidType() ) { int pos = node.fexpr.signature.result.pos(); - cx.error(pos-1, kError_BadSetterReturnType); + cx.error(pos, kError_BadSetterReturnType); } } ParameterListNode parameter = node.fexpr.signature.parameter; if (parameter == null || parameter.items.size() != 1) { int pos = (parameter != null) ? parameter.pos() : node.fexpr.signature.pos(); - cx.error(pos-1, kError_SetterMustHaveOneParameter); + cx.error(pos, kError_SetterMustHaveOneParameter); } else if (parameter.items.at(0).init != null) { int pos = node.fexpr.signature.parameter.pos(); - cx.error(pos-1, kError_SetterCannotHaveOptional); + cx.error(pos, kError_SetterCannotHaveOptional); } } else if( node.name.kind == GET_TOKEN ) @@ -2385,13 +2385,13 @@ if (node.fexpr.signature.void_anno) { int pos = node.fexpr.signature.pos(); - cx.error(pos-1, kError_BadGetterReturnType); + cx.error(pos, kError_BadGetterReturnType); } ParameterListNode parameter = node.fexpr.signature.parameter; if (parameter != null && parameter.items.size() != 0) { int pos = node.fexpr.signature.parameter.pos(); - cx.error(pos-1, kError_GetterCannotHaveParameters); + cx.error(pos, kError_GetterCannotHaveParameters); } } } @@ -2483,7 +2483,7 @@ if (slot != null && size(slot.getDeclStyles()) != 0 && slot.getDeclStyles().at(0) == PARAM_Required) { // found a slot, and it has required params - cx.error(node.pos()-1, kError_NoDefaultBaseclassCtor, ib.basebui.classname.toString()); + cx.error(node.pos(), kError_NoDefaultBaseclassCtor, ib.basebui.classname.toString()); } } } @@ -2602,7 +2602,7 @@ } else { - cx.error(node.result.pos()-1, kError_UnknownType, node.typeref.name); + cx.error(node.result.pos(), kError_UnknownType, node.typeref.name); } } else @@ -2643,7 +2643,7 @@ } else { - cx.error(node.result.pos()-1, kError_UnknownType, node.typeref.name); + cx.error(node.result.pos(), kError_UnknownType, node.typeref.name); } } else @@ -2798,7 +2798,7 @@ } else { - cx.error(node.type.pos()-1, kError_UnknownType, node.typeref.name); + cx.error(node.type.pos(), kError_UnknownType, node.typeref.name); slot.setType(type = cx.noType().getDefaultTypeInfo()); } } @@ -2821,13 +2821,13 @@ ObjectValue checked = checkDefaultValue(cx,type,ov); if( checked == null ) { - cx.error(node.init.pos()-1, kError_IncompatibleDefaultValue,ov.type.getName(cx).toString(),type.getName(cx).toString()); + cx.error(node.init.pos(), kError_IncompatibleDefaultValue,ov.type.getName(cx).toString(),type.getName(cx).toString()); } slot.setValue(checked); } else { - cx.error(node.init.pos()-1, kError_NonConstantParamInitializer); + cx.error(node.init.pos(), kError_NonConstantParamInitializer); } } return type.getPrototype(); @@ -2864,7 +2864,7 @@ } else { - cx.error(node.type.pos()-1, kError_UnknownType, node.typeref.name); + cx.error(node.type.pos(), kError_UnknownType, node.typeref.name); slot.setType(type = cx.noType().getDefaultTypeInfo()); } } @@ -3365,7 +3365,7 @@ propType = "set "; else if (orig_getter) propType = "get "; - cx.error(classNode.pos()-1, errorID, propType + name, namespaceString, classNode.iframe.type.getTypeValue().name.toString()); + cx.error(classNode.pos(), errorID, propType + name, namespaceString, classNode.iframe.type.getTypeValue().name.toString()); } } } @@ -3425,7 +3425,7 @@ else if(names.getType(i) == Names.GET_NAMES) propType = "get "; - cx.error(classNode.pos()-1, kError_ConflictingInheritedNameInInterface, propType + name, + cx.error(classNode.pos(), kError_ConflictingInheritedNameInInterface, propType + name, interfaceIFrame.type.getTypeValue().name.toString()); } } @@ -3510,7 +3510,7 @@ if (definitionName != null && definitionName.length() > 0) { - StringBuffer b = new StringBuffer(packageName == null ? 0 : packageName.length() + + StringBuilder b = new StringBuilder(packageName == null ? 0 : packageName.length() + definitionName.length() + 1); if (packageName != null && packageName.length() > 0) { @@ -3528,7 +3528,7 @@ Slot slot = ref.getSlot(cx,GET_TOKEN); if (slot == null) { - cx.error(node.name.pos()-1, kError_DefinitionNotFound, import_name); + cx.error(node.name.pos(), kError_DefinitionNotFound, import_name); } else { @@ -3542,7 +3542,7 @@ ObjectValue ns = cx.getNamespace(packageName.intern()); if (!ns.isPackage()) { - cx.error(node.name.pos()-1, kError_DefinitionNotFound, packageName); + cx.error(node.name.pos(), kError_DefinitionNotFound, packageName); } } } @@ -3609,7 +3609,7 @@ } else if (cx.useStaticSemantics() && slot != null && size(slot.getDeclStyles()) != 0 && slot.getDeclStyles().at(0) == PARAM_Required) { - StringBuffer err_arg_buf = new StringBuffer(); + StringBuilder err_arg_buf = new StringBuilder(); int expected_num_args = slot.getDeclStyles().size(); for(; expected_num_args > 0; expected_num_args--) { Index: modules/asc/src/java/macromedia/asc/semantics/FlowAnalyzer.java =================================================================== --- modules/asc/src/java/macromedia/asc/semantics/FlowAnalyzer.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/semantics/FlowAnalyzer.java (working copy) @@ -38,6 +38,14 @@ */ public final class FlowAnalyzer extends Emitter implements Evaluator, ErrorConstants { + private static final String INTRINSIC = "intrinsic".intern(); + private static final String INTERNAL = "internal".intern(); + private static final String PUBLIC = "public".intern(); + private static final String PRIVATE = "private".intern(); + private static final String PROTECTED = "protected".intern(); + private static final String PROTOTYPE = "prototype".intern(); + private static final String STATIC = "static".intern(); + private Names interfaceMethods = null; private boolean define_cv; private boolean errorNodeSeen = false; @@ -254,16 +262,16 @@ else { IdentifierNode id = memb.selector.getIdentifier(); - if( id != null && id.name.equals("internal") ) + if( id != null && (id.name == INTERNAL) ) { ns = default_namespaces.back(); } else - if( id != null && id.name.equals("private") ) + if( id != null && (id.name == PRIVATE) ) { if( private_namespaces.size() == 0 ) { - cx.error(node.qualifier.pos()-1, kError_InvalidPrivate); + cx.error(node.qualifier.pos(), kError_InvalidPrivate); } else { @@ -271,11 +279,11 @@ } } else - if( id != null && id.name.equals("protected") ) + if( id != null && (id.name == PROTECTED) ) { if( static_protected_namespaces.size() == 0 ) { - cx.error(node.qualifier.pos()-1, kError_InvalidProtected); + cx.error(node.qualifier.pos(), kError_InvalidProtected); } else { @@ -295,7 +303,7 @@ } } else - if( id != null && id.name.equals("public") ) + if( id != null && (id.name == PUBLIC) ) { ns = public_namespaces.back(); } @@ -320,17 +328,18 @@ } else if( ref != null ) { - ns = ((ref.getValue(cx) instanceof ObjectValue) ? (ObjectValue)ref.getValue(cx) : null); + Value value = ref.getValue(cx); + ns = ((value instanceof ObjectValue) ? (ObjectValue) value : null); if( ns == null ) { return null; - // cx.error(node.qualifier.pos()-1, kError_UndefinedNamespace ); + // cx.error(node.qualifier.pos(), kError_UndefinedNamespace ); } } else if( ns == null && nss == null ) { - cx.error(node.qualifier.pos()-1, kError_UndefinedNamespace); + cx.error(node.qualifier.pos(), kError_UndefinedNamespace); } } } @@ -406,10 +415,10 @@ case error_this: case cinit_this: case package_this: - cx.error(node.pos()-1, kError_ThisUsedInStaticFunction); + cx.error(node.pos(), kError_ThisUsedInStaticFunction); break; case init_this: - cx.error(node.pos()-1, kError_ThisUsedInInitializer); + cx.error(node.pos(), kError_ThisUsedInInitializer); break; default: // valid use of this @@ -539,8 +548,24 @@ if (node.name != null) { - Value value = node.name.evaluate(cx,this); - node.ref = ((value instanceof ReferenceValue) ? (ReferenceValue)value : null); + // For LiteralFieldNode's with a name of type + // IdentifierNode, ReferenceValue.findUnqualified() always + // returns false, so speed up the process by creating a + // ReferenceValue with no namespaces. + if (node.name instanceof IdentifierNode) + { + IdentifierNode identifier = (IdentifierNode) node.name; + Namespaces namespaces = new Namespaces(); + ReferenceValue referenceValue = new ReferenceValue(cx, null, identifier.name, namespaces); + referenceValue.setIsAttributeIdentifier(false); + referenceValue.setPosition(node.pos()); + node.ref = referenceValue; + } + else + { + Value value = node.name.evaluate(cx,this); + node.ref = ((value instanceof ReferenceValue) ? (ReferenceValue)value : null); + } } node.value.evaluate(cx, this); @@ -1078,7 +1103,7 @@ // value at the beginning of the block. hoisted_defs.push_back(def); - if( def.attrs != null && def.attrs.hasAttribute("intrinsic") ) + if( def.attrs != null && def.attrs.hasAttribute(INTRINSIC) ) { if (label == null) node.items.set(i, nodeFactory.emptyStatement()); @@ -1329,7 +1354,7 @@ if (ref == null) { - cx.error(node.pos()-1, kError_InvalidLabel); + cx.error(node.pos(), kError_InvalidLabel); } else { @@ -1340,12 +1365,12 @@ { if (obj.defineName(cx, GET_TOKEN, labelName, ObjectValue.labelNamespace, loop_index) == 0) { - cx.error(node.pos()-1, kError_DuplicateLabel); + cx.error(node.pos(), kError_DuplicateLabel); } // and if it is a loop label, add a name for the loop label namespace too if (node.is_loop_label && obj.defineName(cx, GET_TOKEN, labelName, ObjectValue.loopLabelNamespace, loop_index) == 0) { - cx.error(node.pos()-1, kError_DuplicateLabel); + cx.error(node.pos(), kError_DuplicateLabel); } } @@ -1787,7 +1812,7 @@ if( node.loop_index < 0 ) { - cx.error(node.pos()-1, kError_ContinueHasNoTarget); + cx.error(node.pos(), kError_ContinueHasNoTarget); } Continue(node.loop_index); @@ -1834,7 +1859,7 @@ //TODO improve this error to suggest {} blocks if( node.loop_index < 0 ) { - cx.error(node.pos()-1, kError_BreakHasNoTarget); + cx.error(node.pos(), kError_BreakHasNoTarget); } Break(node.loop_index); @@ -2738,7 +2763,7 @@ // output errors against the nodes in dependency cycles... if (!tsort.contains(clsdef)) { - cx.error(clsdef.pos() - 1, kError_CircularReference, clsdef.cframe.builder.classname.name); + cx.error(clsdef.pos(), kError_CircularReference, clsdef.cframe.builder.classname.name); found_circular_or_duplicate_class_definition = true; } } @@ -2771,7 +2796,7 @@ { if( doingPackage() && import_context.back() != true ) { - cx.error(node.pos()-1, kError_NestedPackage); + cx.error(node.pos(), kError_NestedPackage); return null; } @@ -2901,17 +2926,17 @@ if (is_dynamic) { - cx.error(node.pos()-1, kError_InvalidDynamic); + cx.error(node.pos(), kError_InvalidDynamic); } if (is_final) { - cx.error(node.pos()-1, kError_InvalidFinalUsage); + cx.error(node.pos(), kError_InvalidFinalUsage); } if (is_override) { - cx.error(node.pos()-1, kError_InvalidOverrideUsage); + cx.error(node.pos(), kError_InvalidOverrideUsage); } if( is_static ) @@ -2922,7 +2947,7 @@ } else { - cx.error(node.attrs.pos()-1, kError_InvalidStatic); + cx.error(node.attrs.pos(), kError_InvalidStatic); } } else @@ -2947,54 +2972,54 @@ { if( attrs != null ) { - if( attrs.hasAttribute("private") ) + if( attrs.hasPrivate ) { if( private_namespaces.size() == 0 ) { - cx.error(attrs.pos()-1, kError_InvalidPrivate); + cx.error(attrs.pos(), kError_InvalidPrivate); attrs.namespaces.push_back(cx.publicNamespace()); // for graceful failure - attrs.namespace_ids.push_back("private"); + attrs.namespace_ids.push_back(PRIVATE); } else { attrs.namespaces.push_back(private_namespaces.back()); - attrs.namespace_ids.push_back("private"); + attrs.namespace_ids.push_back(PRIVATE); } } else - if( attrs.hasAttribute("protected") ) + if( attrs.hasProtected ) { if (cx.scope().builder instanceof InstanceBuilder) { if( protected_namespaces.size() == 0 ) { - cx.error(attrs.pos()-1, kError_InvalidProtected); + cx.error(attrs.pos(), kError_InvalidProtected); attrs.namespaces.push_back(cx.publicNamespace()); - attrs.namespace_ids.push_back("protected"); + attrs.namespace_ids.push_back(PROTECTED); } else { attrs.namespaces.push_back(protected_namespaces.back()); - attrs.namespace_ids.push_back("protected"); + attrs.namespace_ids.push_back(PROTECTED); } } else { if( static_protected_namespaces.size() == 0 ) { - cx.error(attrs.pos()-1, kError_InvalidProtected); + cx.error(attrs.pos(), kError_InvalidProtected); attrs.namespaces.push_back(cx.publicNamespace()); - attrs.namespace_ids.push_back("protected"); + attrs.namespace_ids.push_back(PROTECTED); } else { attrs.namespaces.push_back(static_protected_namespaces.back()); - attrs.namespace_ids.push_back("protected"); + attrs.namespace_ids.push_back(PROTECTED); } } } else - if( attrs.hasAttribute("public") ) + if( attrs.hasPublic ) { if( public_namespaces.size() == 0 ) { @@ -3009,7 +3034,7 @@ } } else - if( attrs.hasAttribute("internal") ) + if( attrs.hasInternal ) { if( public_namespaces.size() == 0 ) // use public namespaces to determine if we are in a valid context for internal { @@ -3078,7 +3103,7 @@ namespace_ids.push_back(ns.name); NodeFactory nf = cx.getNodeFactory(); boolean isPublic = ns == cx.publicNamespace(); - AttributeListNode aln = nf.attributeList(nf.identifier(isPublic?"public":"internal",node.variable.pos()),null); + AttributeListNode aln = nf.attributeList(nf.identifier(isPublic?PUBLIC:INTERNAL,false,node.variable.pos()),null); if (isPublic) { aln.hasPublic = true; @@ -3107,8 +3132,8 @@ if (node.inPackage() == false && cx.getScopes().size() == 1 && node.attrs != null) { - if( node.attrs.hasAttribute("public") ) - cx.error(node.attrs.pos()-1, kError_InvalidPublic); + if( node.attrs.hasAttribute(PUBLIC) ) + cx.error(node.attrs.pos(), kError_InvalidPublic); } } @@ -3141,7 +3166,7 @@ if( bui instanceof InstanceBuilder && node.ref.name.equals(fun_name_stack.back())) { - cx.error(node.pos()-1, kError_ConstructorsMustBeInstanceMethods); + cx.error(node.pos(), kError_ConstructorsMustBeInstanceMethods); } Namespaces open_definition_namespaces ; @@ -3183,7 +3208,7 @@ else { // If the type didn't resolve to a reference value then it's clearly going to be unknown - cx.error(node.variable.type.pos()-1, kError_UnknownType, ""); + cx.error(node.variable.type.pos(), kError_UnknownType, ""); } } @@ -3237,20 +3262,20 @@ if (ns.name.length() == 0) { - nsstr += "public"; + nsstr += PUBLIC; } else { switch( ns.getNamespaceKind() ) { case Context.NS_PRIVATE: - nsstr += "private"; + nsstr += PRIVATE; break; case Context.NS_INTERNAL: - nsstr += "internal"; + nsstr += INTERNAL; break; case Context.NS_PROTECTED: - nsstr += "protected"; + nsstr += PROTECTED; break; default: nsstr += ns.name; @@ -3271,7 +3296,7 @@ if( orig.getType().getTypeValue() == cx.typeType() || orig.isConst() ) { // attempting to declare a var with the same name as a class, don't allow that - cx.error(node.variable.identifier.pos()-1, kError_ConflictingNameInNamespace, node.ref.name, "internal"); + cx.error(node.variable.identifier.pos(), kError_ConflictingNameInNamespace, node.ref.name, "internal"); } else { @@ -3299,7 +3324,7 @@ if( orig.declaredBy != obj ) { String fullname = getFullNameForInheritedSlot(cx, orig.declaredBy, node.ref.name); - cx.error(node.variable.identifier.pos()-1, kError_ConflictingInheritedNameInNamespace, fullname, nsstr); + cx.error(node.variable.identifier.pos(), kError_ConflictingInheritedNameInNamespace, fullname, nsstr); } else { @@ -3309,7 +3334,7 @@ } else { - cx.error(node.variable.identifier.pos()-1, kError_ConflictingNameInNamespace, node.ref.name, "internal"); + cx.error(node.variable.identifier.pos(), kError_ConflictingNameInNamespace, node.ref.name, "internal"); } } if( (node.block != null) || // node.block is null for defintions at the top level of the method @@ -3399,19 +3424,19 @@ { if( node.attrs.hasVirtual && node.attrs.hasFinal ) { - cx.error(node.attrs.pos()-1, kError_FuncIsVirtualAndFinal); + cx.error(node.attrs.pos(), kError_FuncIsVirtualAndFinal); } if( node.attrs.hasStatic && node.attrs.hasVirtual ) { - cx.error(node.attrs.pos()-1, kError_FuncIsStaticAndVirtual); + cx.error(node.attrs.pos(), kError_FuncIsStaticAndVirtual); } if( node.attrs.hasStatic && node.attrs.hasOverride ) { - cx.error(node.attrs.pos()-1, kError_FuncIsStaticAndOverride); + cx.error(node.attrs.pos(), kError_FuncIsStaticAndOverride); } if( node.attrs.hasStatic && node.attrs.hasDynamic ) { - cx.error(node.attrs.pos()-1, kError_InvalidDynamic); + cx.error(node.attrs.pos(), kError_InvalidDynamic); } is_static = node.attrs.hasStatic; @@ -3433,8 +3458,8 @@ computeNamespaces(cx,node.attrs,namespaces,namespace_ids); if (node.pkgdef == null && cx.getScopes().size() == 1 && node.attrs != null ) { - if( node.attrs.hasAttribute("public") ) - cx.error(node.attrs.pos()-1, kError_InvalidPublic); + if( node.attrs.hasAttribute(PUBLIC) ) + cx.error(node.attrs.pos(), kError_InvalidPublic); } NodeFactory nodeFactory = cx.getNodeFactory(); @@ -3516,18 +3541,18 @@ { if (is_interface_method && is_native) { - cx.error(node.pos()-1, kError_InvalidInterfaceNative); + cx.error(node.pos(), kError_InvalidInterfaceNative); } if( node.fexpr.isUserDefinedBody() ) { - cx.error(node.pos()-1, is_interface_method ? kError_InterfaceMethodWithBody : kError_NativeMethodWithBody); + cx.error(node.pos(), is_interface_method ? kError_InterfaceMethodWithBody : kError_NativeMethodWithBody); } } else { if( !node.fexpr.isUserDefinedBody() && !is_ctor && !is_native && !is_dynamic ) //ctors and native and dynamic methods don't need bodies { - cx.error(node.pos()-1, kError_FunctionWithoutBody); + cx.error(node.pos(), kError_FunctionWithoutBody); } } @@ -3535,12 +3560,12 @@ { if( node.attrs.hasFinal && (!is_instance_method || is_interface_method) ) { - cx.error(node.pos()-1, kError_InvalidFinalUsage); + cx.error(node.pos(), kError_InvalidFinalUsage); } if( is_interface_method && (node.attrs.hasPrivate || node.attrs.hasProtected || node.attrs.hasInternal || node.attrs.hasPublic) && (!node.ref.name.equals("$construct") )) { // todo fix error msg - cx.error(node.pos()-1, kError_BadAccessInterfaceMember); + cx.error(node.pos(), kError_BadAccessInterfaceMember); } } @@ -3548,7 +3573,7 @@ { if (is_interface_method) { - cx.error(node.pos()-1, kError_InvalidStatic); + cx.error(node.pos(), kError_InvalidStatic); } } @@ -3557,7 +3582,7 @@ // Namespace attributes are not allowed on interface methods if (node.attrs != null && node.attrs.getUserNamespace() != null) { - cx.error(node.pos()-1, kError_InterfaceNamespaceAttribute); + cx.error(node.pos(), kError_InterfaceNamespaceAttribute); } } @@ -3642,14 +3667,14 @@ { if( !( namespaces.size() == 1 && hasNamespaces.size() == 1 && namespaces.at(0).isProtected() && hasNamespaces.at(0).isProtected() ) ) { - cx.error(node.pos()-1, kError_IncompatibleOverride); + cx.error(node.pos(), kError_IncompatibleOverride); } } int overridden_kind = (slot_id == implied_id) ? kind : EMPTY_TOKEN; if (overridden_kind != node.name.kind && !is_ctor) { - cx.error(node.pos()-1, kError_IncompatibleOverride); + cx.error(node.pos(), kError_IncompatibleOverride); } if( true /* check signature and final */ ) @@ -3662,13 +3687,13 @@ if( node.name.kind == SET_TOKEN || node.name.kind == GET_TOKEN) cx.error(node.pos(), kError_OverrideFinalAccessor); else - cx.error(node.pos()-1, kError_FinalMethodRedefinition); + cx.error(node.pos(), kError_FinalMethodRedefinition); } if( slot.declaredBy == obj ) { // This was already defined at this level, it was not inherited from a base class - cx.error(node.pos()-1, kError_DuplicateFunction); + cx.error(node.pos(), kError_DuplicateFunction); } else if( is_prototype || is_dynamic ) { @@ -3676,7 +3701,7 @@ } else if( !is_override && !is_ctor ) { - cx.error(node.pos()-1, kError_OverrideOfFuncNotMarkedForOverride); + cx.error(node.pos(), kError_OverrideOfFuncNotMarkedForOverride); } if( node.name.kind == GET_TOKEN ) @@ -3727,12 +3752,12 @@ else if (bui instanceof GlobalBuilder && (node.pkgdef != null || namespaces.at(0) != hasNamespaces.at(0)) && is_first_time ) { - cx.error(node.pos()-1, kError_DuplicateFunction); + cx.error(node.pos(), kError_DuplicateFunction); } else if( cx.useStaticSemantics() && is_first_time ) // ISSUE: remove use of this flag by not evaluating this code twice { - cx.error(node.pos()-1, kError_DuplicateFunction); + cx.error(node.pos(), kError_DuplicateFunction); } else { @@ -3745,7 +3770,7 @@ { if (is_interface_method) { - cx.error(node.pos()-1, kError_InvalidOverrideUsage); + cx.error(node.pos(), kError_InvalidOverrideUsage); } else { @@ -3753,11 +3778,11 @@ UnresolvedNamespace un = n instanceof UnresolvedNamespace ? (UnresolvedNamespace) n : null; if( un == null || un.resolved ) { - cx.error(node.pos()-1, kError_OverrideNotFound); + cx.error(node.pos(), kError_OverrideNotFound); } else { - cx.error(un.node.pos()-1, kError_Unknown_Namespace); + cx.error(un.node.pos(), kError_Unknown_Namespace); } } } @@ -3943,7 +3968,7 @@ node.typeref = ((val instanceof ReferenceValue) ? (ReferenceValue)val : null); if( node.typeref == null ) { - cx.error(node.result.pos()-1, kError_UnknownType); + cx.error(node.result.pos(), kError_UnknownType); } else { @@ -4013,7 +4038,7 @@ } else { - cx.error(node.type.pos()-1, kError_UnknownType); + cx.error(node.type.pos(), kError_UnknownType); } } @@ -4207,22 +4232,22 @@ is_intrinsic = node.attrs.hasIntrinsic; if( node.attrs.hasNative ) { - cx.error(node.pos()-1, kError_InvalidNative); + cx.error(node.pos(), kError_InvalidNative); } // Note: node.attrs.hasOverride will have already been checked // by the hoisted_defs test in StatementListNode /*if( node.attrs.hasOverride ) { - cx.error(node.pos()-1, kError_InvalidOverride); + cx.error(node.pos(), kError_InvalidOverride); }*/ } if( cx.getScopes().size() > 1 ) { if (node.isInterface()) - cx.error(node.pos()-1, kError_InvalidInterfaceNesting); + cx.error(node.pos(), kError_InvalidInterfaceNesting); else - cx.error(node.pos()-1, kError_InvalidClassNesting); + cx.error(node.pos(), kError_InvalidClassNesting); } // Only do the following once @@ -4240,8 +4265,8 @@ computeNamespaces(cx,node.attrs,node.namespaces,namespace_ids); if (node.pkgdef == null && cx.getScopes().size() == 1 && node.attrs != null) { - if( node.attrs.hasAttribute("public") ) - cx.error(node.attrs.pos()-1, kError_InvalidPublic); + if( node.attrs.hasAttribute(PUBLIC) ) + cx.error(node.attrs.pos(), kError_InvalidPublic); } Value val = node.name.evaluate(cx,this); @@ -4268,7 +4293,7 @@ node.cframe.type = cx.typeType().getDefaultTypeInfo(); if( node.cframe.prototype != null ) { - node.cframe.prototype.clearInstance(cx,new InstanceBuilder(fullname),node.cframe, "",true); + node.cframe.prototype.clearInstance(cx,new InstanceBuilder(fullname),node.cframe, ObjectValue.EMPTY_STRING, true); node.iframe = node.cframe.prototype; } else @@ -4324,11 +4349,11 @@ { if( node.isInterface() ) { - cx.error( node.name.pos()-1, kError_DuplicateInterfaceDefinition, node.ref.name); + cx.error( node.name.pos(), kError_DuplicateInterfaceDefinition, node.ref.name); } else { - cx.error( node.name.pos()-1, kError_DuplicateClassDefinition, node.ref.name); + cx.error( node.name.pos(), kError_DuplicateClassDefinition, node.ref.name); found_circular_or_duplicate_class_definition = true; } } @@ -4414,7 +4439,7 @@ if( node.baseref == null ) { // uh oh, didn't resolve to anything, but we have a baseclass expression - cx.error(node.baseclass.pos()-1, kError_InvalidBaseTypeExpression); + cx.error(node.baseclass.pos(), kError_InvalidBaseTypeExpression); } } } @@ -4427,19 +4452,19 @@ if (type == null) { // stay silent. we'll report this in the else part... - // cx.error(node.baseclass.pos()-1, kError_UnknownBaseClass); + // cx.error(node.baseclass.pos(), kError_UnknownBaseClass); } else if( type.builder.is_final ) { // stay silent. we'll report this in the else part... - // cx.error(node.baseclass.pos()-1, kError_BaseClassIsFinal); + // cx.error(node.baseclass.pos(), kError_BaseClassIsFinal); } else if ( type.builder instanceof ClassBuilder && ((ClassBuilder)type.builder).is_interface ) { // stay silent. we'll report this in the else part... - // cx.error(node.baseclass.pos()-1, node.isInterface() ? kError_CannotExtendClass : kError_CannotExtendInterface); + // cx.error(node.baseclass.pos(), node.isInterface() ? kError_CannotExtendClass : kError_CannotExtendInterface); } else { @@ -4472,7 +4497,7 @@ if (t == null) { // stay silent. we'll report this in the else part... - // cx.error(node.baseclass.pos()-1, kError_UnknownBaseClass); + // cx.error(node.baseclass.pos(), kError_UnknownBaseClass); } else { @@ -4518,17 +4543,17 @@ if (type == null) { - cx.error(node.baseclass.pos()-1, kError_UnknownBaseClass, node.baseref.name); + cx.error(node.baseclass.pos(), kError_UnknownBaseClass, node.baseref.name); } else if( type.builder.is_final ) { - cx.error(node.baseclass.pos()-1, kError_BaseClassIsFinal); + cx.error(node.baseclass.pos(), kError_BaseClassIsFinal); } else if ( type.builder instanceof ClassBuilder && ((ClassBuilder)type.builder).is_interface ) { - cx.error(node.baseclass.pos()-1, kError_CannotExtendInterface); + cx.error(node.baseclass.pos(), kError_CannotExtendInterface); } else { @@ -4573,7 +4598,7 @@ if (t == null ) { - cx.error(node.interfaces.items.get(i).pos()-1, kError_UnknownInterface, ref.name); + cx.error(node.interfaces.items.get(i).pos(), kError_UnknownInterface, ref.name); } else { @@ -4581,13 +4606,13 @@ { if (!(((ClassBuilder)t.builder).is_interface)) { - cx.error(node.interfaces.items.get(i).pos()-1, kError_CannotExtendClass, ref.name); + cx.error(node.interfaces.items.get(i).pos(), kError_CannotExtendClass, ref.name); } else { if( seen_interfs.contains(t) ) { - cx.error(node.interfaces.items.get(i).pos()-1, kError_DuplicateImplements, node.ref.name, ref.name); + cx.error(node.interfaces.items.get(i).pos(), kError_DuplicateImplements, node.ref.name, ref.name); } else { @@ -4604,14 +4629,14 @@ } else { - cx.error(node.interfaces.items.get(i).pos()-1, kError_UnknownInterface, ref.name); + cx.error(node.interfaces.items.get(i).pos(), kError_UnknownInterface, ref.name); } } } else { // uh oh, didn't resolve to anything, but we have a baseclass expression - cx.error(node.interfaces.items.get(i).pos()-1, kError_InvalidInterfaceTypeExpression); + cx.error(node.interfaces.items.get(i).pos(), kError_InvalidInterfaceTypeExpression); } } } @@ -4739,7 +4764,7 @@ nf.has_arguments = false; FunctionCommonNode fexpr = nf.functionCommon(cx, fname.identifier, nf.functionSignature(null, null, 0), null, 0); - AttributeListNode attrs = nf.attributeList(nf.identifier("public",0),null); + AttributeListNode attrs = nf.attributeList(nf.identifier(PUBLIC,false,0),null); attrs.evaluate(cx,this); FunctionDefinitionNode fdef = nf.functionDefinition(cx, attrs, fname, fexpr); fdef.pkgdef = node.pkgdef; @@ -4887,19 +4912,19 @@ if (type == null) { // stay silent. we'll report this in the else part... - // cx.error(node.baseclass.pos()-1, kError_UnknownBaseClass); + // cx.error(node.baseclass.pos(), kError_UnknownBaseClass); } else if( type.builder.is_final ) { // stay silent. we'll report this in the else part... - // cx.error(node.baseclass.pos()-1, kError_BaseClassIsFinal); + // cx.error(node.baseclass.pos(), kError_BaseClassIsFinal); } else if ( type.builder instanceof ClassBuilder && ((ClassBuilder)type.builder).is_interface ) { // stay silent. we'll report this in the else part... - // cx.error(node.baseclass.pos()-1, node.isInterface() ? kError_CannotExtendClass : kError_CannotExtendInterface); + // cx.error(node.baseclass.pos(), node.isInterface() ? kError_CannotExtendClass : kError_CannotExtendInterface); } else { @@ -4934,7 +4959,7 @@ // the library with the parent class (e.g., playerglobal.swc) // ... it's a fatal error, because we'd just throw a NullPointerException // in the scanInterfaceMethods call below. (srj) - cx.error(node.pos()-1, kError_UnknownType, ref.toMultiName()); + cx.error(node.pos(), kError_UnknownType, ref.toMultiName()); continue; } interface_refs.push_back(ref); @@ -5110,7 +5135,7 @@ Slot slot = ref!=null?ref.getSlot(cx):null; if( slot == null ) { - cx.internalError(node.pos()-1, "internal error in FA::InterfaceDefinitionNode has no slot"); + cx.internalError(node.pos(), "internal error in FA::InterfaceDefinitionNode has no slot"); return null; } slot.setImplNode(node); // use this to validate class definitions during CE @@ -5121,23 +5146,23 @@ { if (node.attrs.hasFinal) { - cx.error(node.pos()-1,kError_InvalidInterfaceAttribute, "final"); + cx.error(node.pos(),kError_InvalidInterfaceAttribute, "final"); } if (node.attrs.hasDynamic) { - cx.error(node.pos()-1,kError_InvalidInterfaceAttribute, "dynamic"); + cx.error(node.pos(),kError_InvalidInterfaceAttribute, "dynamic"); } if (node.attrs.hasNative) { - cx.error(node.pos()-1,kError_InvalidInterfaceAttribute, "native"); + cx.error(node.pos(),kError_InvalidInterfaceAttribute, "native"); } if (node.attrs.hasPrivate) { - cx.error(node.pos()-1,kError_InvalidInterfaceAttribute, "private"); + cx.error(node.pos(),kError_InvalidInterfaceAttribute, PRIVATE); } if (node.attrs.hasProtected) { - cx.error(node.pos()-1,kError_InvalidInterfaceAttribute, "protected"); + cx.error(node.pos(),kError_InvalidInterfaceAttribute, PROTECTED); } } @@ -5200,48 +5225,48 @@ Node n = node.items.get(i); if( n != null ) { - if( n.hasAttribute("private") ) + if( n.hasAttribute(PRIVATE) ) { if( setPrivate ) { - cx.error(n.pos()-1, kError_DuplicateAttribute, "private"); + cx.error(n.pos(), kError_DuplicateAttribute, PRIVATE); } setPrivate = node.hasPrivate = true; } else - if( n.hasAttribute("protected") ) + if( n.hasAttribute(PROTECTED) ) { if( setProtected ) { - cx.error(n.pos()-1, kError_DuplicateAttribute, "protected"); + cx.error(n.pos(), kError_DuplicateAttribute, PROTECTED); } setProtected = node.hasProtected = true; } else - if( n.hasAttribute("public") ) + if( n.hasAttribute(PUBLIC) ) { if( setPublic ) { - cx.error(n.pos()-1, kError_DuplicateAttribute, "public"); + cx.error(n.pos(), kError_DuplicateAttribute, PUBLIC); } setPublic = node.hasPublic = true; } else - if( n.hasAttribute("internal") ) + if( n.hasAttribute(INTERNAL) ) { if( setInternal ) { - cx.error(n.pos()-1, kError_DuplicateAttribute, "internal"); + cx.error(n.pos(), kError_DuplicateAttribute, INTERNAL); } setInternal = node.hasInternal = true; } else { - if( n.hasAttribute("prototype") ) + if( n.hasAttribute(PROTOTYPE) ) { if( setPrototype ) { - cx.error(n.pos()-1, kError_DuplicateAttribute, "prototype"); + cx.error(n.pos(), kError_DuplicateAttribute, PROTOTYPE); } setPrototype = node.hasPrototype = true; } @@ -5263,25 +5288,25 @@ { if( obj == ObjectValue.intrinsicAttribute ) { node.hasIntrinsic = true; - cx.error(n.pos()-1, kError_Unsupported_Intrinsic); + cx.error(n.pos(), kError_Unsupported_Intrinsic); } else if( obj == ObjectValue.staticAttribute ) { if( setStatic ) { - cx.error(n.pos()-1, kError_DuplicateAttribute, "static"); + cx.error(n.pos(), kError_DuplicateAttribute, STATIC); } setStatic = node.hasStatic = true; if( !(cx.scope().builder instanceof InstanceBuilder) && !(cx.scope().builder instanceof ClassBuilder)) { - cx.error(n.pos()-1, kError_InvalidStatic); + cx.error(n.pos(), kError_InvalidStatic); } } else if( obj == ObjectValue.dynamicAttribute ) { if( setDynamic ) { - cx.error(n.pos()-1, kError_DuplicateAttribute, "dynamic"); + cx.error(n.pos(), kError_DuplicateAttribute, "dynamic"); } setDynamic = node.hasDynamic = true; } @@ -5289,19 +5314,19 @@ if( obj == ObjectValue.virtualAttribute ) { if( setVirtual ) { - cx.error(n.pos()-1, kError_DuplicateAttribute, "virtual"); + cx.error(n.pos(), kError_DuplicateAttribute, "virtual"); } setVirtual = node.hasVirtual = true; // error if has final too if( !(cx.scope().builder instanceof InstanceBuilder) && !(cx.scope().builder instanceof ClassBuilder) ) { - cx.error(n.pos()-1, kError_InvalidVirtual); + cx.error(n.pos(), kError_InvalidVirtual); } } else if( obj == ObjectValue.finalAttribute ) { if( setFinal ) { - cx.error(n.pos()-1, kError_DuplicateAttribute, "final"); + cx.error(n.pos(), kError_DuplicateAttribute, "final"); } setFinal = node.hasFinal = true; // error if has virtual too } @@ -5309,19 +5334,19 @@ if( obj == ObjectValue.overrideAttribute ) { if( setOverride ) { - cx.error(n.pos()-1, kError_DuplicateAttribute, "override"); + cx.error(n.pos(), kError_DuplicateAttribute, "override"); } setOverride = node.hasOverride = true; if( !(cx.scope().builder instanceof InstanceBuilder) && !(cx.scope().builder instanceof ClassBuilder) ) { - cx.error(n.pos()-1, kError_InvalidOverride); + cx.error(n.pos(), kError_InvalidOverride); } } else if( obj == ObjectValue.nativeAttribute ) { if( setNative ) { - cx.error(n.pos()-1, kError_DuplicateAttribute, "native"); + cx.error(n.pos(), kError_DuplicateAttribute, "native"); } setNative = node.hasNative = true; } @@ -5334,7 +5359,7 @@ node.hasFalse = true; } if( !(cx.scope().builder instanceof ClassBuilder || cx.scope().builder instanceof InstanceBuilder) ) { - cx.error(node.pos()-1, kError_InvalidNamespace); + cx.error(node.pos(), kError_InvalidNamespace); } else { @@ -5348,7 +5373,7 @@ { if( !(cx.scope().builder instanceof ClassBuilder || cx.scope().builder instanceof InstanceBuilder) ) { - cx.error(node.pos()-1, kError_InvalidNamespace); + cx.error(node.pos(), kError_InvalidNamespace); } else { @@ -5373,7 +5398,7 @@ if (!(ns instanceof NamespaceValue)) { // Error: Not a namespace attribute - cx.error(node.pos()-1, kError_InvalidAttribute); + cx.error(node.pos(), kError_InvalidAttribute); } else if (!foundUserNamespace) { @@ -5382,7 +5407,7 @@ } else { - cx.error(node.pos()-1, kError_MultipleNamespaceAttributes); + cx.error(node.pos(), kError_MultipleNamespaceAttributes); break; } } @@ -5391,12 +5416,12 @@ // Only one of public, private, protected, internal may be used. if (((node.hasPrivate?1:0) + (node.hasPublic?1:0) + (node.hasProtected?1:0) + (node.hasInternal?1:0)) > 1) { - cx.error(node.pos()-1, kError_ConflictingAccessSpecifiers); + cx.error(node.pos(), kError_ConflictingAccessSpecifiers); } if (node.hasUserNamespace() && (node.hasPrivate || node.hasPublic || node.hasProtected || node.hasInternal)) { - cx.error(node.pos()-1, kError_NamespaceAccessSpecifiers); + cx.error(node.pos(), kError_NamespaceAccessSpecifiers); } return null; @@ -5639,7 +5664,7 @@ } else { - cx.error(node.name.pos()-1, kError_Unknown_Namespace); + cx.error(node.name.pos(), kError_Unknown_Namespace); } } return null; @@ -5698,14 +5723,14 @@ super_context.set(super_context.size()-1, super_error2); break; case super_error2: - cx.error(node.pos()-1,kError_IllegalSuperStatement); + cx.error(node.pos(),kError_IllegalSuperStatement); break; case super_error_es4: - cx.error(node.pos()-1, kError_InvalidES4SuperStatement); + cx.error(node.pos(), kError_InvalidES4SuperStatement); break; case super_error: default: - cx.error(node.pos()-1,kError_InvalidSuperStatement); + cx.error(node.pos(),kError_InvalidSuperStatement); break; } @@ -5741,9 +5766,9 @@ // If this is a toplevel definition (pkgdef!=null), then set up access namespaces - if( node.attrs != null && node.attrs.hasAttribute("static") ) + if( node.attrs != null && node.attrs.hasAttribute(STATIC) ) { - cx.error(node.attrs.pos()-1, kError_StaticModifiedNamespace); + cx.error(node.attrs.pos(), kError_StaticModifiedNamespace); } if( node.pkgdef != null && cx.getScopes().size() == 1 ) @@ -5778,7 +5803,7 @@ Namespaces hasNamespaces = obj.hasNames(cx,GET_TOKEN,node.ref.name,namespaces); if( hasNamespaces != null ) { - cx.error(node.pos()-1, kError_DuplicateNamespaceDefinition); + cx.error(node.pos(), kError_DuplicateNamespaceDefinition); } else { @@ -5839,7 +5864,7 @@ slot.setConst(true); if( slot.getObjectValue() == null ) { - cx.error(node.value.pos()-1, kError_InvalidNamespaceInitializer); + cx.error(node.value.pos(), kError_InvalidNamespaceInitializer); } node.needs_init = true; // need to re-evaluate to get this definition into the def_bits for the block @@ -5876,7 +5901,8 @@ unresolved.clear(); node.ref = (ReferenceValue)node.expr.evaluate(cx,this); - obj = ((node.ref.getValue(cx) instanceof ObjectValue) ? (ObjectValue)node.ref.getValue(cx) : null); + Value value = node.ref.getValue(cx); + obj = ((value instanceof ObjectValue) ? (ObjectValue) value : null); ns_unresolved_sets.last().addAll(unresolved); unresolved.clear(); Index: modules/asc/src/java/macromedia/asc/semantics/ObjectValue.java =================================================================== --- modules/asc/src/java/macromedia/asc/semantics/ObjectValue.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/semantics/ObjectValue.java (working copy) @@ -60,6 +60,8 @@ public class ObjectValue extends Value implements Comparable { + static final String EMPTY_STRING = "".intern(); + public static void NamespacesFromQualifiers(Qualifiers quals,Namespaces namespaces) { namespaces.clear(); @@ -141,15 +143,15 @@ public Builder builder; public TypeInfo type; - private String value = ""; + private String value = EMPTY_STRING; private Names names; // Names table public Slots slots; // Slots table, null=empty // private Values values; // Values table, null=empty public ObjectValue _proto_; - public String name = ""; - public String classname = ""; - public String debug_name = ""; + public String name = EMPTY_STRING; + public String classname = EMPTY_STRING; + public String debug_name = EMPTY_STRING; ObjectList base_objs; // can be interfaces, or base class private ObjectValue protected_ns; @@ -219,13 +221,13 @@ public ObjectValue(Context cx, Builder builder, TypeValue type) { - clearInstance(cx, builder, type, "", false); + clearInstance(cx, builder, type, EMPTY_STRING, false); } public void clearInstance(Context cx, Builder builder, TypeValue type, String name, boolean save_slot_ids) { flags = 0; - value = ""; + value = EMPTY_STRING; names = null; if( save_slot_ids && slots != null && slots.size() > 0) { @@ -233,8 +235,8 @@ } slots = null; // values = null; - classname = ""; - debug_name = ""; + classname = EMPTY_STRING; + debug_name = EMPTY_STRING; // baseMethodNames = null; deferredClassMap = null; base_objs = null; @@ -250,7 +252,8 @@ method_info = -1; initInstance(null, type); builder.build(cx, this); - this.name = name.intern(); + assert name.intern() == name; + this.name = name; } static Slot nullSlot = new MethodSlot((TypeValue)null, 0); @@ -800,8 +803,8 @@ public String toString() { if(Node.useDebugToStrings) - return ("ObjVal: <" + type + "> " + (name != null ? name.toString() : "") - + ((names != null && names.size()>0) ? "\nmethods: " + names.toString() : "")); + return ("ObjVal: <" + type + "> " + (name != null ? name.toString() : EMPTY_STRING) + + ((names != null && names.size()>0) ? "\nmethods: " + names.toString() : EMPTY_STRING)); else return getValue(); } Index: modules/asc/src/java/macromedia/asc/semantics/ReferenceValue.java =================================================================== --- modules/asc/src/java/macromedia/asc/semantics/ReferenceValue.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/semantics/ReferenceValue.java (working copy) @@ -46,7 +46,7 @@ public boolean is_nullable = true; public boolean has_nullable_anno = false; - public void setPosition(int pos) { src_position = pos-1; } + public void setPosition(int pos) { src_position = pos; } public int getPosition() { return src_position; } public ReferenceValue(Context cx, ObjectValue base, String name, ObjectValue qualifier) Index: modules/asc/src/java/macromedia/asc/semantics/TypeValue.java =================================================================== --- modules/asc/src/java/macromedia/asc/semantics/TypeValue.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/semantics/TypeValue.java (working copy) @@ -34,20 +34,20 @@ { } - public static TypeValue newTypeValue(Context cx, Builder builder, QName name, int type_id) - { - String fullname = name.toString(); - TypeValue type = cx.userDefined(fullname); - if (type == null) - { - type = new TypeValue(cx, builder, name, type_id); - cx.setUserDefined(fullname, type); - } - else - { - type.clearInstance(cx, builder, null, name.toString(), false); - type.type_id = type_id; - // Don't clear the prototype, we can reuse the object value + public static TypeValue newTypeValue(Context cx, Builder builder, QName name, int type_id) + { + String fullname = name.toString(); + TypeValue type = cx.userDefined(fullname); + if (type == null) + { + type = new TypeValue(cx, builder, name, type_id); + cx.setUserDefined(fullname, type); + } + else + { + type.clearInstance(cx, builder, null, fullname.intern(), false); + type.type_id = type_id; + // Don't clear the prototype, we can reuse the object value // type.prototype.clearInstance() = null; type.name = name; type.type = null; Index: modules/asc/src/java/macromedia/asc/util/BitSet.java =================================================================== --- modules/asc/src/java/macromedia/asc/util/BitSet.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/util/BitSet.java (working copy) @@ -258,7 +258,7 @@ public String toString() { - StringBuffer b = new StringBuffer("{"); + StringBuilder b = new StringBuilder("{"); if (bits != null) for (int i=0, n=bits.length<<6; i < n; i++) { Index: modules/asc/src/java/macromedia/asc/util/Context.java =================================================================== --- modules/asc/src/java/macromedia/asc/util/Context.java (revision 3507) +++ modules/asc/src/java/macromedia/asc/util/Context.java (working copy) @@ -212,7 +212,7 @@ // This method implements sprintf-like functionality for %s string argument insertions. Using sprintf would // be easier, but java doesn't have an equivalent. c++ matches java implementation to make it easier to keep both in sync. - public static int replaceStringArg(StringBuffer out, String templateStr, int startLoc, String arg) + public static int replaceStringArg(StringBuilder out, String templateStr, int startLoc, String arg) { if (startLoc == -1) // there are no more %'s to replace in templateStr return -1; @@ -247,7 +247,7 @@ public void error(int pos, int error, String arg1, String arg2) { error(pos, error, arg1, arg2, ""); } public void error(int pos, int error, String arg1, String arg2, String arg3) { - StringBuffer out = new StringBuffer(); + StringBuilder out = new StringBuilder(); // Just the arguments for sanities, no message (since they change often) if(ContextStatics.useSanityStyleErrors) @@ -765,7 +765,7 @@ { if ( !isExplicit && actual[0].getTypeValue() != noType()) // always allow coercion from Object. Just too common a problem without this { - error(expr.pos()-1, kError_ImplicitCoercionToSubtype, actual[0].getName(this).toString(), expected.getName(this).toString()); + error(expr.pos(), kError_ImplicitCoercionToSubtype, actual[0].getName(this).toString(), expected.getName(this).toString()); } } else if ( expected.getTypeValue() == stringType() && (actual[0].getTypeValue() == xmlType() || actual[0].getTypeValue() == xmlListType()) ) @@ -777,7 +777,7 @@ (expected.getTypeValue() == uintType() && (actual[0].getTypeValue() == intType() || actual[0].getTypeValue() == numberType())) || (expected.getTypeValue() == intType() && (actual[0].getTypeValue() == uintType() || actual[0].getTypeValue() == numberType())) )) // always allow coercion between number types { - error(expr.pos()-1, kError_ImplicitCoercisionOfUnrelatedType, actual[0].getName(this).toString(), expected.getName(this).toString()); + error(expr.pos(), kError_ImplicitCoercisionOfUnrelatedType, actual[0].getName(this).toString(), expected.getName(this).toString()); } } } @@ -1417,7 +1417,7 @@ else { // must use the context in effect when the unresolvedNamespace was created. The node may have come from an included file. - ns.cx.error(ns.node.pos()-1, kError_Unknown_Namespace); + ns.cx.error(ns.node.pos(), kError_Unknown_Namespace); } // null out the Context object. it's no longer used. UnresolvedNamespace instances may be referenced @@ -1435,7 +1435,7 @@ public String debugName(String region_part, String name, ObjectList namespace_ids, int kind ) { String kind_part = kind==GET_TOKEN?"/get":(kind==SET_TOKEN?"/set":""); - StringBuffer namespace_part = new StringBuffer(region_part.length() + name.length() + kind_part.length() + ((namespace_ids != null ? namespace_ids.size() * 8 : 0))); + StringBuilder namespace_part = new StringBuilder(region_part.length() + name.length() + kind_part.length() + ((namespace_ids != null ? namespace_ids.size() * 8 : 0))); namespace_part.append(region_part); int region_part_length = region_part.length(); if (region_part_length > 0) @@ -1500,12 +1500,12 @@ public String getConfigVarCode() { String code = null; - StringBuffer code_buffer; + StringBuilder code_buffer; if( config_vars != null && config_vars.size() > 0) { HashSet namespaces = new HashSet(); // guesstimate. Should avoid resizing too many times. - code_buffer = new StringBuffer(config_vars.size()*10); + code_buffer = new StringBuilder(config_vars.size()*10); for( int i = 0, size = config_vars.size(); i < size; ++i ) { ConfigVar cv = config_vars.at(i); Index: modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/ClassInstantiationErr3.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/ClassInstantiationErr3.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/ClassInstantiationErr3.err (working copy) @@ -1,7 +1,5 @@ - -[Compiler] Error #1139: Variable declarations are not permitted in interfaces. - ClassInstantiationErr3.as, Ln 6, Col 8: - var a = new A(); - .......^ - +\[Compiler\] Error #1139: Variable declarations are not permitted in interfaces. +.*ClassInstantiationErr3.as, Ln 6, Col 7: +var a = new A\(\); +......^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/ClassInstantiationErr5.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/ClassInstantiationErr5.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/ClassInstantiationErr5.err (working copy) @@ -1,7 +1,5 @@ - -[Compiler] Error #1105: Target of assignment must be a reference value. - ClassInstantiationErr5.as, Ln 7, Col 7: - new A() = new B(); - ......^ - +\[Compiler\] Error #1105: Target of assignment must be a reference value. +.*ClassInstantiationErr5.as, Ln 7, Col 6: +new A\(\) = new B\(\); +.....^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/ConstructorReturnTypeErr.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/ConstructorReturnTypeErr.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/ConstructorReturnTypeErr.err (working copy) @@ -1,7 +1,5 @@ - -[Compiler] Error #1130: A constructor cannot specify a return type. - ConstructorReturnTypeErr.as, Ln 18, Col 20: - public function Bar():Bar{} - ...................^ - +\[Compiler\] Error #1130: A constructor cannot specify a return type. +.*ConstructorReturnTypeErr.as, Ln 18, Col 19: +public function Bar\(\):Bar\{\} +..................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/dynClassWithConsWithReturnTypeErr.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/dynClassWithConsWithReturnTypeErr.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/dynClassWithConsWithReturnTypeErr.err (working copy) @@ -1,7 +1,5 @@ - -[Compiler] Error #1130: A constructor cannot specify a return type. - dynClassWithConsWithReturnTypeErr.as, Ln 7, Col 34: - public function dynClassWithConsWithReturnTypeErr\(a:Nu... - .................................^ - +\[Compiler\] Error #1130: A constructor cannot specify a return type. +.*dynClassWithConsWithReturnTypeErr.as, Ln 7, Col 33: +public function dynClassWithConsWithReturnTypeErr\(a:Nu... +................................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/dynClassWithParamConsWithReturnErr.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/dynClassWithParamConsWithReturnErr.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/dynClassWithParamConsWithReturnErr.err (working copy) @@ -1,7 +1,5 @@ - -[Compiler] Error #1051: Return value must be undefined. - dynClassWithParamConsWithReturnErr.as, Ln 11, Col 87: - return z=x\+y; - ......................................................................................^ - +\[Compiler\] Error #1051: Return value must be undefined. +.*dynClassWithParamConsWithReturnErr.as, Ln 11, Col 86: +return z=x\+y; +.....................................................................................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/dynpubClassWithintConsErr.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/dynpubClassWithintConsErr.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/dynpubClassWithintConsErr.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1153: A constructor can only be declared public. - dynpubClassWithintConsErr.as, Ln 5, Col 36: + dynpubClassWithintConsErr.as, Ln 5, Col 35: internal function dynpubClassWithintCons(){ - ...................................^ + ..................................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/dynpubClassWithPrivConsErr.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/dynpubClassWithPrivConsErr.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/dynpubClassWithPrivConsErr.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1153: A constructor can only be declared public. - dynpubClassWithPrivConsErr.as, Ln 6, Col 35: + dynpubClassWithPrivConsErr.as, Ln 6, Col 34: private function dynpubClassWithPrivCons(){ - ..................................^ + .................................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/intClassWithConsWithReturnTypeErr.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/intClassWithConsWithReturnTypeErr.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/intClassWithConsWithReturnTypeErr.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1130: A constructor cannot specify a return type. - intClassWithConsWithReturnTypeErr.as, Ln 7, Col 34: + intClassWithConsWithReturnTypeErr.as, Ln 7, Col 33: public function intClassWithConsWithReturnTypeErr\(a:Nu... - .................................^ + ................................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/intClassWithParamConsWithReturnErr.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/intClassWithParamConsWithReturnErr.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/intClassWithParamConsWithReturnErr.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1051: Return value must be undefined. - intClassWithParamConsWithReturnErr.as, Ln 10, Col 87: + intClassWithParamConsWithReturnErr.as, Ln 10, Col 86: return z=x\+y; - ......................................................................................^ + .....................................................................................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/internalClassWithPrivConsErr.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/internalClassWithPrivConsErr.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/internalClassWithPrivConsErr.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1153: A constructor can only be declared public. - internalClassWithPrivConsErr.as, Ln 6, Col 35: + internalClassWithPrivConsErr.as, Ln 6, Col 34: private function internalClassWithPrivCons(){ - ..................................^ + .................................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/pubClassWithConsWithReturnTypeErr.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/pubClassWithConsWithReturnTypeErr.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/pubClassWithConsWithReturnTypeErr.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1130: A constructor cannot specify a return type. - pubClassWithConsWithReturnTypeErr.as, Ln 7, Col 34: + pubClassWithConsWithReturnTypeErr.as, Ln 7, Col 33: public function pubClassWithConsWithReturnTypeErr\(a:Nu... - .................................^ + ................................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/pubClassWithParamConsWithReturnErr.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/pubClassWithParamConsWithReturnErr.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/pubClassWithParamConsWithReturnErr.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1051: Return value must be undefined. - pubClassWithParamConsWithReturnErr.as, Ln 12, Col 87: + pubClassWithParamConsWithReturnErr.as, Ln 12, Col 86: return z=x\+y; - ......................................................................................^ + .....................................................................................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/publicClassWithinternalConsErr.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/publicClassWithinternalConsErr.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/publicClassWithinternalConsErr.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1153: A constructor can only be declared public. - publicClassWithinternalConsErr.as, Ln 7, Col 36: + publicClassWithinternalConsErr.as, Ln 7, Col 35: internal function publicClassWithinternalCons(){ - ...................................^ + ..................................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/publicClassWithPrivConsErr.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/publicClassWithPrivConsErr.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/publicClassWithPrivConsErr.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1153: A constructor can only be declared public. - publicClassWithPrivConsErr.as, Ln 7, Col 35: + publicClassWithPrivConsErr.as, Ln 7, Col 34: private function publicClassWithPrivCons(){ - ..................................^ + .................................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/wrapinternalClassWithinternalConsErr.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/wrapinternalClassWithinternalConsErr.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/wrapinternalClassWithinternalConsErr.err (working copy) @@ -1,7 +1,5 @@ - -[Compiler] Error #1153: A constructor can only be declared public. - wrapinternalClassWithinternalConsErr.as, Ln 7, Col 36: +\[Compiler\] Error #1153: A constructor can only be declared public. +.*wrapinternalClassWithinternalConsErr.as, Ln 7, Col 35: internal function internalClassWithinternalCons\(a:Numb... - ...................................^ - + ..................................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/wrapinternalClassWithPrivConsErr.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/wrapinternalClassWithPrivConsErr.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/ClassDef/wrapinternalClassWithPrivConsErr.err (working copy) @@ -1,7 +1,5 @@ - [Compiler] Error #1153: A constructor can only be declared public. - wrapinternalClassWithPrivConsErr.as, Ln 6, Col 35: + wrapinternalClassWithPrivConsErr.as, Ln 6, Col 34: private function internalClassWithPrivCons(){ - ..................................^ - + .................................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/ExtImpl/PublicSubClassErr.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/ExtImpl/PublicSubClassErr.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/ExtImpl/PublicSubClassErr.err (working copy) @@ -1,7 +1,5 @@ - [Compiler] Error #1000: Ambiguous reference to MyString. - PublicSubClassErr.as, Ln 53, Col 9: - PubInt3.MyString();//This should throw an ambiguous reference error --... - ........^ - + PublicSubClassErr.as, Ln 53, Col 9: +PubInt3.MyString();//This should throw an ambiguous reference error --... +........^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideDiffParamsErr1.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideDiffParamsErr1.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideDiffParamsErr1.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1023: Incompatible override. - OverrideDiffParamsErr1.as, Ln 7, Col 29: + OverrideDiffParamsErr1.as, Ln 7, Col 28: override public function setString\( s:Boolean \) : void {} - ............................^ + ...........................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideDiffParamsErr2.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideDiffParamsErr2.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideDiffParamsErr2.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1023: Incompatible override. - OverrideDiffParamsErr2.as, Ln 7, Col 29: + OverrideDiffParamsErr2.as, Ln 7, Col 28: override public function setString\( n:Number, s:String \) : void {} - ............................^ + ...........................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideDiffReturnTypeErr.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideDiffReturnTypeErr.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideDiffReturnTypeErr.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1023: Incompatible override. - OverrideDiffReturnTypeErr.as, Ln 7, Col 29: + OverrideDiffReturnTypeErr.as, Ln 7, Col 28: override public function returnString() : Boolean {} - ............................^ + ...........................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideParamTypeErr1.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideParamTypeErr1.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideParamTypeErr1.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1023: Incompatible override. - OverrideParamTypeErr1.as, Ln 7, Col 22: + OverrideParamTypeErr1.as, Ln 7, Col 21: override function foo\( s:String \){} - .....................^ + ....................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideParamTypeErr2.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideParamTypeErr2.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideParamTypeErr2.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1023: Incompatible override. - OverrideParamTypeErr2.as, Ln 7, Col 22: + OverrideParamTypeErr2.as, Ln 7, Col 21: override function foo\( s \){} - .....................^ + ....................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideReturnTypeErr1.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideReturnTypeErr1.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideReturnTypeErr1.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1023: Incompatible override. - OverrideReturnTypeErr1.as, Ln 7, Col 22: + OverrideReturnTypeErr1.as, Ln 7, Col 21: override function foo() { return "foo" } - .....................^ + ....................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideReturnTypeErr2.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideReturnTypeErr2.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideReturnTypeErr2.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1023: Incompatible override. - OverrideReturnTypeErr2.as, Ln 7, Col 22: + OverrideReturnTypeErr2.as, Ln 7, Col 21: override function foo() : String{ return "foo" } - .....................^ + ....................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideWithOptionalParamsErr1.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideWithOptionalParamsErr1.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideWithOptionalParamsErr1.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1023: Incompatible override. - OverrideWithOptionalParamsErr1.as, Ln 7, Col 22: + OverrideWithOptionalParamsErr1.as, Ln 7, Col 21: override function foo\( s:String \){} - .....................^ + ....................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideWithOptionalParamsErr2.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideWithOptionalParamsErr2.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Classes/Override/OverrideWithOptionalParamsErr2.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1023: Incompatible override. - OverrideWithOptionalParamsErr2.as, Ln 7, Col 22: + OverrideWithOptionalParamsErr2.as, Ln 7, Col 21: override function foo\( s:String = "default" \){} - .....................^ + ....................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Function/EmptyNameErr17.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Function/EmptyNameErr17.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Function/EmptyNameErr17.err (working copy) @@ -1,22 +1,9 @@ - -[Compiler] Error #1094: Syntax error: A string literal must be terminated before the line break. - EmptyNameErr17.as, Ln 5, Col 15: - function a'b () {} - ..............^ - -[Compiler] Error #1084: Syntax error: expecting leftparen before end of program. - EmptyNameErr17.as, Ln 8, Col 1: - -[Compiler] Error #1084: Syntax error: expecting identifier before end of program. - EmptyNameErr17.as, Ln 8, Col 1: - -[Compiler] Error #1084: Syntax error: expecting rightparen before end of program. - EmptyNameErr17.as, Ln 8, Col 1: - -[Compiler] Error #1084: Syntax error: expecting rightbrace before end of program. - EmptyNameErr17.as, Ln 8, Col 1: - -[Compiler] Error #1084: Syntax error: expecting rightbrace before end of program. - EmptyNameErr17.as, Ln 8, Col 1: - -6 errors found +\[Compiler\] Error #1094: Syntax error: A string literal must be terminated before the line break. +.*EmptyNameErr17.as, Ln 5, Col 15: +function a'b \(\) \{\} +..............^ +\[Compiler\] Error #1084: Syntax error: expecting rightbrace before end of program. +.*EmptyNameErr17.as, Ln 8, Col 1: +\[Compiler\] Error #1084: Syntax error: expecting rightbrace before end of program. +.*EmptyNameErr17.as, Ln 8, Col 1: +3 errors found Index: modules/asc/test/compiler/as3/Definitions/Function/FreeFloatingFuncBodyErr.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Function/FreeFloatingFuncBodyErr.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Function/FreeFloatingFuncBodyErr.err (working copy) @@ -10,8 +10,8 @@ .........^ [Compiler] Error #1177: The return statement cannot be used in global initialization code. - FreeFloatingFuncBodyErr.as, Ln 3, Col 36: + FreeFloatingFuncBodyErr.as, Ln 3, Col 35: return "this should not compile"; - ...................................^ + ..................................^ 3 errors found Index: modules/asc/test/compiler/as3/Definitions/Function/OneOptArgFunctionErr2.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Function/OneOptArgFunctionErr2.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Function/OneOptArgFunctionErr2.err (working copy) @@ -1,17 +1,13 @@ - -[Compiler] Error #1030: Must specify name of variable arguments array. -as3.Definitions.Function.OneOptArgFunctionErr2.as, Ln 50, Col 74: -function returnStringInner\(s:String = "inside class inside package",...\):String { ... -.........................................................................^ - -[Compiler] Error #1030: Must specify name of variable arguments array. -as3.Definitions.Function.OneOptArgFunctionErr2.as, Ln 56, Col 51: -function returnBooleanInner\(b:Boolean = true,...\):Boolean { return b... -..................................................^ - -[Compiler] Error #1030: Must specify name of variable arguments array. -as3.Definitions.Function.OneOptArgFunctionErr2.as, Ln 62, Col 48: -function returnNumberInner\(b:Number = 100,...\):Number { return n; } -...............................................^ - +\[Compiler\] Error #1030: Must specify name of variable arguments array. +.*OneOptArgFunctionErr2.as, Ln 50, Col 73: +function returnStringInner\(s:String = "inside class inside package",...\):String \{... +........................................................................^ +\[Compiler\] Error #1030: Must specify name of variable arguments array. +.*OneOptArgFunctionErr2.as, Ln 56, Col 50: +function returnBooleanInner\(b:Boolean = true,...\):Boolean \{ return b... +.................................................^ +\[Compiler\] Error #1030: Must specify name of variable arguments array. +.*OneOptArgFunctionErr2.as, Ln 62, Col 47: +function returnNumberInner\(b:Number = 100,...\):Number \{ return n; \} +..............................................^ 3 errors found Index: modules/asc/test/compiler/as3/Definitions/Function/OverrideErr10.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Function/OverrideErr10.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Function/OverrideErr10.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1023: Incompatible override. - OverrideErr10.as, Ln 8, Col 22: + OverrideErr10.as, Ln 8, Col 21: override function f\(x\) {} - .....................^ + ....................^ 1 error found Index: modules/asc/test/compiler/as3/Definitions/Function/OverrideErr11.err =================================================================== --- modules/asc/test/compiler/as3/Definitions/Function/OverrideErr11.err (revision 3507) +++ modules/asc/test/compiler/as3/Definitions/Function/OverrideErr11.err (working copy) @@ -1,7 +1,7 @@ [Compiler] Error #1023: Incompatible override. - OverrideErr11.as, Ln 8, Col 22: + OverrideErr11