diff --git a/libsrc/ffdec_lib/lexers/text.flex b/libsrc/ffdec_lib/lexers/text.flex index 142aa531d..179535dda 100644 --- a/libsrc/ffdec_lib/lexers/text.flex +++ b/libsrc/ffdec_lib/lexers/text.flex @@ -33,6 +33,7 @@ package com.jpexs.decompiler.flash.tags.text; StringBuffer string = null; boolean finish = false; + boolean parameter = false; String parameterName = null; /** @@ -64,6 +65,7 @@ HexDigit = [0-9a-fA-F] { "[" { + parameter = true; yybegin(PARAMETER); if (string != null){ String ret = string.toString(); @@ -99,6 +101,7 @@ HexDigit = [0-9a-fA-F] } "]" { yybegin(YYINITIAL); + parameter = false; } } @@ -110,9 +113,10 @@ HexDigit = [0-9a-fA-F] } "]" { yybegin(YYINITIAL); + parameter = false; } } /* error fallback */ -[^] { } +[^] { if (!parameter) { if (string == null) string = new StringBuffer(); string.append(yytext()); } } <> { return null; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/text/TextLexer.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/text/TextLexer.java index 5084a444e..a69cc3a34 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/text/TextLexer.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/text/TextLexer.java @@ -20,8 +20,9 @@ package com.jpexs.decompiler.flash.tags.text; /** * This class is a scanner generated by - * JFlex 1.6.0 from the specification file - * D:/Dropbox/Programovani/JavaSE/FFDec/libsrc/ffdec_lib/lexers/text.flex + * JFlex 1.6.0 + * from the specification file + * C:/Projects/FFDec/jpexs-decompiler/libsrc/ffdec_lib/lexers/text.flex */ public final class TextLexer { @@ -46,8 +47,9 @@ public final class TextLexer { /** * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l - * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l at the - * beginning of a line l is of the form l = 2*k, k a non negative integer + * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l + * at the beginning of a line + * l is of the form l = 2*k, k a non negative integer */ private static final int ZZ_LEXSTATE[] = { 0, 0, 1, 1, 2, 2 @@ -74,9 +76,9 @@ public final class TextLexer { private static final int[] ZZ_ACTION = zzUnpackAction(); private static final String ZZ_ACTION_PACKED_0 - = "\3\0\1\1\1\2\1\1\1\3\1\4\1\5\1\3" - + "\1\6\1\7\1\10\1\11\1\12\1\13\1\14\1\15" - + "\1\16\1\17\1\20\1\21\1\7\1\0\1\22"; + = "\3\0\1\1\1\2\1\1\1\3\1\4\1\5\1\6" + + "\1\7\1\10\1\11\1\12\1\13\1\14\1\15\1\16" + + "\1\17\1\20\1\21\1\22\1\10\1\0\1\23"; private static int[] zzUnpackAction() { int[] result = new int[25]; @@ -235,8 +237,8 @@ public final class TextLexer { private int zzLexicalState = YYINITIAL; /** - * this buffer contains the current text to be matched and is the source of - * the yytext() string + * this buffer contains the current text to be matched and is + * the source of the yytext() string */ private char zzBuffer[] = new char[ZZ_BUFFERSIZE]; @@ -256,8 +258,8 @@ public final class TextLexer { private int zzStartRead; /** - * endRead marks the last character in the buffer, that has been read from - * input + * endRead marks the last character in the buffer, that has been read + * from input */ private int zzEndRead; @@ -293,10 +295,10 @@ public final class TextLexer { private boolean zzEOFDone; /** - * The number of occupied positions in zzBuffer beyond zzEndRead. When a - * lead/high surrogate has been read from the input stream into the final - * zzBuffer position, this will have a value of 1; otherwise, it will have a - * value of 0. + * The number of occupied positions in zzBuffer beyond zzEndRead. + * When a lead/high surrogate has been read from the input stream + * into the final zzBuffer position, this will have a value of 1; + * otherwise, it will have a value of 0. */ private int zzFinalHighSurrogate = 0; @@ -305,6 +307,8 @@ public final class TextLexer { boolean finish = false; + boolean parameter = false; + String parameterName = null; /** @@ -417,8 +421,6 @@ public final class TextLexer { /** * Closes the input stream. - * - * @throws java.io.IOException */ public final void yyclose() throws java.io.IOException { zzAtEOF = true; /* indicate end of file */ @@ -431,12 +433,12 @@ public final class TextLexer { } /** - * Resets the scanner to read from a new input stream. Does not close the - * old reader. + * Resets the scanner to read from a new input stream. + * Does not close the old reader. * * All internal variables are reset, the old input stream - * cannot be reused (internal buffer is discarded and lost). Lexical - * state is set to ZZ_INITIAL. + * cannot be reused (internal buffer is discarded and lost). + * Lexical state is set to ZZ_INITIAL. * * Internal scan buffer is resized down to its initial length, if it has * grown. @@ -460,8 +462,6 @@ public final class TextLexer { /** * Returns the current lexical state. - * - * @return */ public final int yystate() { return zzLexicalState; @@ -478,20 +478,19 @@ public final class TextLexer { /** * Returns the text matched by the current regular expression. - * - * @return */ public final String yytext() { return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead); } /** - * Returns the character at position pos from the matched text. + * Returns the character at position pos from the + * matched text. * * It is equivalent to yytext().charAt(pos), but faster * - * @param pos the position of the character to fetch. A value from 0 to - * yylength()-1. + * @param pos the position of the character to fetch. + * A value from 0 to yylength()-1. * * @return the character at position pos */ @@ -501,8 +500,6 @@ public final class TextLexer { /** * Returns the length of the matched text region. - * - * @return */ public final int yylength() { return zzMarkedPos - zzStartRead; @@ -511,13 +508,14 @@ public final class TextLexer { /** * Reports an error that occured while scanning. * - * In a wellformed scanner (no or only correct usage of yypushback(int) and - * a match-all fallback rule) this method will only be called with things - * that "Can't Possibly Happen". If this method is called, something is - * seriously wrong (e.g. a JFlex bug producing a faulty scanner etc.). + * In a wellformed scanner (no or only correct usage of + * yypushback(int) and a match-all fallback rule) this method + * will only be called with things that "Can't Possibly Happen". + * If this method is called, something is seriously wrong + * (e.g. a JFlex bug producing a faulty scanner etc.). * - * Usual syntax/scanner level error handling should be done in error - * fallback rules. + * Usual syntax/scanner level error handling should be done + * in error fallback rules. * * @param errorCode the code of the errormessage to display */ @@ -537,8 +535,8 @@ public final class TextLexer { * * They will be read again by then next call of the scanning method * - * @param number the number of characters to be read again. This number must - * not be greater than yylength()! + * @param number the number of characters to be read again. + * This number must not be greater than yylength()! */ public void yypushback(int number) { if (number > yylength()) { @@ -549,12 +547,11 @@ public final class TextLexer { } /** - * Resumes scanning until the next regular expression is matched, the end of - * input is encountered or an I/O-Error occurs. + * Resumes scanning until the next regular expression is matched, + * the end of input is encountered or an I/O-Error occurs. * * @return the next token * @exception java.io.IOException if any I/O-Error occurs - * @throws com.jpexs.decompiler.flash.tags.text.TextParseException */ public ParsedSymbol yylex() throws java.io.IOException, TextParseException { int zzInput; @@ -703,9 +700,10 @@ public final class TextLexer { } string.append(yytext()); } - case 19: + case 20: break; case 2: { + parameter = true; yybegin(PARAMETER); if (string != null) { String ret = string.toString(); @@ -713,119 +711,130 @@ public final class TextLexer { return new ParsedSymbol(SymbolType.TEXT, ret); } } - case 20: + case 21: break; case 3: { + if (!parameter) { + if (string == null) { + string = new StringBuffer(); + } + string.append(yytext()); + } } - case 21: + case 22: break; case 4: { parameterName = yytext(); yybegin(VALUE); } - case 22: + case 23: break; case 5: { yybegin(YYINITIAL); - } - case 23: - break; - case 6: { - yybegin(PARAMETER); - return new ParsedSymbol(SymbolType.PARAMETER, new Object[]{parameterName, yytext()}); + parameter = false; } case 24: break; - case 7: { - throw new TextParseException("Illegal escape sequence \"" + yytext() + "\"", yyline + 1); + case 6: { } case 25: break; - case 8: { - if (string == null) { - string = new StringBuffer(); - } - string.append(']'); + case 7: { + yybegin(PARAMETER); + return new ParsedSymbol(SymbolType.PARAMETER, new Object[]{parameterName, yytext()}); } case 26: break; + case 8: { + throw new TextParseException("Illegal escape sequence \"" + yytext() + "\"", yyline + 1); + } + case 27: + break; case 9: { if (string == null) { string = new StringBuffer(); } - string.append('['); + string.append(']'); } - case 27: + case 28: break; case 10: { if (string == null) { string = new StringBuffer(); } - string.append('\\'); + string.append('['); } - case 28: + case 29: break; case 11: { if (string == null) { string = new StringBuffer(); } - string.append('\b'); + string.append('\\'); } - case 29: + case 30: break; case 12: { if (string == null) { string = new StringBuffer(); } - string.append('\t'); + string.append('\b'); } - case 30: + case 31: break; case 13: { if (string == null) { string = new StringBuffer(); } - string.append('\n'); + string.append('\t'); } - case 31: + case 32: break; case 14: { if (string == null) { string = new StringBuffer(); } - string.append('\f'); + string.append('\n'); } - case 32: + case 33: break; case 15: { if (string == null) { string = new StringBuffer(); } - string.append('\r'); + string.append('\f'); } - case 33: + case 34: break; case 16: { if (string == null) { string = new StringBuffer(); } - string.append('\"'); + string.append('\r'); } - case 34: + case 35: break; case 17: { if (string == null) { string = new StringBuffer(); } - string.append('\''); + string.append('\"'); } - case 35: + case 36: break; case 18: { + if (string == null) { + string = new StringBuffer(); + } + string.append('\''); + } + case 37: + break; + case 19: { char val = (char) Integer.parseInt(yytext().substring(2), 16); string.append(val); } - case 36: + case 38: break; default: if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {