const JString& GMessageHeader::GetBaseSubject() { if (itsHasBaseSubject) { return itsBaseSubject; } itsHasBaseSubject = kJTrue; itsBaseSubject = GetSubject(); kFixSubjectRegex.SetCaseSensitive(kJFalse); JArray<JIndexRange> subList; while (kFixSubjectRegex.Match(itsBaseSubject, &subList)) { itsBaseSubject = itsBaseSubject.GetSubstring(subList.GetElement(subList.GetElementCount())); itsBaseSubject.TrimWhitespace(); subList.RemoveAll(); } const JSize length = itsBaseSubject.GetLength(); JIndex findex = 1; while (findex <= length && !isalnum(itsBaseSubject.GetCharacter(findex))) { findex++; } if (findex > 1 && findex <= length) { itsBaseSubject = itsBaseSubject.GetSubstring(findex, length); } return itsBaseSubject; }
void GDBPlot2DCommand::HandleSuccess ( const JString& data ) { JArray<JFloat>* x = GetX(); JArray<JFloat>* y = GetY(); if ((GetLastResult()).BeginsWith("error,msg=\"No symbol")) { x->RemoveAll(); y->RemoveAll(); return; } const JIndex count = x->GetElementCount(); JIndex i; JIndexRange r; JArray<JIndexRange> matchRange1, matchRange2; JString v1, v2; for (i=1; i<=count; i++) { if (!prefixPattern.MatchAfter(data, r, &matchRange1)) { break; } r = matchRange1.GetElement(1); if (!prefixPattern.MatchAfter(data, r, &matchRange2)) { break; } r = matchRange2.GetElement(1); v1 = data.GetSubstring(matchRange1.GetElement(2)); v1.TrimWhitespace(); v2 = data.GetSubstring(matchRange2.GetElement(2)); v2.TrimWhitespace(); JFloat x1, y1; if (!v1.ConvertToFloat(&x1) || !v2.ConvertToFloat(&y1)) { break; } x->SetElement(i, x1); y->SetElement(i, y1); } if (i <= count) { const JSize delta = count - (i-1); x->RemoveNextElements(count - delta + 1, delta); y->RemoveNextElements(count - delta + 1, delta); } }
JBoolean CBSearchTextDialog::BuildSearchFileList ( JPtrArray<JString>* fileList, JPtrArray<JString>* nameList ) const { (JXGetApplication())->DisplayBusyCursor(); fileList->SetCleanUpAction(JPtrArrayT::kDeleteAll); fileList->SetCompareFunction(JCompareStringsCaseSensitive); nameList->SetCleanUpAction(JPtrArrayT::kDeleteAll); nameList->SetCompareFunction(JCompareStringsCaseSensitive); if (itsMultifileCB->IsChecked()) { const JPtrArray<JString>& fullNameList = itsFileList->GetFullNameList(); const JSize count = fullNameList.GetElementCount(); for (JIndex i=1; i<=count; i++) { SaveFileForSearch(*(fullNameList.NthElement(i)), fileList, nameList); } } JBoolean ok = kJTrue; JString path, fileFilter, pathFilter; if (GetSearchDirectory(&path, &fileFilter, &pathFilter)) { JRegex* fileRegex = NULL; JString regexStr; if (JDirInfo::BuildRegexFromWildcardFilter(fileFilter, ®exStr)) { fileRegex = jnew JRegex(regexStr); assert( fileRegex != NULL ); fileRegex->SetCaseSensitive(kJFalse); } JRegex* pathRegex = NULL; if (JDirInfo::BuildRegexFromWildcardFilter(pathFilter, ®exStr)) { pathRegex = jnew JRegex(regexStr); assert( pathRegex != NULL ); pathRegex->SetCaseSensitive(kJFalse); } JLatentPG pg(100); pg.VariableLengthProcessBeginning("Collecting files...", kJTrue, kJFalse); ok = SearchDirectory(path, fileRegex, pathRegex, fileList, nameList, pg); pg.ProcessFinished(); jdelete fileRegex; jdelete pathRegex; } return JI2B( ok && !fileList->IsEmpty() ); }
void CBTCLStyler::StyleEmbeddedVariables ( const Token& token ) { emptyVariablePattern.SetSingleLine(); variablePattern.SetSingleLine(); const JString& text = GetText(); JFontStyle varStyle = GetTypeStyle(token.type - kWhitespace); varStyle.underlineCount++; if (varStyle == GetTypeStyle(kVariable - kWhitespace)) { varStyle.underlineCount++; } JFontStyle errStyle = GetTypeStyle(kError - kWhitespace); errStyle.underlineCount++; if (errStyle == GetTypeStyle(kVariable - kWhitespace)) { errStyle.underlineCount++; } JIndexRange r = token.range, r1, r2; while (!r.IsEmpty()) { const JCharacter c = text.GetCharacter(r.first); if (c == '\\') { r.first++; } else if (c == '$') { r1 = r - (r.first-1); if (emptyVariablePattern.MatchWithin(text.GetCString() + r.first-1, r1, &r2)) { r2 += r.first-1; AdjustStyle(r2, errStyle); r.first = r2.last; } else if (variablePattern.MatchWithin(text.GetCString() + r.first-1, r1, &r2)) { r2 += r.first-1; AdjustStyle(r2, varStyle); r.first = r2.last; } } r.first++; } }
JBoolean CBCStyler::SlurpPPComment ( JIndexRange* totalRange ) { const JString& text = GetText(); const JString s = text.GetSubstring((GetPPNameRange()).first, totalRange->last); if (!ppCommentPattern.Match(s)) { return kJFalse; } Token token; JString ppCmd; JSize nestCount = 1; while (1) { token = NextToken(); if (token.type == kEOF) { break; } else if (token.type == kPPDirective) { ppCmd = text.GetSubstring(GetPPNameRange()); if (ppIfPattern.Match(ppCmd)) { nestCount++; } else if (ppEndPattern.Match(ppCmd)) { nestCount--; if (nestCount == 0) { break; } } else if (ppElsePattern.Match(ppCmd) && nestCount == 1) { Undo(token.range, text.GetSubstring(token.range)); // rescan token.range.last = token.range.first - 1; break; } } } totalRange->last = token.range.last; return kJTrue; }
JXPSPrintSetupDialog* CBPSPrinter::CreatePrintSetupDialog ( const Destination destination, const JCharacter* printCmd, const JCharacter* fileName, const JBoolean collate, const JBoolean bw ) { assert( itsCBPrintSetupDialog == NULL ); if (itsFontSize == kUnsetFontSize) { JString fontName; CBGetPrefsManager()->GetDefaultFont(&fontName, &itsFontSize); JArray<JIndexRange> matchList; if (nxmRegex.Match(fontName, &matchList)) { const JString hStr = fontName.GetSubstring(matchList.GetElement(2)); const JBoolean ok = hStr.ConvertToUInt(&itsFontSize); assert( ok ); itsFontSize--; } } itsCBPrintSetupDialog = CBPSPrintSetupDialog::Create(destination, printCmd, fileName, collate, bw, itsFontSize, (CBGetPTTextPrinter())->WillPrintHeader()); return itsCBPrintSetupDialog; }
void GMessageHeader::DecodeMIMEHeader ( JString* header ) { JArray<JIndexRange> subList; JSize count = encodedMIMEQRegex.MatchAll(*header, &subList); JBoolean qType = kJTrue; if (count == 0) { count = encodedMIMEBRegex.MatchAll(*header, &subList); qType = kJFalse; } if (count > 0) { JString temp; JIndex mIndex = 1; const JSize count = subList.GetElementCount(); for (JIndex i = 1; i <= count; i++) { JIndexRange range = subList.GetElement(i); // if ((range.first != mIndex) && // RangeContainsNWS(*header, mIndex, range.first)) // { // temp += header->GetSubstring(mIndex, range.first - 1); // } if (range.first != mIndex) { JString trimmed = header->GetSubstring(mIndex, range.first - 1); trimmed.TrimWhitespace(); if (!trimmed.IsEmpty()) { temp += header->GetSubstring(mIndex, range.first - 1); } } temp += DecodeMIMEWord(qType, header, range); mIndex = range.last + 1; } if (mIndex < header->GetLength()) { temp += header->GetSubstring(mIndex, header->GetLength()); } *header = temp; } }
JFontStyle CBHTMLStyler::GetTagStyle ( const JIndexRange& tokenRange, const JIndex typeIndex ) { const JString& text = GetText(); JFontStyle style; JArray<JIndexRange> matchList; if (tagNamePattern.MatchWithin(text, tokenRange, &matchList)) { itsLatestTagName = text.GetSubstring(matchList.GetElement(2)); itsLatestTagName.ToLower(); JString openTag; if (itsLatestTagName.GetFirstCharacter() == '/' && itsLatestTagName.GetLength() > 1) { openTag = itsLatestTagName.GetSubstring(2, itsLatestTagName.GetLength()); } JBoolean found = GetWordStyle(itsLatestTagName, &style); if (!found && !openTag.IsEmpty()) { found = GetWordStyle(openTag, &style); } if (!found) { found = GetXMLStyle(itsLatestTagName, &style); } if (!found && !openTag.IsEmpty()) { found = GetXMLStyle(openTag, &style); } if (!found) { style = GetTypeStyle(typeIndex); } } else if (text.GetCharacter(tokenRange.first) == '<') { itsLatestTagName.Clear(); style = GetTypeStyle(typeIndex); } else { style = GetStyle(typeIndex, itsLatestTagName); } return style; }
void JExtractFileAndLine ( const JCharacter* str, JString* fileName, JIndex* startLineIndex, JIndex* endLineIndex ) { static JRegex lineIndexRegex(":([0-9]+)(-([0-9]+))?$"); *fileName = str; JArray<JIndexRange> matchList; if (lineIndexRegex.Match(*fileName, &matchList)) { JString s = fileName->GetSubstring(matchList.GetElement(2)); JBoolean ok = s.ConvertToUInt(startLineIndex); assert( ok ); const JIndexRange endRange = matchList.GetElement(4); if (endLineIndex != NULL && !endRange.IsEmpty()) { s = fileName->GetSubstring(endRange); ok = s.ConvertToUInt(endLineIndex); assert( ok ); } else if (endLineIndex != NULL) { *endLineIndex = *startLineIndex; } fileName->RemoveSubstring(matchList.GetElement(1)); } else { *startLineIndex = 0; if (endLineIndex != NULL) { *endLineIndex = 0; } } }
JBoolean JXFontManager::BuildTrueTypeFontName ( const JCharacter* xName, const JSize size, const JFontStyle& style, JString* xFontStr ) const { xFontStr->Clear(); // NxM is not TrueType. Symbol is strange. if (nxmRegex.Match(xName) || JStringCompare(xName, "Symbol", kJFalse) == 0) { return kJFalse; } // name xFontStr->Append(xName); // size xFontStr->Append("-"); xFontStr->Append( JString(size, JString::kBase10) ); // regular or boldface if (style.bold) { xFontStr->Append(":weight=bold"); } else { xFontStr->Append(":weight=light"); } // regular or italic if (style.italic) { xFontStr->Append(":slant=oblique,italic"); } else { xFontStr->Append(":slant=roman"); } // success return kJTrue; }
void JDirInfo::SetWildcardFilter ( const JCharacter* filterStr, const JBoolean negate, const JBoolean caseSensitive ) { JString regexStr; if (!BuildRegexFromWildcardFilter(filterStr, ®exStr)) { ClearWildcardFilter(); return; } JRegex* r = new JRegex(regexStr); assert( r != NULL ); r->SetCaseSensitive(caseSensitive); SetWildcardFilter(r, kJTrue, negate); }
CMLocation GDBGetStopLocation::GetLocation() const { const JString& data = GetLastResult(); CMLocation loc; JIndexRange r; if (locationPattern.Match(data, &r)) { std::istringstream stream(data.GetCString()); stream.seekg(r.last); JStringPtrMap<JString> map(JPtrArrayT::kDeleteAll); JString *s, *s1, *fullName; JIndex lineIndex; const JBoolean parsed = GDBLink::ParseMap(stream, &map); if (!parsed) { (CMGetLink())->Log("invalid data map"); } else if (!map.GetElement("fullname", &fullName)) { (CMGetLink())->Log("missing file name"); } else if (!map.GetElement("line", &s)) { (CMGetLink())->Log("missing line index"); } else if (!s->ConvertToUInt(&lineIndex)) { (CMGetLink())->Log("line index is not integer"); } else { loc.SetFileName(*fullName); loc.SetLineNumber(lineIndex); } if (parsed && map.GetElement("func", &s) && map.GetElement("addr", &s1)) { loc.SetFunctionName(*s); loc.SetMemoryAddress(*s1); } } else { (CMGetLink())->Log("GDBGetStopLocation failed to match"); } return loc; }
void GDBVarCommand::HandleSuccess ( const JString& data ) { JString s = data; s.TrimWhitespace(); JBoolean success = kJFalse; JIndexRange r; prefixPattern.SetSingleLine(); if (prefixPattern.Match(data, &r)) { s.RemoveSubstring(r); SetData(s); GDBVarTreeParser parser(s); if (parser.yyparse() == 0) { parser.ReportRecoverableError(); success = kJTrue; Broadcast(ValueMessage(kValueUpdated, parser.GetRootNode())); } } else { (CMGetLink())->Log("GDBVarCommand failed to match"); } if (!success) { Broadcast(ValueMessage(kValueFailed, NULL)); } s.Clear(); SetData(s); }
JBoolean CBCommandTable::ExtractInputData ( const JPoint& cell ) { assert( itsTextInput != NULL && cell.x != kOptionsColumn ); CBCommandManager::CmdInfo info = itsCmdList->GetElement(cell.y); const JString& text = itsTextInput->GetText(); JString* s = NULL; if (cell.x == kMenuTextColumn) { s = info.menuText; } else if (cell.x == kMenuShortcutColumn) { s = info.menuShortcut; } else if (cell.x == kScriptNameColumn) { if (illegalNamePattern.Match(text)) { (JGetUserNotification())->ReportError(JGetString(kNoSpacesInCmdNameID)); return kJFalse; } s = info.name; } else if (cell.x == kCommandColumn) { s = info.cmd; } else if (cell.x == kPathColumn) { s = info.path; } assert( s != NULL ); if (itsTextInput->InputValid()) { *s = text; s->TrimWhitespace(); return kJTrue; } else { return kJFalse; } }
int GMScanner::yylex() { if (itsCurrentPosition == 0) { itsIs >> std::ws; itsCurrentPosition = JTellg(*itsIs); itsCurrentHeaderStart = itsCurrentPosition; itsText = JReadLine(*itsIs); JRegex regex; JBoolean matched; JArray<JStringRange>* subList = new JArray<JStringRange>; assert(subList != NULL); err = regex.SetPattern("^From[[:space:]]+.*.{3}[[:space:]]+.{3}[[:space:]]+[[:digit:]]+[[:space:]]+[[:digit:]]+:[[:digit:]]+:[[:digit:]]+[[:space:]]+[[:digit:]]{4}"); assert(err.OK()); matched = regex.Match(itsText, subList); delete subList; if (matched) { itsState = kHeaderStart; return itsState; } }
JBoolean MatchesCookie ( const JCharacter* cookie, const JDirEntry& entry ) { JString file = entry.GetFullName(); if (!JFileReadable(file)) { return kJFalse; } mode_t perms; JError err = JGetPermissions(file, &perms); if (!err.OK()) { perms = 0600; } ifstream is(file); is >> ws; JString line1 = JReadLine(is); is.close(); if (line1 == "") { return kJTrue; } JArray<JIndexRange> subList; JRegex regex; err = regex.SetPattern(cookie); JBoolean matched = regex.Match(line1, &subList); if (matched) { return kJTrue; } return kJFalse; }
void GDBGetProgramName::HandleSuccess ( const JString& data ) { JString fileName; JArray<JIndexRange> matchList; if (fileNamePattern.Match(data, &matchList) || osxNamePattern.Match(data, &matchList)) { fileName = data.GetSubstring(matchList.GetElement(2)); } else { (CMGetLink())->Log("GDBGetProgramName failed to match"); } // CMLink has to broadcast SymbolsLoaded regardless of whether or not // we get what we expect from gdb. dynamic_cast<GDBLink*>(CMGetLink())->SaveProgramName(fileName); }
void SVNInfoLog::GetSelectedFiles ( JPtrArray<JString>* fullNameList, const JBoolean includeDeleted ) { fullNameList->CleanOut(); fullNameList->SetCleanUpAction(JPtrArrayT::kDeleteAll); JString s; if (GetSelection(&s) && revisionPattern.Match(s)) { fullNameList->Append(itsFullName); } }
JBoolean JParseURL ( const JCharacter* url, JString* protocol, JString* host, JIndex* port, JString* path ) { *path = url; JArray<JIndexRange> matchList; if (urlPattern.Match(url, &matchList)) { protocol->Set(url, matchList.GetElement(2)); host->Set(url, matchList.GetElement(3)); JIndexRange r = matchList.GetElement(4); if (!r.IsEmpty()) { const JString s(url, r); if (!s.ConvertToUInt(port)) { *port = 0; } } else { *port = 0; } r = matchList.GetElement(5); if (!r.IsEmpty()) { path->Set(url, r); } else { *path = "/"; } return kJTrue; } return kJFalse; }
JBoolean JVIKeyHandler::GetPrevCharacter ( JCharacter* c ) const { if (prevCharPattern.Match(itsKeyBuffer)) { *c = itsKeyBuffer.GetLastCharacter(); return kJTrue; } else { *c = 0; return kJFalse; } }
void THXBaseConvDirector::Convert() { const JInteger fromBase = itsFromBase->GetBase(); const JString& fromStr = itsFromValue->GetText(); if (fromBase != 16 && hexRegex.Match(fromStr)) { itsFromBase->SetBase(16); // calls us again return; } JUInt value; if (!fromStr.ConvertToUInt(&value, fromBase)) { itsToValue->SetText(""); return; } JString toValue; const JInteger toBase = itsToBase->GetBase(); if (value == 0) { toValue = "0"; } else if (toBase == 2) { do { if (value & 0x01) { toValue.PrependCharacter('1'); } else { toValue.PrependCharacter('0'); } value = value >> 1; } while (value != 0); } else {
void JXFontManager::GetXFontNames ( const JRegex& regex, JPtrArray<JString>* fontNames, JSortXFontNamesFn compare ) const { fontNames->CleanOut(); fontNames->SetCompareFunction( compare != NULL ? compare : JCompareStringsCaseInsensitive); fontNames->SetSortOrder(JOrderedSetT::kSortAscending); #ifdef _J_USE_XFT #else int nameCount; char** nameList = XListFonts(*itsDisplay, "*", INT_MAX, &nameCount); if (nameList == NULL) { return; } for (int i=0; i<nameCount; i++) { if (regex.Match(nameList[i]) && strcmp(nameList[i], "nil") != 0) { JString name = nameList[i]; JBoolean isDuplicate; const JIndex index = fontNames->GetInsertionSortIndex(&name, &isDuplicate); if (!isDuplicate) { JString* n = new JString(name); assert( n != NULL ); fontNames->InsertAtIndex(index, n); } } } XFreeFontNames(nameList); #endif }
JBoolean SVNInfoLog::GetBaseRevision ( JString* rev ) { JString s; JArray<JIndexRange> matchList; if (GetSelection(&s) && revisionPattern.Match(s, &matchList)) { *rev = s.GetSubstring(matchList.GetElement(2)); return kJTrue; } else { rev->Clear(); return kJFalse; } }
void JXChooseMonoFont::UpdateMenus ( const JBoolean updateSize ) { const JString& fontName = itsFontMenu->GetFontName(); if (fontRegex.Match(fontName)) { itsSizeMenu->Deactivate(); } else { itsSizeMenu->Activate(); if (updateSize) { itsSizeMenu->SetFontName(fontName); } } }
void CBCompileDocument::OpenNextListItem() { CBTextEditor* te = GetTextEditor(); const JString& text = te->GetText(); JString s; JIndexRange r; while (ShowNextError()) { const JBoolean ok = te->GetSelection(&r); assert( ok ); s = text.GetSubstring(r); if (makeErrorRegex.Match(s)) { continue; } GetTextEditor()->OpenSelection(); break; } }
void GDBGetFrame::HandleSuccess ( const JString& cmdData ) { const JString& data = GetLastResult(); JIndexRange r; if (framePattern.Match(data, &r)) { std::istringstream stream(data.GetCString()); stream.seekg(r.last); JStringPtrMap<JString> map(JPtrArrayT::kDeleteAll); JString* s; JIndex frameIndex; if (!GDBLink::ParseMap(stream, &map)) { (CMGetLink())->Log("invalid data map"); } else if (!map.GetElement("level", &s)) { (CMGetLink())->Log("missing frame index"); } else if (!s->ConvertToUInt(&frameIndex)) { (CMGetLink())->Log("frame index is not integer"); } else { itsWidget->SelectFrame(frameIndex); } } else { (CMGetLink())->Log("GDBGetFrame failed to match"); } }
void GetTempVarName ( const JCharacter* tagName, JString* varName, const JPtrArray<JString>& objNames ) { JString suffix = tagName; JIndexRange r; while (illegalCChar.Match(suffix, &r)) { suffix.RemoveSubstring(r); } suffix.PrependCharacter('_'); const JString prefix = "obj"; const JSize count = objNames.GetElementCount(); for (JIndex i=1; i<=INT_MAX; i++) { *varName = prefix + JString(i) + suffix; JBoolean unique = kJTrue; for (JIndex j=1; j<=count; j++) { const JString* usedName = objNames.NthElement(j); if (*varName == *usedName) { unique = kJFalse; break; } } if (unique) { break; } } }
JBoolean CBHTMLScanner::IsScript ( JString* language ) const { scriptTagPattern1.SetCaseSensitive(kJFalse); scriptTagPattern2.SetCaseSensitive(kJFalse); scriptTagPattern3.SetCaseSensitive(kJFalse); language->Clear(); const JString& text = GetScannedText(); const JCharacter* s = text.GetCString() + itsCurrentRange.first - 1; JIndexRange r = itsCurrentRange - (itsCurrentRange.first - 1); JArray<JIndexRange> matchList; if (scriptTagPattern1.MatchWithin(s, r, &matchList)) { *language = text.GetSubstring(matchList.GetElement(2) + (itsCurrentRange.first - 1)); return kJTrue; } else if (scriptTagPattern2.MatchWithin(s, r, &matchList)) { *language = text.GetSubstring(matchList.GetElement(2) + (itsCurrentRange.first - 1)); return kJTrue; } else if (scriptTagPattern3.MatchWithin(s, r)) { *language = "JavaScript"; return kJTrue; } else { return kJFalse; } }
JString JXFontManager::BuildFontName ( const JCharacter* xName, const JCharacter* charSet, const JSize size, const JFontStyle& style, const JCharacter* italicStr, const JBoolean iso ) const { #ifdef _J_USE_XFT JString xFontName; return xFontName; #else // handle NxM separately nxmRegex.SetMatchOnly(kJTrue); if (nxmRegex.Match(xName)) { JString xFontName = xName; if (style.bold) { xFontName += "bold"; } return xFontName; } // any foundry JString xFontName = "-*-"; // given name xFontName.Append(xName); // regular or boldface if (style.bold) { xFontName.Append("-bold"); } else { xFontName.Append("-medium"); } // regular or italic if (style.italic) { xFontName.Append(italicStr); } else { xFontName.Append("-r"); } // normal character spacing, any pixel size xFontName.Append("-normal-*-*-"); // font size xFontName.Append( JString(10*size, 0, JString::kForceNoExponent) ); // screen resolution (apparently, we should always just use 75 dpi fonts), // any spacing, any avg width xFontName.Append("-75-75-*-*-"); JIndex latinIndex; if (!JStringEmpty(charSet)) { xFontName.Append(charSet); } else if (iso && JXGetLatinCharacterSetIndex(&latinIndex)) { JString s = "iso8859-"; s += JString(latinIndex, 0); xFontName.Append(s); } else if (iso) { xFontName.Append("iso*-*"); } else { xFontName.Append("*-*"); } // return the result return xFontName; #endif }
void CBHTMLStyler::StyleEmbeddedVariables ( const Token& token ) { emptyVariablePattern.SetSingleLine(); variablePattern.SetSingleLine(); const JString& text = GetText(); JFontStyle varStyle = GetTypeStyle(token.type - kWhitespace); varStyle.underlineCount++; if (varStyle == GetTypeStyle(kPHPVariable - kWhitespace)) { varStyle.underlineCount++; } JFontStyle errStyle = GetTypeStyle(kError - kWhitespace); errStyle.underlineCount++; if (errStyle == GetTypeStyle(kPHPVariable - kWhitespace)) { errStyle.underlineCount++; } JIndexRange r = token.range, r1, r2; while (!r.IsEmpty()) { const JCharacter c = text.GetCharacter(r.first); if (c == '\\') { r.first++; } else if (c == '$') { r1 = r - (r.first-1); if (emptyVariablePattern.MatchWithin(text.GetCString() + r.first-1, r1, &r2)) { r2 += r.first-1; const JCharacter c1 = text.GetCharacter(r2.last); if (c1 != '}' && c1 != ']') { r2.last--; } AdjustStyle(r2, errStyle); r.first = r2.last; } else if (variablePattern.MatchWithin(text.GetCString() + r.first-1, r1, &r2)) { r2 += r.first-1; if (r2.first > 1 && text.GetCharacter(r2.first-1) == '{') { r2.first--; } AdjustStyle(r2, varStyle); r.first = r2.last; } } else if (c == '{' && r.first < r.last - 1 && text.GetCharacter(r.first+1) == '$' && text.GetCharacter(r.first+2) == '}') { r1.SetFirstAndLength(r.first, 3); AdjustStyle(r1, errStyle); r.first = r1.last; } r.first++; } }