org.fife.ui.rsyntaxtextarea.modes.HTMLTokenMaker Maven / Gradle / Ivy
The newest version!
/* The following code was generated by JFlex 1.4.1 on 1/22/14 11:11 PM */ /* * 01/24/2005 * * HTMLTokenMaker.java - Generates tokens for HTML 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 HTML 5 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 HTMLTokenMaker.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 =
"\6\0\2\1\1\0\2\1\1\0\2\1\7\0\1\1"+
"\3\0\2\1\1\11\4\1\1\11\5\1\1\11\2\1"+
"\2\11\2\1\1\11\1\1\3\11\1\1\1\11\25\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\20\1\1\11\3\1"+
"\2\11\2\1\1\11\1\1\1\11\1\1\1\11\6\1"+
"\1\11\1\1\2\11\1\1\1\11\5\1\4\11\4\1"+
"\4\11\1\1\1\11\6\1\4\11\1\1\2\11\1\1"+
"\1\11\10\1\2\11\5\0\1\11\103\1\1\11\3\0"+
"\1\11\1\0\75\1\1\11\2\1\1\0\1\11\6\0"+
"\1\11\1\1\15\0\1\1\1\11\5\0\1\1\1\0"+
"\2\11\4\0\3\1\1\0\1\11\4\0\100\1\1\0"+
"\1\1\1\0\3\1\1\0\70\1\41\0\2\1\1\11"+
"\2\0\44\1\1\0\1\11\46\1\1\0\1\11\3\0"+
"\1\1\7\0\1\11\17\0\3\1\2\0\24\1\1\0"+
"\30\1\24\0\14\1\1\0\21\1\14\0\4\1\1\0"+
"\10\1\10\0\1\1\1\0\3\1\2\0\1\11\4\0"+
"\1\1\1\11\1\1\2\11\6\0\1\11";
private static int [] zzUnpackAttribute() {
int [] result = new int[805];
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 XMLTokenMaker denoting a line ending with an unclosed
* double-quote attribute.
*/
public static final int INTERNAL_ATTR_DOUBLE = -1;
/**
* Type specific to XMLTokenMaker denoting a line ending with an unclosed
* single-quote attribute.
*/
public static final int INTERNAL_ATTR_SINGLE = -2;
/**
* Token type specific to HTMLTokenMaker; 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.
*/
public static final int INTERNAL_INTAG = -3;
/**
* Token type specific to HTMLTokenMaker; this signals that the user has
* ended a line with an unclosed <script>
tag.
*/
public static final int INTERNAL_INTAG_SCRIPT = -4;
/**
* Token type specifying we're in a double-qouted attribute in a
* script tag.
*/
public static final int INTERNAL_ATTR_DOUBLE_QUOTE_SCRIPT = -5;
/**
* Token type specifying we're in a single-qouted attribute in a
* script tag.
*/
public static final int INTERNAL_ATTR_SINGLE_QUOTE_SCRIPT = -6;
/**
* Token type specific to HTMLTokenMaker; this signals that the user has
* ended a line with an unclosed <style>
tag.
*/
public static final int INTERNAL_INTAG_STYLE = -7;
/**
* Token type specifying we're in a double-qouted attribute in a
* style tag.
*/
public static final int INTERNAL_ATTR_DOUBLE_QUOTE_STYLE = -8;
/**
* Token type specifying we're in a single-qouted attribute in a
* style tag.
*/
public static final int INTERNAL_ATTR_SINGLE_QUOTE_STYLE = -9;
/**
* Token type specifying we're in JavaScript.
*/
public static final int INTERNAL_IN_JS = -10;
/**
* Token type specifying we're in a JavaScript multiline comment.
*/
public static final int INTERNAL_IN_JS_MLC = -11;
/**
* Token type specifying we're in an invalid multi-line JS string.
*/
public static final int INTERNAL_IN_JS_STRING_INVALID = -12;
/**
* Token type specifying we're in a valid multi-line JS string.
*/
public static final int INTERNAL_IN_JS_STRING_VALID = -13;
/**
* Token type specifying we're in an invalid multi-line JS single-quoted string.
*/
public static final int INTERNAL_IN_JS_CHAR_INVALID = -14;
/**
* Token type specifying we're in a valid multi-line JS single-quoted string.
*/
public static final int INTERNAL_IN_JS_CHAR_VALID = -15;
/**
* Internal type denoting a line ending in CSS.
*/
public static final int INTERNAL_CSS = -16;
/**
* Internal type denoting a line ending in a CSS property.
*/
public static final int INTERNAL_CSS_PROPERTY = -17;
/**
* Internal type denoting a line ending in a CSS property value.
*/
public 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.
*/
public 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.
*/
public 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.
*/
public static final int INTERNAL_CSS_MLC = -(3<<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 HTML.
*/
private static boolean completeCloseTags;
/**
* 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;
/**
* Constructor. This must be here because JFlex does not generate a
* no-parameter constructor.
*/
public HTMLTokenMaker() {
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 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;
}
/**
* {@inheritDoc}
*/
@Override
public String[] getLineCommentStartAndEnd(int languageIndex) {
switch (languageIndex) {
case LANG_INDEX_JS:
return new String[] { "//", null };
case LANG_INDEX_CSS:
return new String[] { "/*", "*/" };
default:
return new String[] { "" };
}
}
/**
* Returns Token.MARKUP_TAG_NAME
.
*
* @param type The token type.
* @return Whether tokens of this type should have "mark occurrences"
* enabled.
*/
@Override
public boolean getMarkOccurrencesOfTokenType(int type) {
return 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;
cssPrevState = CSS; // Shouldn't be necessary
int languageIndex = 0;
// Start off in the proper state.
int state = Token.NULL;
switch (initialTokenType) {
case Token.MARKUP_COMMENT:
state = COMMENT;
break;
case Token.PREPROCESSOR:
state = PI;
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;
validJSString = false;
languageIndex = LANG_INDEX_JS;
break;
case INTERNAL_IN_JS_STRING_VALID:
state = JS_STRING;
validJSString = true;
languageIndex = LANG_INDEX_JS;
break;
case INTERNAL_IN_JS_CHAR_INVALID:
state = JS_CHAR;
validJSString = false;
languageIndex = LANG_INDEX_JS;
break;
case INTERNAL_IN_JS_CHAR_VALID:
state = JS_CHAR;
validJSString = true;
languageIndex = LANG_INDEX_JS;
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) {
int main = -(-initialTokenType & 0xffffff00);
switch (main) {
default: // Should never happen
case INTERNAL_CSS_STRING:
state = CSS_STRING;
break;
case INTERNAL_CSS_CHAR:
state = CSS_CHAR_LITERAL;
break;
case INTERNAL_CSS_MLC:
state = CSS_C_STYLE_COMMENT;
break;
}
cssPrevState = -initialTokenType&0xff;
languageIndex = LANG_INDEX_CSS;
}
else {
state = Token.NULL;
}
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;
}
/**
* 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(java.io.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 HTMLTokenMaker(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 HTMLTokenMaker(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 < 194) {
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 54:
{ addToken(Token.OPERATOR); yybegin(CSS_VALUE);
}
case 104: break;
case 73:
{ addToken(Token.ERROR_NUMBER_FORMAT);
}
case 105: break;
case 63:
{ addToken(start,zzStartRead-1, Token.LITERAL_CHAR); addEndToken(INTERNAL_CSS_CHAR - cssPrevState); return firstToken;
}
case 106: break;
case 23:
{ start = zzMarkedPos-1; yybegin(INATTR_SINGLE_SCRIPT);
}
case 107: break;
case 10:
{ yybegin(YYINITIAL); addToken(start,zzStartRead, Token.MARKUP_DTD);
}
case 108: break;
case 49:
{ addToken(Token.SEPARATOR); yybegin(CSS_PROPERTY);
}
case 109: break;
case 4:
{ addToken(Token.MARKUP_TAG_DELIMITER); yybegin(INTAG);
}
case 110: break;
case 97:
{ addToken(Token.RESERVED_WORD_2);
}
case 111: break;
case 83:
{ addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); yybegin(cssPrevState);
}
case 112: break;
case 80:
{ start = zzMarkedPos-2; cssPrevState = zzLexicalState; yybegin(CSS_C_STYLE_COMMENT);
}
case 113: break;
case 39:
{ /* 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 114: break;
case 5:
{ addToken(Token.WHITESPACE);
}
case 115: break;
case 98:
{ addToken(zzStartRead,zzStartRead, Token.MARKUP_TAG_DELIMITER);
addToken(zzMarkedPos-6,zzMarkedPos-1, Token.MARKUP_TAG_NAME);
start = zzMarkedPos; yybegin(INTAG_SCRIPT);
}
case 116: break;
case 82:
{ addToken(Token.REGEX);
}
case 117: break;
case 41:
{ addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addEndToken(INTERNAL_IN_JS_MLC); return firstToken;
}
case 118: break;
case 102:
{ 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 119: break;
case 93:
{ addToken(Token.FUNCTION);
}
case 120: break;
case 8:
{ addToken(start,zzStartRead-1, Token.MARKUP_PROCESSING_INSTRUCTION); return firstToken;
}
case 121: break;
case 35:
{ addToken(start,zzStartRead-1, Token.ERROR_STRING_DOUBLE); addEndToken(INTERNAL_IN_JS); return firstToken;
}
case 122: break;
case 45:
{ start = zzMarkedPos-1; cssPrevState = zzLexicalState; yybegin(CSS_STRING);
}
case 123: break;
case 20:
{ yybegin(INTAG); addToken(start,zzStartRead, Token.MARKUP_TAG_ATTRIBUTE_VALUE);
}
case 124: break;
case 25:
{ start = zzMarkedPos-1; yybegin(INATTR_DOUBLE_STYLE);
}
case 125: break;
case 76:
{ /* Skip all escaped chars. */
}
case 126: break;
case 70:
{ addToken(Token.MARKUP_TAG_DELIMITER); yybegin(YYINITIAL);
}
case 127: break;
case 28:
{ yybegin(INTAG_STYLE); addToken(start,zzStartRead, Token.MARKUP_TAG_ATTRIBUTE_VALUE);
}
case 128: break;
case 92:
{ if(JavaScriptTokenMaker.isJavaScriptCompatible("1.6")){ addToken(Token.RESERVED_WORD);} else {addToken(Token.IDENTIFIER);}
}
case 129: break;
case 87:
{ if(JavaScriptTokenMaker.isJavaScriptCompatible("1.7")){ addToken(Token.RESERVED_WORD);} else {addToken(Token.IDENTIFIER);}
}
case 130: break;
case 55:
{ /*System.out.println("css_value: " + yytext());*/ addToken(Token.IDENTIFIER);
}
case 131: break;
case 17:
{ /* A non-recognized HTML tag name */ yypushback(yylength()); yybegin(INTAG);
}
case 132: break;
case 26:
{ addToken(Token.MARKUP_TAG_DELIMITER); yybegin(CSS, LANG_INDEX_CSS);
}
case 133: break;
case 64:
{ addToken(start,zzStartRead, Token.LITERAL_CHAR); yybegin(cssPrevState);
}
case 134: break;
case 27:
{ start = zzMarkedPos-1; yybegin(INATTR_SINGLE_STYLE);
}
case 135: break;
case 7:
{ addToken(start,zzStartRead-1, Token.MARKUP_COMMENT); return firstToken;
}
case 136: break;
case 78:
{ /* Invalid latin-1 character \xXX */ validJSString = false;
}
case 137: break;
case 24:
{ yybegin(INTAG_SCRIPT); addToken(start,zzStartRead, Token.MARKUP_TAG_ATTRIBUTE_VALUE);
}
case 138: break;
case 36:
{ int type = validJSString ? Token.LITERAL_STRING_DOUBLE_QUOTE : Token.ERROR_STRING_DOUBLE; addToken(start,zzStartRead, type); yybegin(JAVASCRIPT);
}
case 139: break;
case 90:
{ addToken(Token.COMMENT_MULTILINE);
}
case 140: break;
case 68:
{ start = zzMarkedPos-2; yybegin(PI);
}
case 141: break;
case 99:
{ yybegin(YYINITIAL, LANG_INDEX_DEFAULT);
addToken(zzStartRead,zzStartRead+1, Token.MARKUP_TAG_DELIMITER);
addToken(zzMarkedPos-6,zzMarkedPos-2, Token.MARKUP_TAG_NAME);
addToken(zzMarkedPos-1,zzMarkedPos-1, Token.MARKUP_TAG_DELIMITER);
}
case 142: break;
case 50:
{ /*System.out.println("css_property: " + yytext());*/ addToken(Token.IDENTIFIER);
}
case 143: break;
case 9:
{ addToken(start,zzStartRead-1, Token.MARKUP_DTD); return firstToken;
}
case 144: break;
case 66:
{ int count = yylength();
addToken(zzStartRead,zzStartRead, Token.MARKUP_TAG_DELIMITER);
zzMarkedPos -= (count-1); //yypushback(count-1);
yybegin(INTAG_CHECK_TAG_NAME);
}
case 145: break;
case 62:
{ /* Skip escaped chars. */
}
case 146: break;
case 77:
{ /* Invalid Unicode character \\uXXXX */ validJSString = false;
}
case 147: break;
case 96:
{ addToken(zzStartRead,zzStartRead, Token.MARKUP_TAG_DELIMITER);
addToken(zzMarkedPos-5,zzMarkedPos-1, Token.MARKUP_TAG_NAME);
start = zzMarkedPos; cssPrevState = zzLexicalState; yybegin(INTAG_STYLE);
}
case 148: break;
case 69:
{ yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.MARKUP_PROCESSING_INSTRUCTION);
}
case 149: break;
case 79:
{ yybegin(JAVASCRIPT); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE);
}
case 150: break;
case 30:
{ addEndToken(INTERNAL_IN_JS); return firstToken;
}
case 151: break;
case 38:
{ addToken(start,zzStartRead-1, Token.ERROR_CHAR); addEndToken(INTERNAL_IN_JS); return firstToken;
}
case 152: break;
case 15:
{ addToken(Token.OPERATOR);
}
case 153: break;
case 57:
{ addToken(Token.OPERATOR); yybegin(CSS_PROPERTY);
}
case 154: break;
case 88:
{ start = zzMarkedPos-4; yybegin(COMMENT);
}
case 155: break;
case 85:
{ yybegin(YYINITIAL); addToken(start,zzStartRead+2, Token.MARKUP_COMMENT);
}
case 156: break;
case 101:
{ yybegin(YYINITIAL, LANG_INDEX_DEFAULT);
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 157: break;
case 81:
{ addToken(Token.VARIABLE);
}
case 158: break;
case 43:
{ /*System.out.println("CSS: " + yytext());*/ addToken(Token.IDENTIFIER);
}
case 159: break;
case 2:
{ addToken(Token.IDENTIFIER);
}
case 160: break;
case 95:
{ int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos;
}
case 161: break;
case 22:
{ addToken(Token.MARKUP_TAG_DELIMITER); yybegin(JAVASCRIPT, LANG_INDEX_JS);
}
case 162: break;
case 94:
{ int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos;
}
case 163: break;
case 53:
{ addToken(Token.SEPARATOR); yybegin(CSS);
}
case 164: break;
case 31:
{ start = zzMarkedPos-1; validJSString = true; yybegin(JS_STRING);
}
case 165: break;
case 61:
{ addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); yybegin(cssPrevState);
}
case 166: break;
case 51:
{ addEndToken(INTERNAL_CSS_PROPERTY); return firstToken;
}
case 167: break;
case 40:
{ int type = validJSString ? Token.LITERAL_CHAR : Token.ERROR_CHAR; addToken(start,zzStartRead, type); yybegin(JAVASCRIPT);
}
case 168: break;
case 34:
{ start = zzMarkedPos-1; validJSString = true; yybegin(JS_CHAR);
}
case 169: break;
case 72:
{ start = zzMarkedPos-2; yybegin(JS_MLC);
}
case 170: break;
case 75:
{ addToken(Token.LITERAL_NUMBER_HEXADECIMAL);
}
case 171: break;
case 59:
{ int temp = zzMarkedPos - 2;
addToken(zzStartRead, temp, Token.FUNCTION);
addToken(zzMarkedPos-1, zzMarkedPos-1, Token.SEPARATOR);
zzStartRead = zzCurrentPos = zzMarkedPos;
}
case 172: break;
case 103:
{ addToken(Token.ANNOTATION);
}
case 173: break;
case 29:
{ addToken(Token.ERROR_IDENTIFIER);
}
case 174: break;
case 56:
{ addEndToken(INTERNAL_CSS_VALUE); return firstToken;
}
case 175: break;
case 89:
{ int temp=zzStartRead; addToken(start,zzStartRead-1, Token.MARKUP_COMMENT); addHyperlinkToken(temp,zzMarkedPos-1, Token.MARKUP_COMMENT); start = zzMarkedPos;
}
case 176: break;
case 6:
{ addToken(Token.MARKUP_ENTITY_REFERENCE);
}
case 177: break;
case 91:
{ addToken(Token.LITERAL_BOOLEAN);
}
case 178: break;
case 18:
{ /* Shouldn't happen */ yypushback(1); yybegin(INTAG);
}
case 179: break;
case 3:
{ addNullToken(); return firstToken;
}
case 180: break;
case 44:
{ addEndToken(INTERNAL_CSS); return firstToken;
}
case 181: break;
case 100:
{ 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 182: break;
case 48:
{ start = zzMarkedPos-1; cssPrevState = zzLexicalState; yybegin(CSS_CHAR_LITERAL);
}
case 183: break;
case 52:
{ addToken(Token.RESERVED_WORD);
}
case 184: break;
case 12:
{ start = zzMarkedPos-1; yybegin(INATTR_DOUBLE);
}
case 185: break;
case 14:
{ yybegin(YYINITIAL); addToken(Token.MARKUP_TAG_DELIMITER);
}
case 186: break;
case 46:
{ addToken(Token.DATA_TYPE);
}
case 187: break;
case 33:
{ addToken(Token.SEPARATOR);
}
case 188: break;
case 84:
{ int count = yylength();
addToken(zzStartRead,zzStartRead+1, Token.MARKUP_TAG_DELIMITER);
zzMarkedPos -= (count-2); //yypushback(count-2);
yybegin(INTAG_CHECK_TAG_NAME);
}
case 189: break;
case 60:
{ addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addEndToken(INTERNAL_CSS_STRING - cssPrevState); return firstToken;
}
case 190: break;
case 58:
{ /* End of a function */ addToken(Token.SEPARATOR);
}
case 191: break;
case 19:
{ addToken(Token.MARKUP_TAG_NAME);
}
case 192: break;
case 11:
{ addToken(Token.MARKUP_TAG_ATTRIBUTE);
}
case 193: break;
case 71:
{ start = zzMarkedPos-2; yybegin(JS_EOL_COMMENT);
}
case 194: break;
case 37:
{ /* 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 195: break;
case 74:
{ addToken(Token.LITERAL_NUMBER_FLOAT);
}
case 196: break;
case 16:
{ start = zzMarkedPos-1; yybegin(INATTR_SINGLE);
}
case 197: break;
case 86:
{ 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 198: break;
case 13:
{ addToken(Token.MARKUP_TAG_DELIMITER);
}
case 199: break;
case 65:
{ addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addEndToken(INTERNAL_CSS_MLC - cssPrevState); return firstToken;
}
case 200: break;
case 32:
{ addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
}
case 201: break;
case 67:
{ start = zzMarkedPos-2; yybegin(DTD);
}
case 202: break;
case 21:
{ start = zzMarkedPos-1; yybegin(INATTR_DOUBLE_SCRIPT);
}
case 203: break;
case 42:
{ addToken(start,zzStartRead-1, Token.COMMENT_EOL); addEndToken(INTERNAL_IN_JS); return firstToken;
}
case 204: break;
case 47:
{ /* Unknown pseudo class */ addToken(Token.DATA_TYPE);
}
case 205: break;
case 1:
{
}
case 206: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
switch (zzLexicalState) {
case INATTR_SINGLE_SCRIPT: {
addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_SINGLE_QUOTE_SCRIPT); return firstToken;
}
case 806: break;
case JS_CHAR: {
addToken(start,zzStartRead-1, Token.ERROR_CHAR); addEndToken(INTERNAL_IN_JS); return firstToken;
}
case 807: break;
case CSS_STRING: {
addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addEndToken(INTERNAL_CSS_STRING - cssPrevState); return firstToken;
}
case 808: break;
case JS_MLC: {
addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addEndToken(INTERNAL_IN_JS_MLC); return firstToken;
}
case 809: break;
case CSS_CHAR_LITERAL: {
addToken(start,zzStartRead-1, Token.LITERAL_CHAR); addEndToken(INTERNAL_CSS_CHAR - cssPrevState); return firstToken;
}
case 810: break;
case INTAG_SCRIPT: {
addToken(zzMarkedPos,zzMarkedPos, INTERNAL_INTAG_SCRIPT); return firstToken;
}
case 811: break;
case CSS_PROPERTY: {
addEndToken(INTERNAL_CSS_PROPERTY); return firstToken;
}
case 812: break;
case CSS_C_STYLE_COMMENT: {
addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addEndToken(INTERNAL_CSS_MLC - cssPrevState); return firstToken;
}
case 813: break;
case CSS: {
addEndToken(INTERNAL_CSS); return firstToken;
}
case 814: break;
case CSS_VALUE: {
addEndToken(INTERNAL_CSS_VALUE); return firstToken;
}
case 815: break;
case COMMENT: {
addToken(start,zzStartRead-1, Token.MARKUP_COMMENT); return firstToken;
}
case 816: break;
case INATTR_DOUBLE_SCRIPT: {
addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_DOUBLE_QUOTE_SCRIPT); return firstToken;
}
case 817: break;
case PI: {
addToken(start,zzStartRead-1, Token.MARKUP_PROCESSING_INSTRUCTION); return firstToken;
}
case 818: break;
case JAVASCRIPT: {
addEndToken(INTERNAL_IN_JS); return firstToken;
}
case 819: break;
case INTAG: {
addToken(zzMarkedPos,zzMarkedPos, INTERNAL_INTAG); return firstToken;
}
case 820: break;
case INTAG_CHECK_TAG_NAME: {
addToken(zzMarkedPos,zzMarkedPos, INTERNAL_INTAG); return firstToken;
}
case 821: break;
case INATTR_SINGLE_STYLE: {
addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_SINGLE_QUOTE_STYLE); return firstToken;
}
case 822: break;
case DTD: {
addToken(start,zzStartRead-1, Token.MARKUP_DTD); return firstToken;
}
case 823: break;
case JS_EOL_COMMENT: {
addToken(start,zzStartRead-1, Token.COMMENT_EOL); addEndToken(INTERNAL_IN_JS); return firstToken;
}
case 824: break;
case INATTR_DOUBLE_STYLE: {
addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_DOUBLE_QUOTE_STYLE); return firstToken;
}
case 825: break;
case INATTR_SINGLE: {
addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_SINGLE); return firstToken;
}
case 826: break;
case YYINITIAL: {
addNullToken(); return firstToken;
}
case 827: break;
case INATTR_DOUBLE: {
addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_DOUBLE); return firstToken;
}
case 828: break;
case JS_STRING: {
addToken(start,zzStartRead-1, Token.ERROR_STRING_DOUBLE); addEndToken(INTERNAL_IN_JS); return firstToken;
}
case 829: break;
case INTAG_STYLE: {
addToken(zzMarkedPos,zzMarkedPos, INTERNAL_INTAG_STYLE); return firstToken;
}
case 830: break;
default:
return null;
}
}
else {
zzScanError(ZZ_NO_MATCH);
}
}
}
}
}