- } else if (ch == '#') {
- styler.ColourTo(i - 1, state);
- state = SCE_PL_COMMENTLINE;
- } else if (ch == '\"') {
- styler.ColourTo(i - 1, state);
- state = SCE_PL_STRING;
- Quote.New(1);
- Quote.Open(ch);
- } else if (ch == '\'') {
- if (chPrev == '&') {
- // Archaic call
- styler.ColourTo(i, state);
- } else {
- styler.ColourTo(i - 1, state);
- state = SCE_PL_CHARACTER;
- Quote.New(1);
- Quote.Open(ch);
- }
- } else if (ch == '`') {
- styler.ColourTo(i - 1, state);
- state = SCE_PL_BACKTICKS;
- Quote.New(1);
- Quote.Open(ch);
- } else if (ch == '$') {
- preferRE = false;
- styler.ColourTo(i - 1, state);
- if ((chNext == '{') || isspacechar(chNext)) {
- styler.ColourTo(i, SCE_PL_SCALAR);
- } else {
- state = SCE_PL_SCALAR;
- i++;
- ch = chNext;
- chNext = chNext2;
- }
- } else if (ch == '@') {
- preferRE = false;
- styler.ColourTo(i - 1, state);
- if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
- state = SCE_PL_ARRAY;
- } else if (chNext != '{' && chNext != '[') {
- styler.ColourTo(i, SCE_PL_ARRAY);
- i++;
- ch = ' ';
- } else {
- styler.ColourTo(i, SCE_PL_ARRAY);
- }
- } else if (ch == '%') {
- preferRE = false;
- styler.ColourTo(i - 1, state);
- if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
- state = SCE_PL_HASH;
- } else if (chNext == '{') {
- styler.ColourTo(i, SCE_PL_HASH);
- } else {
- styler.ColourTo(i, SCE_PL_OPERATOR);
- }
- } else if (ch == '*') {
- styler.ColourTo(i - 1, state);
- state = SCE_PL_SYMBOLTABLE;
- } else if (ch == '/' && preferRE) {
- styler.ColourTo(i - 1, state);
- state = SCE_PL_REGEX;
- Quote.New(1);
- Quote.Open(ch);
- } else if (ch == '<' && chNext == '<') {
- styler.ColourTo(i - 1, state);
- state = SCE_PL_HERE_DELIM;
- HereDoc.State = 0;
- } else if (ch == '='
- && isalpha(chNext)
- && (isEOLChar(chPrev))) {
- styler.ColourTo(i - 1, state);
- state = SCE_PL_POD;
- sookedpos = 0;
- sooked[sookedpos] = '\0';
- } else if (ch == '-'
- && isSingleCharOp(chNext)
- && !isalnum((chNext2 = styler.SafeGetCharAt(i+2)))) {
- styler.ColourTo(i - 1, state);
- styler.ColourTo(i + 1, SCE_PL_WORD);
- state = SCE_PL_DEFAULT;
- preferRE = false;
- i += 2;
- ch = chNext2;
- chNext = chNext2 = styler.SafeGetCharAt(i + 1);
- } else if (isPerlOperator(ch)) {
- if (ch == ')' || ch == ']')
- preferRE = false;
- else
- preferRE = true;
- styler.ColourTo(i - 1, state);
- styler.ColourTo(i, SCE_PL_OPERATOR);
- }
- } else if (state == SCE_PL_WORD) {
- if ((!iswordchar(chNext) && chNext != '\'')
- || (chNext == '.' && chNext2 == '.')) {
- // ".." is always an operator if preceded by a SCE_PL_WORD.
- // Archaic Perl has quotes inside names
- if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "__DATA__")) {
- styler.ColourTo(i, SCE_PL_DATASECTION);
- state = SCE_PL_DATASECTION;
- } else if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "__END__")) {
- styler.ColourTo(i, SCE_PL_DATASECTION);
- state = SCE_PL_DATASECTION;
- } else {
- if (classifyWordPerl(styler.GetStartSegment(), i, keywords, styler) == SCE_PL_WORD)
- preferRE = true;
- state = SCE_PL_DEFAULT;
- ch = ' ';
- }
- }
- } else {
- if (state == SCE_PL_COMMENTLINE) {
- if (isEOLChar(ch)) {
- styler.ColourTo(i - 1, state);
- state = SCE_PL_DEFAULT;