org.fife.ui.rsyntaxtextarea.modes.PHPTokenMaker Maven / Gradle / Ivy
The newest version!
/* The following code was generated by JFlex 1.4.1 on 5/7/14 11:03 PM */ /* * 01/28/2009 * * PHPTokenMaker.java - Generates tokens for PHP syntax highlighting. * * This library is distributed under a modified BSD license. See the included * RSyntaxTextArea.License.txt file for details. */ package org.fife.ui.rsyntaxtextarea.modes; import java.io.*; import javax.swing.text.Segment; import org.fife.ui.rsyntaxtextarea.*; /** * Scanner for PHP files. * * This implementation was created using * JFlex 1.4.1; however, the generated file * was modified for performance. Memory allocation needs to be almost * completely removed to be competitive with the handwritten lexers (subclasses * of
file will contain two * definitions of bothAbstractTokenMaker
, so this class has been modified so that * Strings are never allocated (via yytext()), and the scanner never has to * worry about refilling its buffer (needlessly copying chars around). * We can achieve this because RText always scans exactly 1 line of tokens at a * time, and hands the scanner this line as an array of characters (a Segment * really). Since tokens contain pointers to char arrays instead of Strings * holding their contents, there is no need for allocating new memory for * Strings.* * The actual algorithm generated for scanning has, of course, not been * modified.
* * If you wish to regenerate this file yourself, keep in mind the following: *
*
- The generated PHPTokenMaker.java
zzRefill
andyyreset
. * You should hand-delete the second of each definition (the ones * generated by the lexer), as these generated methods modify the input * buffer, which we'll never have to do. *
yylex()
on the generated scanner
* directly; rather, you should use getTokenList
as you would
* with any other TokenMaker
instance.aState
*/
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\5\0\2\1\1\0\2\1\1\0\2\1\13\0\1\1"+
"\3\0\2\1\1\11\4\1\1\11\5\1\2\11\3\1"+
"\1\11\1\1\3\11\1\1\1\11\26\1\1\11\1\1"+
"\1\11\1\1\7\11\1\1\1\11\2\1\2\11\10\1"+
"\1\11\3\1\1\11\21\1\1\11\2\1\1\11\2\1"+
"\1\11\1\1\1\11\1\1\1\11\2\1\1\11\6\1"+
"\1\11\4\1\1\11\1\1\1\11\40\1\1\11\5\1"+
"\1\11\2\1\2\11\3\1\1\11\1\1\3\11\1\1"+
"\1\11\5\1\4\11\4\1\4\11\1\1\1\11\6\1"+
"\7\11\6\1\1\11\5\0\105\1\1\11\2\0\1\1"+
"\1\0\1\11\1\0\76\1\1\11\3\1\1\0\1\11"+
"\11\0\13\1\1\11\307\1\2\11\1\1\1\11\1\0"+
"\1\11\1\1\15\0\1\1\1\11\5\0\1\1\1\0"+
"\1\11\3\1\2\0\1\11\4\0\101\1\3\0\1\1"+
"\1\0\3\1\1\0\67\1\16\0\u0185\1\25\0\2\1"+
"\1\11\3\0\45\1\3\0\1\11\43\1\2\0\1\11"+
"\4\0\1\1\3\0\u01fb\1\17\0\1\11\4\0\2\1"+
"\1\11\2\0\25\1\1\11\1\0\1\11\25\1\2\11"+
"\6\0\u0278\1\16\0\14\1\1\0\14\1\2\0\u02b3\1"+
"\12\0\4\1\1\0\6\1\2\0\u02d6\1\6\0\1\1"+
"\1\0\2\1\2\0\u02a1\1\1\11\4\0\1\1\1\11"+
"\1\1\2\11\u0267\1\3\0\u021c\1\3\0\1\11\u083e\1";
private static int [] zzUnpackAttribute() {
int [] result = new int[7962];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAttribute(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/** the input device */
private java.io.Reader zzReader;
/** the current state of the DFA */
private int zzState;
/** the current lexical state */
private int zzLexicalState = YYINITIAL;
/** this buffer contains the current text to be matched and is
the source of the yytext() string */
private char zzBuffer[];
/** the textposition at the last accepting state */
private int zzMarkedPos;
/** the current text position in the buffer */
private int zzCurrentPos;
/** startRead marks the beginning of the yytext() string in the buffer */
private int zzStartRead;
/** endRead marks the last character in the buffer, that has been read
from input */
private int zzEndRead;
/** zzAtEOF == true <=> the scanner is at the EOF */
private boolean zzAtEOF;
/* user code: */
/**
* Type specific to PHPTokenMaker denoting a line ending with an unclosed
* double-quote attribute.
*/
private static final int INTERNAL_ATTR_DOUBLE = -1;
/**
* Type specific to PHPTokenMaker denoting a line ending with an unclosed
* single-quote attribute.
*/
private static final int INTERNAL_ATTR_SINGLE = -2;
/**
* Token type specific to PHPTokenMaker; this signals that the user has
* ended a line with an unclosed HTML tag; thus a new line is beginning
* still inside of the tag.
*/
private static final int INTERNAL_INTAG = -3;
/**
* Token type specific to PHPTokenMaker; this signals that the user has
* ended a line with an unclosed <script>
tag.
*/
private static final int INTERNAL_INTAG_SCRIPT = -4;
/**
* Token type specifying we're in a double-qouted attribute in a
* script tag.
*/
private static final int INTERNAL_ATTR_DOUBLE_QUOTE_SCRIPT = -5;
/**
* Token type specifying we're in a single-qouted attribute in a
* script tag.
*/
private static final int INTERNAL_ATTR_SINGLE_QUOTE_SCRIPT = -6;
/**
* Token type specifying that the user has
* ended a line with an unclosed <style>
tag.
*/
private static final int INTERNAL_INTAG_STYLE = -7;
/**
* Token type specifying we're in a double-qouted attribute in a
* style tag.
*/
private static final int INTERNAL_ATTR_DOUBLE_QUOTE_STYLE = -8;
/**
* Token type specifying we're in a single-qouted attribute in a
* style tag.
*/
private static final int INTERNAL_ATTR_SINGLE_QUOTE_STYLE = -9;
/**
* Token type specifying we're in JavaScript.
*/
private static final int INTERNAL_IN_JS = -10;
/**
* Token type specifying we're in a JavaScript multiline comment.
*/
private static final int INTERNAL_IN_JS_MLC = -11;
/**
* Token type specifying we're in an invalid multi-line JS string.
*/
private static final int INTERNAL_IN_JS_STRING_INVALID = -12;
/**
* Token type specifying we're in a valid multi-line JS string.
*/
private static final int INTERNAL_IN_JS_STRING_VALID = -13;
/**
* Token type specifying we're in an invalid multi-line JS single-quoted string.
*/
private static final int INTERNAL_IN_JS_CHAR_INVALID = -14;
/**
* Token type specifying we're in a valid multi-line JS single-quoted string.
*/
private static final int INTERNAL_IN_JS_CHAR_VALID = -15;
/**
* Internal type denoting a line ending in CSS.
*/
private static final int INTERNAL_CSS = -16;
/**
* Internal type denoting a line ending in a CSS property.
*/
private static final int INTERNAL_CSS_PROPERTY = -17;
/**
* Internal type denoting a line ending in a CSS property value.
*/
private static final int INTERNAL_CSS_VALUE = -18;
/**
* Internal type denoting line ending in a CSS double-quote string.
* The state to return to is embedded in the actual end token type.
*/
private static final int INTERNAL_CSS_STRING = -(1<<11);
/**
* Internal type denoting line ending in a CSS single-quote string.
* The state to return to is embedded in the actual end token type.
*/
private static final int INTERNAL_CSS_CHAR = -(2<<11);
/**
* Internal type denoting line ending in a CSS multi-line comment.
* The state to return to is embedded in the actual end token type.
*/
private static final int INTERNAL_CSS_MLC = -(3<<11);
/**
* Token type specifying we're in PHP. This particular field is public so
* that we can hack and key off of it for code completion.
*/
public static final int INTERNAL_IN_PHP = -(4<<11);
/**
* Token type specifying we're in a PHP multiline comment.
*/
private static final int INTERNAL_IN_PHP_MLC = -(5<<11);
/**
* Token type specifying we're in a PHP multiline string.
*/
private static final int INTERNAL_IN_PHP_STRING = -(6<<11);
/**
* Token type specifying we're in a PHP multiline char.
*/
private static final int INTERNAL_IN_PHP_CHAR = -(7<<11);
/**
* The state previous CSS-related state we were in before going into a CSS
* string, multi-line comment, etc.
*/
private int cssPrevState;
/**
* Whether closing markup tags are automatically completed for PHP.
*/
private static boolean completeCloseTags;
/**
* The state PHP was started in (YYINITIAL, INTERNAL_IN_JS, etc.).
*/
private int phpInState;
/**
* The language index we were in when PHP was started.
*/
private int phpInLangIndex;
/**
* When in the JS_STRING state, whether the current string is valid.
*/
private boolean validJSString;
/**
* Language state set on HTML tokens. Must be 0.
*/
private static final int LANG_INDEX_DEFAULT = 0;
/**
* Language state set on JavaScript tokens.
*/
private static final int LANG_INDEX_JS = 1;
/**
* Language state set on CSS tokens.
*/
private static final int LANG_INDEX_CSS = 2;
/**
* Language state set on PHP.
*/
private static final int LANG_INDEX_PHP = 3;
/**
* Constructor. This must be here because JFlex does not generate a
* no-parameter constructor.
*/
public PHPTokenMaker() {
super();
}
/**
* Adds the token specified to the current linked list of tokens as an
* "end token;" that is, at zzMarkedPos
.
*
* @param tokenType The token's type.
*/
private void addEndToken(int tokenType) {
addToken(zzMarkedPos,zzMarkedPos, tokenType);
}
/**
* Adds the token specified to the current linked list of tokens.
*
* @param tokenType The token's type.
* @see #addToken(int, int, int)
*/
private void addHyperlinkToken(int start, int end, int tokenType) {
int so = start + offsetShift;
addToken(zzBuffer, start,end, tokenType, so, true);
}
/**
* Adds an end token that encodes the information necessary to return
* to the pre-PHP state and language index.
*
* @param endTokenState The PHP-related end-token state.
*/
private void addPhpEndToken(int endTokenState) {
addEndToken(endTokenState - phpInState - (phpInLangIndex<<16));
}
/**
* Adds the token specified to the current linked list of tokens.
*
* @param tokenType The token's type.
*/
private void addToken(int tokenType) {
addToken(zzStartRead, zzMarkedPos-1, tokenType);
}
/**
* Adds the token specified to the current linked list of tokens.
*
* @param tokenType The token's type.
*/
private void addToken(int start, int end, int tokenType) {
int so = start + offsetShift;
addToken(zzBuffer, start,end, tokenType, so);
}
/**
* Adds the token specified to the current linked list of tokens.
*
* @param array The character array.
* @param start The starting offset in the array.
* @param end The ending offset in the array.
* @param tokenType The token's type.
* @param startOffset The offset in the document at which this token
* occurs.
*/
@Override
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
super.addToken(array, start,end, tokenType, startOffset);
zzStartRead = zzMarkedPos;
}
/**
* {@inheritDoc}
*/
@Override
protected OccurrenceMarker createOccurrenceMarker() {
return new HtmlOccurrenceMarker();
}
/**
* Sets whether markup close tags should be completed. You might not want
* this to be the case, since some tags in standard HTML aren't usually
* closed.
*
* @return Whether closing markup tags are completed.
* @see #setCompleteCloseTags(boolean)
*/
@Override
public boolean getCompleteCloseTags() {
return completeCloseTags;
}
@Override
public boolean getCurlyBracesDenoteCodeBlocks(int languageIndex) {
return languageIndex==LANG_INDEX_CSS || languageIndex==LANG_INDEX_JS ||
languageIndex==LANG_INDEX_PHP;
}
/**
* {@inheritDoc}
*/
@Override
public String[] getLineCommentStartAndEnd(int languageIndex) {
switch (languageIndex) {
case LANG_INDEX_JS:
case LANG_INDEX_PHP:
return new String[] { "//", null };
case LANG_INDEX_CSS:
return new String[] { "/*", "*/" };
default:
return new String[] { "" };
}
}
/**
* {@inheritDoc}
*/
@Override
public boolean getMarkOccurrencesOfTokenType(int type) {
return type==Token.FUNCTION || type==Token.VARIABLE ||
type==Token.MARKUP_TAG_NAME;
}
/**
* Overridden to handle newlines in JS and CSS differently than those in
* markup.
*/
@Override
public boolean getShouldIndentNextLineAfter(Token token) {
int languageIndex = token==null ? 0 : token.getLanguageIndex();
if (getCurlyBracesDenoteCodeBlocks(languageIndex)) {
if (token!=null && token.length()==1) {
char ch = token.charAt(0);
return ch=='{' || ch=='(';
}
}
return false;
}
/**
* Returns the first token in the linked list of tokens generated
* from text
. This method must be implemented by
* subclasses so they can correctly implement syntax highlighting.
*
* @param text The text from which to get tokens.
* @param initialTokenType The token type we should start with.
* @param startOffset The offset into the document at which
* text
starts.
* @return The first Token
in a linked list representing
* the syntax highlighted text.
*/
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
resetTokenList();
this.offsetShift = -text.offset + startOffset;
phpInState = YYINITIAL; // Shouldn't be necessary
cssPrevState = CSS; // Shouldn't be necessary
int languageIndex = LANG_INDEX_DEFAULT;
// Start off in the proper state.
int state = Token.NULL;
switch (initialTokenType) {
case Token.MARKUP_COMMENT:
state = COMMENT;
break;
case Token.VARIABLE:
state = DTD;
break;
case INTERNAL_INTAG:
state = INTAG;
break;
case INTERNAL_INTAG_SCRIPT:
state = INTAG_SCRIPT;
break;
case INTERNAL_INTAG_STYLE:
state = INTAG_STYLE;
break;
case INTERNAL_ATTR_DOUBLE:
state = INATTR_DOUBLE;
break;
case INTERNAL_ATTR_SINGLE:
state = INATTR_SINGLE;
break;
case INTERNAL_ATTR_DOUBLE_QUOTE_SCRIPT:
state = INATTR_DOUBLE_SCRIPT;
break;
case INTERNAL_ATTR_SINGLE_QUOTE_SCRIPT:
state = INATTR_SINGLE_SCRIPT;
break;
case INTERNAL_ATTR_DOUBLE_QUOTE_STYLE:
state = INATTR_DOUBLE_STYLE;
break;
case INTERNAL_ATTR_SINGLE_QUOTE_STYLE:
state = INATTR_SINGLE_STYLE;
break;
case INTERNAL_IN_JS:
state = JAVASCRIPT;
languageIndex = LANG_INDEX_JS;
break;
case INTERNAL_IN_JS_MLC:
state = JS_MLC;
languageIndex = LANG_INDEX_JS;
break;
case INTERNAL_IN_JS_STRING_INVALID:
state = JS_STRING;
languageIndex = LANG_INDEX_JS;
validJSString = false;
break;
case INTERNAL_IN_JS_STRING_VALID:
state = JS_STRING;
languageIndex = LANG_INDEX_JS;
validJSString = true;
break;
case INTERNAL_IN_JS_CHAR_INVALID:
state = JS_CHAR;
languageIndex = LANG_INDEX_JS;
validJSString = false;
break;
case INTERNAL_IN_JS_CHAR_VALID:
state = JS_CHAR;
languageIndex = LANG_INDEX_JS;
validJSString = true;
break;
case INTERNAL_CSS:
state = CSS;
languageIndex = LANG_INDEX_CSS;
break;
case INTERNAL_CSS_PROPERTY:
state = CSS_PROPERTY;
languageIndex = LANG_INDEX_CSS;
break;
case INTERNAL_CSS_VALUE:
state = CSS_VALUE;
languageIndex = LANG_INDEX_CSS;
break;
default:
if (initialTokenType<-1024) { // INTERNAL_IN_PHPxxx - phpInState
int main = -(-initialTokenType & 0x0000ff00);
switch (main) {
default: // Should never happen
case INTERNAL_IN_PHP:
state = PHP;
languageIndex = LANG_INDEX_PHP;
phpInState = -initialTokenType&0xff;
phpInLangIndex = (-initialTokenType&0x00ff0000)>>16;
break;
case INTERNAL_IN_PHP_MLC:
state = PHP_MLC;
languageIndex = LANG_INDEX_PHP;
phpInState = -initialTokenType&0xff;
phpInLangIndex = (-initialTokenType&0x00ff0000)>>16;
break;
case INTERNAL_IN_PHP_STRING:
state = PHP_STRING;
languageIndex = LANG_INDEX_PHP;
phpInState = -initialTokenType&0xff;
phpInLangIndex = (-initialTokenType&0x00ff0000)>>16;
break;
case INTERNAL_IN_PHP_CHAR:
state = PHP_CHAR;
languageIndex = LANG_INDEX_PHP;
phpInState = -initialTokenType&0xff;
phpInLangIndex = (-initialTokenType&0x00ff0000)>>16;
break;
case INTERNAL_CSS_STRING:
state = CSS_STRING;
languageIndex = LANG_INDEX_CSS;
cssPrevState = -initialTokenType&0xff;
break;
case INTERNAL_CSS_CHAR:
state = CSS_CHAR_LITERAL;
languageIndex = LANG_INDEX_CSS;
cssPrevState = -initialTokenType&0xff;
break;
case INTERNAL_CSS_MLC:
state = CSS_C_STYLE_COMMENT;
languageIndex = LANG_INDEX_CSS;
cssPrevState = -initialTokenType&0xff;
break;
}
}
else {
state = YYINITIAL;
}
break;
}
setLanguageIndex(languageIndex);
start = text.offset;
s = text;
try {
yyreset(zzReader);
yybegin(state);
return yylex();
} catch (IOException ioe) {
ioe.printStackTrace();
return new TokenImpl();
}
}
/**
* Sets whether markup close tags should be completed. You might not want
* this to be the case, since some tags in standard HTML aren't usually
* closed.
*
* @param complete Whether closing markup tags are completed.
* @see #getCompleteCloseTags()
*/
public static void setCompleteCloseTags(boolean complete) {
completeCloseTags = complete;
}
/**
* Overridden to remember the language index we're leaving.
*/
@Override
protected void yybegin(int state, int languageIndex) {
phpInLangIndex = getLanguageIndex();
yybegin(state);
setLanguageIndex(languageIndex);
}
/**
* Refills the input buffer.
*
* @return true
if EOF was reached, otherwise
* false
.
*/
private boolean zzRefill() {
return zzCurrentPos>=s.offset+s.count;
}
/**
* 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 YY_INITIAL.
*
* @param reader the new input stream
*/
public final void yyreset(Reader reader) {
// 's' has been updated.
zzBuffer = s.array;
/*
* We replaced the line below with the two below it because zzRefill
* no longer "refills" the buffer (since the way we do it, it's always
* "full" the first time through, since it points to the segment's
* array). So, we assign zzEndRead here.
*/
//zzStartRead = zzEndRead = s.offset;
zzStartRead = s.offset;
zzEndRead = zzStartRead + s.count - 1;
zzCurrentPos = zzMarkedPos = s.offset;
zzLexicalState = YYINITIAL;
zzReader = reader;
zzAtEOF = false;
}
/**
* Creates a new scanner
* There is also a java.io.InputStream version of this constructor.
*
* @param in the java.io.Reader to read input from.
*/
public PHPTokenMaker(java.io.Reader in) {
this.zzReader = in;
}
/**
* Creates a new scanner.
* There is also java.io.Reader version of this constructor.
*
* @param in the java.io.Inputstream to read input from.
*/
public PHPTokenMaker(java.io.InputStream in) {
this(new java.io.InputStreamReader(in));
}
/**
* Unpacks the compressed character translation table.
*
* @param packed the packed character translation table
* @return the unpacked character translation table
*/
private static char [] zzUnpackCMap(String packed) {
char [] map = new char[0x10000];
int i = 0; /* index in packed string */
int j = 0; /* index in unpacked array */
while (i < 206) {
int count = packed.charAt(i++);
char value = packed.charAt(i++);
do map[j++] = value; while (--count > 0);
}
return map;
}
/**
* Closes the input stream.
*/
public final void yyclose() throws java.io.IOException {
zzAtEOF = true; /* indicate end of file */
zzEndRead = zzStartRead; /* invalidate buffer */
if (zzReader != null)
zzReader.close();
}
/**
* Returns the current lexical state.
*/
public final int yystate() {
return zzLexicalState;
}
/**
* Enters a new lexical state
*
* @param newState the new lexical state
*/
@Override
public final void yybegin(int newState) {
zzLexicalState = newState;
}
/**
* Returns the text matched by the current regular expression.
*/
public final String yytext() {
return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
}
/**
* 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.
*
* @return the character at position pos
*/
public final char yycharat(int pos) {
return zzBuffer[zzStartRead+pos];
}
/**
* Returns the length of the matched text region.
*/
public final int yylength() {
return zzMarkedPos-zzStartRead;
}
/**
* 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.).
*
* Usual syntax/scanner level error handling should be done
* in error fallback rules.
*
* @param errorCode the code of the errormessage to display
*/
private void zzScanError(int errorCode) {
String message;
try {
message = ZZ_ERROR_MSG[errorCode];
}
catch (ArrayIndexOutOfBoundsException e) {
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
throw new Error(message);
}
/**
* Pushes the specified amount of characters back into the input stream.
*
* 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()!
*/
public void yypushback(int number) {
if ( number > yylength() )
zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos -= number;
}
/**
* 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
*/
public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
char [] zzBufferL = zzBuffer;
char [] zzCMapL = ZZ_CMAP;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = zzLexicalState;
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = zzBufferL[zzCurrentPosL++];
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
}
else {
zzInput = zzBufferL[zzCurrentPosL++];
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 99:
{ int temp=zzStartRead; addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addToken(temp,zzMarkedPos-1, Token.VARIABLE); start = zzMarkedPos;
}
case 122: break;
case 65:
{ addToken(Token.OPERATOR); yybegin(CSS_VALUE);
}
case 123: break;
case 84:
{ addToken(Token.ERROR_NUMBER_FORMAT);
}
case 124: break;
case 73:
{ addToken(start,zzStartRead-1, Token.LITERAL_CHAR); addEndToken(INTERNAL_CSS_CHAR - cssPrevState); return firstToken;
}
case 125: break;
case 23:
{ start = zzMarkedPos-1; yybegin(INATTR_SINGLE_SCRIPT);
}
case 126: break;
case 9:
{ yybegin(YYINITIAL); addToken(start,zzStartRead, Token.MARKUP_DTD);
}
case 127: break;
case 60:
{ addToken(Token.SEPARATOR); yybegin(CSS_PROPERTY);
}
case 128: break;
case 4:
{ addToken(Token.MARKUP_TAG_DELIMITER); yybegin(INTAG);
}
case 129: break;
case 114:
{ addToken(Token.RESERVED_WORD_2);
}
case 130: break;
case 102:
{ addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); yybegin(cssPrevState);
}
case 131: break;
case 100:
{ start = zzMarkedPos-2; cssPrevState = zzLexicalState; yybegin(CSS_C_STYLE_COMMENT);
}
case 132: break;
case 36:
{ /* Line ending in '\' => continue to next line. */
if (validJSString) {
addToken(start,zzStartRead, Token.LITERAL_CHAR);
addEndToken(INTERNAL_IN_JS_CHAR_VALID);
}
else {
addToken(start,zzStartRead, Token.ERROR_CHAR);
addEndToken(INTERNAL_IN_JS_CHAR_INVALID);
}
return firstToken;
}
case 133: break;
case 5:
{ addToken(Token.WHITESPACE);
}
case 134: break;
case 116:
{ addToken(zzStartRead,zzStartRead, Token.MARKUP_TAG_DELIMITER);
addToken(zzMarkedPos-6,zzMarkedPos-1, Token.MARKUP_TAG_NAME);
start = zzMarkedPos; yybegin(INTAG_SCRIPT);
}
case 135: break;
case 101:
{ addToken(Token.REGEX);
}
case 136: break;
case 41:
{ addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addEndToken(INTERNAL_IN_JS_MLC); return firstToken;
}
case 137: break;
case 120:
{ int temp = zzStartRead;
addToken(start,zzStartRead-1, Token.COMMENT_EOL);
yybegin(YYINITIAL, LANG_INDEX_DEFAULT);
addToken(temp,temp+1, Token.MARKUP_TAG_DELIMITER);
addToken(zzMarkedPos-7,zzMarkedPos-2, Token.MARKUP_TAG_NAME);
addToken(zzMarkedPos-1,zzMarkedPos-1, Token.MARKUP_TAG_DELIMITER);
}
case 138: break;
case 96:
{ addToken(Token.FUNCTION);
}
case 139: break;
case 38:
{ addToken(start,zzStartRead-1, Token.ERROR_STRING_DOUBLE); addEndToken(INTERNAL_IN_JS); return firstToken;
}
case 140: break;
case 56:
{ start = zzMarkedPos-1; cssPrevState = zzLexicalState; yybegin(CSS_STRING);
}
case 141: break;
case 25:
{ start = zzMarkedPos-1; yybegin(INATTR_DOUBLE_STYLE);
}
case 142: break;
case 88:
{ /* Skip all escaped chars. */
}
case 143: break;
case 81:
{ addToken(Token.MARKUP_TAG_DELIMITER); yybegin(YYINITIAL);
}
case 144: break;
case 28:
{ yybegin(INTAG_STYLE); addToken(start,zzStartRead, Token.MARKUP_TAG_ATTRIBUTE_VALUE);
}
case 145: break;
case 111:
{ if(JavaScriptTokenMaker.isJavaScriptCompatible("1.6")){ addToken(Token.RESERVED_WORD);} else {addToken(Token.IDENTIFIER);}
}
case 146: break;
case 106:
{ if(JavaScriptTokenMaker.isJavaScriptCompatible("1.7")){ addToken(Token.RESERVED_WORD);} else {addToken(Token.IDENTIFIER);}
}
case 147: break;
case 44:
{ start = zzMarkedPos-1; yybegin(PHP_STRING);
}
case 148: break;
case 66:
{ /*System.out.println("css_value: " + yytext());*/ addToken(Token.IDENTIFIER);
}
case 149: break;
case 91:
{ int temp=zzStartRead; if (zzStartRead>start) addToken(start,zzStartRead-1, validJSString ? Token.LITERAL_STRING_DOUBLE_QUOTE : Token.ERROR_STRING_DOUBLE); validJSString = true; addToken(temp, zzMarkedPos-1, Token.SEPARATOR); phpInState = zzLexicalState; yybegin(PHP, LANG_INDEX_PHP);
}
case 150: break;
case 16:
{ /* A non-recognized HTML tag name */ yypushback(yylength()); yybegin(INTAG);
}
case 151: break;
case 26:
{ addToken(Token.MARKUP_TAG_DELIMITER); yybegin(CSS, LANG_INDEX_CSS);
}
case 152: break;
case 74:
{ addToken(start,zzStartRead, Token.LITERAL_CHAR); yybegin(cssPrevState);
}
case 153: break;
case 87:
{ int temp=zzStartRead; if (zzStartRead>start) addToken(start,zzStartRead-1, validJSString ? Token.LITERAL_CHAR : Token.ERROR_CHAR); validJSString = true; addToken(temp, zzMarkedPos-1, Token.SEPARATOR); phpInState = zzLexicalState; yybegin(PHP, LANG_INDEX_PHP);
}
case 154: break;
case 79:
{ addToken(Token.SEPARATOR); phpInState = zzLexicalState; yybegin(PHP, LANG_INDEX_PHP);
}
case 155: break;
case 27:
{ start = zzMarkedPos-1; yybegin(INATTR_SINGLE_STYLE);
}
case 156: break;
case 19:
{ /* Allowing "" and "start) addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addToken(temp, zzMarkedPos-1, Token.SEPARATOR); phpInState = zzLexicalState; yybegin(PHP, LANG_INDEX_PHP);
}
case 181: break;
case 113:
{ int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos;
}
case 182: break;
case 93:
{ start = zzMarkedPos-2; yybegin(PHP_MLC);
}
case 183: break;
case 52:
{ /* Skip escaped single quotes only, but this should still work. */
}
case 184: break;
case 64:
{ addToken(Token.SEPARATOR); yybegin(CSS);
}
case 185: break;
case 119:
{ yybegin(YYINITIAL);
int temp = zzStartRead;
addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE);
addToken(temp,temp+1, Token.MARKUP_TAG_DELIMITER);
addToken(zzMarkedPos-7,zzMarkedPos-2, Token.MARKUP_TAG_NAME);
addToken(zzMarkedPos-1,zzMarkedPos-1, Token.MARKUP_TAG_DELIMITER);
}
case 186: break;
case 31:
{ start = zzMarkedPos-1; validJSString = true; yybegin(JS_STRING);
}
case 187: break;
case 72:
{ addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); yybegin(cssPrevState);
}
case 188: break;
case 62:
{ addEndToken(INTERNAL_CSS_PROPERTY); return firstToken;
}
case 189: break;
case 43:
{ addPhpEndToken(INTERNAL_IN_PHP); return firstToken;
}
case 190: break;
case 37:
{ int type = validJSString ? Token.LITERAL_CHAR : Token.ERROR_CHAR; addToken(start,zzStartRead, type); yybegin(JAVASCRIPT);
}
case 191: break;
case 97:
{ int count = yylength();
addToken(zzStartRead,zzStartRead, Token.FUNCTION);
zzMarkedPos -= (count-1); //yypushback(count-1);
}
case 192: break;
case 34:
{ start = zzMarkedPos-1; validJSString = true; yybegin(JS_CHAR);
}
case 193: break;
case 24:
{ addToken(start,zzStartRead, Token.MARKUP_TAG_ATTRIBUTE_VALUE); yybegin(INTAG_SCRIPT);
}
case 194: break;
case 83:
{ start = zzMarkedPos-2; yybegin(JS_MLC);
}
case 195: break;
case 86:
{ addToken(Token.LITERAL_NUMBER_HEXADECIMAL);
}
case 196: break;
case 70:
{ int temp = zzMarkedPos - 2;
addToken(zzStartRead, temp, Token.FUNCTION);
addToken(zzMarkedPos-1, zzMarkedPos-1, Token.SEPARATOR);
zzStartRead = zzCurrentPos = zzMarkedPos;
}
case 197: break;
case 48:
{ addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addPhpEndToken(INTERNAL_IN_PHP_STRING); return firstToken;
}
case 198: break;
case 121:
{ addToken(Token.ANNOTATION);
}
case 199: break;
case 98:
{ yybegin(PHP); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE);
}
case 200: break;
case 49:
{ yybegin(PHP); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE);
}
case 201: break;
case 29:
{ addToken(Token.ERROR_IDENTIFIER);
}
case 202: break;
case 67:
{ addEndToken(INTERNAL_CSS_VALUE); return firstToken;
}
case 203: break;
case 108:
{ int temp=zzStartRead; addToken(start,zzStartRead-1, Token.MARKUP_COMMENT); addHyperlinkToken(temp,zzMarkedPos-1, Token.MARKUP_COMMENT); start = zzMarkedPos;
}
case 204: break;
case 6:
{ addToken(Token.MARKUP_ENTITY_REFERENCE);
}
case 205: break;
case 110:
{ addToken(Token.LITERAL_BOOLEAN);
}
case 206: break;
case 17:
{ /* Shouldn't happen */ yypushback(1); yybegin(INTAG);
}
case 207: break;
case 3:
{ addNullToken(); return firstToken;
}
case 208: break;
case 55:
{ addEndToken(INTERNAL_CSS); return firstToken;
}
case 209: break;
case 118:
{ yybegin(YYINITIAL, LANG_INDEX_DEFAULT);
addToken(zzStartRead,zzStartRead+1, Token.MARKUP_TAG_DELIMITER);
addToken(zzMarkedPos-7,zzMarkedPos-2, Token.MARKUP_TAG_NAME);
addToken(zzMarkedPos-1,zzMarkedPos-1, Token.MARKUP_TAG_DELIMITER);
}
case 210: break;
case 59:
{ start = zzMarkedPos-1; cssPrevState = zzLexicalState; yybegin(CSS_CHAR_LITERAL);
}
case 211: break;
case 78:
{ addToken(Token.MARKUP_TAG_DELIMITER); phpInState = zzLexicalState; yybegin(PHP, LANG_INDEX_PHP);
}
case 212: break;
case 63:
{ addToken(Token.RESERVED_WORD);
}
case 213: break;
case 11:
{ start = zzMarkedPos-1; yybegin(INATTR_DOUBLE);
}
case 214: break;
case 45:
{ addToken(Token.COMMENT_EOL); addPhpEndToken(INTERNAL_IN_PHP); return firstToken;
}
case 215: break;
case 13:
{ yybegin(YYINITIAL); addToken(Token.MARKUP_TAG_DELIMITER);
}
case 216: break;
case 57:
{ addToken(Token.DATA_TYPE);
}
case 217: break;
case 51:
{ addToken(start,zzStartRead-1, Token.LITERAL_CHAR); addPhpEndToken(INTERNAL_IN_PHP_CHAR); return firstToken;
}
case 218: break;
case 53:
{ yybegin(PHP); addToken(start,zzStartRead, Token.LITERAL_CHAR);
}
case 219: break;
case 33:
{ addToken(Token.SEPARATOR);
}
case 220: break;
case 103:
{ int count = yylength();
addToken(zzStartRead,zzStartRead+1, Token.MARKUP_TAG_DELIMITER);
zzMarkedPos -= (count-2); //yypushback(count-2);
yybegin(INTAG_CHECK_TAG_NAME);
}
case 221: break;
case 71:
{ addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addEndToken(INTERNAL_CSS_STRING - cssPrevState); return firstToken;
}
case 222: break;
case 69:
{ /* End of a function */ addToken(Token.SEPARATOR);
}
case 223: break;
case 18:
{ addToken(Token.MARKUP_TAG_NAME);
}
case 224: break;
case 10:
{ addToken(Token.MARKUP_TAG_ATTRIBUTE);
}
case 225: break;
case 46:
{ start = zzMarkedPos-1; yybegin(PHP_CHAR);
}
case 226: break;
case 95:
{ yybegin(phpInState, phpInLangIndex); addToken(Token.MARKUP_TAG_DELIMITER); start = zzMarkedPos;
}
case 227: break;
case 82:
{ start = zzMarkedPos-2; yybegin(JS_EOL_COMMENT);
}
case 228: break;
case 40:
{ /* Line ending in '\' => continue to next line. */
if (validJSString) {
addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE);
addEndToken(INTERNAL_IN_JS_STRING_VALID);
}
else {
addToken(start,zzStartRead, Token.ERROR_STRING_DOUBLE);
addEndToken(INTERNAL_IN_JS_STRING_INVALID);
}
return firstToken;
}
case 229: break;
case 85:
{ addToken(Token.LITERAL_NUMBER_FLOAT);
}
case 230: break;
case 15:
{ start = zzMarkedPos-1; yybegin(INATTR_SINGLE);
}
case 231: break;
case 105:
{ boolean highlightedAsRegex = false;
if (firstToken==null) {
addToken(Token.REGEX);
highlightedAsRegex = true;
}
else {
// If this is *likely* to be a regex, based on
// the previous token, highlight it as such.
Token t = firstToken.getLastNonCommentNonWhitespaceToken();
if (RSyntaxUtilities.regexCanFollowInJavaScript(t)) {
addToken(Token.REGEX);
highlightedAsRegex = true;
}
}
// If it doesn't *appear* to be a regex, highlight it as
// individual tokens.
if (!highlightedAsRegex) {
int temp = zzStartRead + 1;
addToken(zzStartRead, zzStartRead, Token.OPERATOR);
zzStartRead = zzCurrentPos = zzMarkedPos = temp;
}
}
case 232: break;
case 75:
{ addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addEndToken(INTERNAL_CSS_MLC - cssPrevState); return firstToken;
}
case 233: break;
case 12:
{ addToken(Token.MARKUP_TAG_DELIMITER);
}
case 234: break;
case 32:
{ addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
}
case 235: break;
case 77:
{ start = zzMarkedPos-2; yybegin(DTD);
}
case 236: break;
case 20:
{ addToken(start,zzStartRead, Token.MARKUP_TAG_ATTRIBUTE_VALUE); yybegin(INTAG);
}
case 237: break;
case 47:
{ addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addPhpEndToken(INTERNAL_IN_PHP_MLC); return firstToken;
}
case 238: break;
case 21:
{ start = zzMarkedPos-1; yybegin(INATTR_DOUBLE_SCRIPT);
}
case 239: break;
case 42:
{ addToken(start,zzStartRead-1, Token.COMMENT_EOL); addEndToken(INTERNAL_IN_JS); return firstToken;
}
case 240: break;
case 58:
{ /* Unknown pseudo class */ addToken(Token.DATA_TYPE);
}
case 241: break;
case 1:
{
}
case 242: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
switch (zzLexicalState) {
case PHP: {
addPhpEndToken(INTERNAL_IN_PHP); return firstToken;
}
case 7963: break;
case INATTR_SINGLE_SCRIPT: {
addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_SINGLE_QUOTE_SCRIPT); return firstToken;
}
case 7964: break;
case JS_CHAR: {
addToken(start,zzStartRead-1, Token.ERROR_CHAR); addEndToken(INTERNAL_IN_JS); return firstToken;
}
case 7965: break;
case CSS_STRING: {
addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addEndToken(INTERNAL_CSS_STRING - cssPrevState); return firstToken;
}
case 7966: break;
case JS_MLC: {
addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addEndToken(INTERNAL_IN_JS_MLC); return firstToken;
}
case 7967: break;
case CSS_CHAR_LITERAL: {
addToken(start,zzStartRead-1, Token.LITERAL_CHAR); addEndToken(INTERNAL_CSS_CHAR - cssPrevState); return firstToken;
}
case 7968: break;
case INTAG_SCRIPT: {
addToken(zzMarkedPos,zzMarkedPos, INTERNAL_INTAG_SCRIPT); return firstToken;
}
case 7969: break;
case CSS_PROPERTY: {
addEndToken(INTERNAL_CSS_PROPERTY); return firstToken;
}
case 7970: break;
case CSS_C_STYLE_COMMENT: {
addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addEndToken(INTERNAL_CSS_MLC - cssPrevState); return firstToken;
}
case 7971: break;
case PHP_MLC: {
addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addPhpEndToken(INTERNAL_IN_PHP_MLC); return firstToken;
}
case 7972: break;
case CSS: {
addEndToken(INTERNAL_CSS); return firstToken;
}
case 7973: break;
case CSS_VALUE: {
addEndToken(INTERNAL_CSS_VALUE); return firstToken;
}
case 7974: break;
case COMMENT: {
addToken(start,zzStartRead-1, Token.MARKUP_COMMENT); return firstToken;
}
case 7975: break;
case INATTR_DOUBLE_SCRIPT: {
addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_DOUBLE_QUOTE_SCRIPT); return firstToken;
}
case 7976: break;
case PHP_STRING: {
addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addPhpEndToken(INTERNAL_IN_PHP_STRING); return firstToken;
}
case 7977: break;
case JAVASCRIPT: {
addEndToken(INTERNAL_IN_JS); return firstToken;
}
case 7978: break;
case INTAG: {
addToken(zzMarkedPos,zzMarkedPos, INTERNAL_INTAG); return firstToken;
}
case 7979: break;
case INTAG_CHECK_TAG_NAME: {
addToken(zzMarkedPos,zzMarkedPos, INTERNAL_INTAG); return firstToken;
}
case 7980: break;
case INATTR_SINGLE_STYLE: {
addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_SINGLE_QUOTE_STYLE); return firstToken;
}
case 7981: break;
case DTD: {
addToken(start,zzStartRead-1, Token.MARKUP_DTD); return firstToken;
}
case 7982: break;
case PHP_CHAR: {
addToken(start,zzStartRead-1, Token.LITERAL_CHAR); addPhpEndToken(INTERNAL_IN_PHP_CHAR); return firstToken;
}
case 7983: break;
case JS_EOL_COMMENT: {
addToken(start,zzStartRead-1, Token.COMMENT_EOL); addEndToken(INTERNAL_IN_JS); return firstToken;
}
case 7984: break;
case INATTR_DOUBLE_STYLE: {
addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_DOUBLE_QUOTE_STYLE); return firstToken;
}
case 7985: break;
case INATTR_SINGLE: {
addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_SINGLE); return firstToken;
}
case 7986: break;
case YYINITIAL: {
addNullToken(); return firstToken;
}
case 7987: break;
case INATTR_DOUBLE: {
addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_DOUBLE); return firstToken;
}
case 7988: break;
case JS_STRING: {
addToken(start,zzStartRead-1, Token.ERROR_STRING_DOUBLE); addEndToken(INTERNAL_IN_JS); return firstToken;
}
case 7989: break;
case INTAG_STYLE: {
addToken(zzMarkedPos,zzMarkedPos, INTERNAL_INTAG_STYLE); return firstToken;
}
case 7990: break;
default:
return null;
}
}
else {
zzScanError(ZZ_NO_MATCH);
}
}
}
}
}