Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
302,300
ASTNode () { // namespace text = "..." is valid - "text" is parsed as a keyword though final ASTNode node = getNode().findChildByType(RncTokenTypes.IDENTIFIERS); if (node == null) { final ASTNode[] nodes = getNode().getChildren(RncTokenTypes.KEYWORDS); if (nodes.length > 1) { return nodes[1]; } } return node; }
findIdentifierNode
302,301
String () { final String s = getPrefix(); return s != null ? s : ""; }
getName
302,302
void (@NotNull RncElementVisitor visitor) { visitor.visitElement(this); }
accept
302,303
void () { try { myCurrentToken = nextToken(); myCurrentOffset = myCurrentEnd; if (myCurrentToken != null) { myCurrentEnd = myCurrentOffset + myCurrentToken.image.length(); for (int i = myCurrentOffset; i < myCurrentEnd; i++) { myCurrentEnd += myLengthMap.get(i); } if (myCurrentToken.kind == CompactSyntaxConstants.EOF) ...
advance
302,304
Token () { if (myTokenQueue.size() > 0) { return myTokenQueue.removeFirst(); } final Token t = myLexer.getNextToken(); if (t.specialToken != null) { myTokenQueue.addFirst(t); for (Token s = t.specialToken; s != null; s = s.specialToken) { myTokenQueue.addFirst(s); } return myTokenQueue.removeFirst(); } else { return t;...
nextToken
302,305
CharSequence () { return myBuffer; }
getBufferSequence
302,306
int () { return myEndOffset; }
getBufferEnd
302,307
int () { try { return (Integer)myStateField.get(myLexer); } catch (Exception e) { return -1; } }
getState
302,308
int () { return myCurrentEnd; }
getTokenEnd
302,309
int () { return myCurrentToken == null ? 0 : myCurrentOffset; }
getTokenStart
302,310
IElementType () { if (myCurrentToken == null) { return null; } else { return myCurrentTokenType; } }
getTokenType
302,311
void (@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) { myBuffer = buffer; final Reader reader = new CharSequenceReader(buffer, startOffset, endOffset); init(startOffset, endOffset, reader, initialState); }
start
302,312
void (int startOffset, int endOffset, Reader reader, int initialState) { myEndOffset = endOffset; myLengthMap = new Int2IntOpenHashMap(); myLexer = createTokenManager(initialState, new EscapePreprocessor(reader, startOffset, myLengthMap)); myCurrentToken = START; myCurrentOffset = startOffset; myCurrentEnd = startOffse...
init
302,313
CompactSyntaxTokenManager (int initialState, EscapePreprocessor preprocessor) { try { return new CompactSyntaxTokenManager(new SimpleCharStream(preprocessor, 1, 1), initialState); } catch (NoSuchMethodError e) { final Class<CompactSyntaxTokenManager> managerClass = CompactSyntaxTokenManager.class; LOG.error("Unsupporte...
createTokenManager
302,314
String (Class<?> clazz) { final CodeSource source = clazz.getProtectionDomain().getCodeSource(); if (source != null) { final URL location = source.getLocation(); if (location != null) { return location.toExternalForm(); } } final String name = clazz.getName().replace('.', '/') + ".class"; final ClassLoader loader = cla...
getSourceLocation
302,315
void () { }
close
302,316
int (char[] cbuf, int off, int len) { if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) > cbuf.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return 0; } if (myText instanceof CharArrayCharSequence) { // Optimization final int readChars = ((CharArrayCharSeq...
read
302,317
int () { if (myCurPos >= myEndOffset) return -1; return myText.charAt(myCurPos++); }
read
302,318
void (boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin...
ExpandBuff
302,319
void (char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column-...
UpdateLineColumn
302,320
int () { return bufcolumn[bufpos]; }
getColumn
302,321
int () { return bufline[bufpos]; }
getLine
302,322
int () { return bufcolumn[bufpos]; }
getEndColumn
302,323
int () { return bufline[bufpos]; }
getEndLine
302,324
int () { return bufcolumn[tokenBegin]; }
getBeginColumn
302,325
int () { return bufline[tokenBegin]; }
getBeginLine
302,326
void (int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; }
backup
302,327
void (java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buff...
ReInit
302,328
void (java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); }
ReInit
302,329
void (java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); }
ReInit
302,330
void (java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); }
ReInit
302,331
void (java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); }
ReInit
302,332
void (java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); }
ReInit
302,333
String () { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); }
GetImage
302,334
char[] (int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; }
GetSuffix
302,335
void () { buffer = null; bufline = null; bufcolumn = null; }
Done
302,336
void (int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++s...
adjustBeginLineColumn
302,337
boolean (char i) { if (Character.isDigit(i)) return true; final char c = Character.toLowerCase(i); return c >= 'a' && c <= 'f'; }
isHexChar
302,338
int () { if (myQueuedChars.size() > 0) { myOffset++; return myQueuedChars.removeInt(0); } return -1; }
consume
302,339
void (int n) { myQueuedChars.removeElements(0, n); }
consume
302,340
boolean (@NotNull PsiElement element) { if (element.getContainingFile() instanceof RncFile) { final RncDefine define = PsiTreeUtil.getParentOfType(element, RncDefine.class, false); if (define != null) { if (isSuppressedAt(define)) return true; } final RncGrammar grammar = PsiTreeUtil.getParentOfType(define, RncGrammar....
isSuppressedFor
302,341
boolean (RncElement location) { PsiElement prev = location.getPrevSibling(); while (prev instanceof PsiWhiteSpace || prev instanceof PsiComment) { if (prev instanceof PsiComment) { @NonNls String text = prev.getText(); if (text.matches("\n*#\\s*suppress\\s.+") && (text.contains(getID()) || "ALL".equals(text))) return t...
isSuppressedAt
302,342
PsiElement (PsiElement element) { return PsiTreeUtil.getParentOfType(element, RncDefine.class, false); }
getTarget
302,343
PsiElement (PsiElement element) { final RncDefine define = PsiTreeUtil.getParentOfType(element, RncDefine.class, false); RncGrammar target = define != null ? PsiTreeUtil.getParentOfType(define, RncGrammar.class, false) : null; return target != null && target.getText().startsWith("grammar ") ? target : null; }
getTarget
302,344
SuppressQuickFix[] (PsiElement element) { return ContainerUtil.map(super.getBatchSuppressActions(element), action -> new SuppressQuickFix() { @NotNull @Override public String getName() { return action.getName(); } @Override public boolean isAvailable(@NotNull Project project, @NotNull PsiElement context) { return conte...
getXmlOnlySuppressions
302,345
String () { return action.getName(); }
getName
302,346
boolean (@NotNull Project project, @NotNull PsiElement context) { return context.isValid(); }
isAvailable
302,347
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement element1 = descriptor.getPsiElement(); PsiFile file = element1 == null ? null : element1.getContainingFile(); if (file == null || file.getFileType() != XmlFileType.INSTANCE) return; action.applyFix(project, descriptor); }
applyFix
302,348
String () { return action.getFamilyName(); }
getFamilyName
302,349
boolean () { return action.isSuppressAll(); }
isSuppressAll
302,350
void (PsiFile file, @NotNull PsiElement location) { suppress(file, location, "#suppress " + getID(), text -> text + ", " + getID()); }
suppress
302,351
void (PsiFile file, @NotNull PsiElement location, String suppressComment, Function<? super String, String> replace) { final Project project = file.getProject(); final VirtualFile vfile = file.getVirtualFile(); if (vfile == null || ReadonlyStatusHandler.getInstance(project).ensureFilesWritable(Collections.singletonList(...
suppress
302,352
String () { return RelaxngBundle.message("relaxng.suppress.action.name", myLocation); }
getName
302,353
String () { return getDisplayName(); }
getFamilyName
302,354
boolean (@NotNull Project project, @NotNull PsiElement context) { return context.isValid(); }
isAvailable
302,355
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement element = descriptor.getPsiElement(); PsiElement target = getTarget(element); if (target == null) return; suppress(element.getContainingFile(), target); }
applyFix
302,356
boolean () { return false; }
isSuppressAll
302,357
RncElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly) { return new MyElementVisitor(holder); }
buildVisitor
302,358
void (@NotNull XmlTag tag) { MyElementVisitor.this.visitXmlTag(tag); }
visitXmlTag
302,359
void (PsiElement element) { element.accept(myXmlVisitor); }
superVisitElement
302,360
void (RncDefine pattern) { final RncGrammar grammar = PsiTreeUtil.getParentOfType(pattern, RncGrammar.class); final PsiFile file = pattern.getContainingFile(); if (grammar != null) { if (processRncUsages(pattern, new LocalSearchScope(grammar))) return; } else { if (processRncUsages(pattern, new LocalSearchScope(file)))...
visitDefine
302,361
boolean (PsiElement tag, LocalSearchScope scope) { final Query<PsiReference> query = ReferencesSearch.search(tag, scope); for (PsiReference reference : query) { final PsiElement e = reference.getElement(); final RncDefine t = PsiTreeUtil.getParentOfType(e, RncDefine.class, false); if (t == null || !PsiTreeUtil.isAncest...
processRncUsages
302,362
void (XmlTag tag) { final PsiFile file = tag.getContainingFile(); if (file.getFileType() != XmlFileType.INSTANCE) { return; } if (!tag.getLocalName().equals("define")) { return; } if (!tag.getNamespace().equals(RelaxNgMetaDataContributor.RNG_NAMESPACE)) { return; } if (tag.getAttribute("combine") != null) { return; // ...
visitXmlTag
302,363
boolean (PsiElement tag, XmlAttributeValue value, LocalSearchScope scope) { final Query<PsiReference> query = ReferencesSearch.search(tag, scope, true); for (PsiReference reference : query) { final PsiElement e = reference.getElement(); if (e != value) { final XmlTag t = PsiTreeUtil.getParentOfType(e, XmlTag.class); if...
processUsages
302,364
String () { return RelaxngBundle.message("relaxng.quickfix.remove-define"); }
getFamilyName
302,365
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement myTag = doIfNotNull(descriptor.getPsiElement(), PsiElement::getParent); try { if (myTag instanceof RncDefine && myTag.isValid()) { myTag.delete(); } } catch (IncorrectOperationException e) { Logger.getInstance(UnusedDefineInspection.cla...
applyFix
302,366
void (@NotNull XmlElement element) { if (element instanceof XmlEntityRef) { XmlUtil.processXmlElements(element, this, false, true); } super.visitXmlElement(element); }
visitXmlElement
302,367
void (@NotNull XmlToken token) { if (token.getTokenType() == XmlTokenType.XML_DATA_CHARACTERS) { handleText(token, token.getText()); } }
visitXmlToken
302,368
void (XmlElement element, String text) { try { setLocation(element); myHandler.characters(text.toCharArray(), 0, text.length()); } catch (SAXException e) { throw new ParseError(e); } }
handleText
302,369
boolean (@NotNull PsiElement element) { element.accept(this); return true; }
execute
302,370
void (@NotNull XmlDocument document) { try { myHandler.startDocument(); final XmlTag rootTag = document.getRootTag(); if (rootTag != null) { rootTag.accept(this); } myHandler.endDocument(); } catch (SAXException e) { throw new ParseError(e); } }
visitXmlDocument
302,371
void (@NotNull XmlTag tag) { try { setLocation(tag); final Map<String,String> map = tag.getLocalNamespaceDeclarations(); final String[] prefixes = ArrayUtilRt.toStringArray(map.keySet()); for (String prefix : prefixes) { myHandler.startPrefixMapping(prefix, map.get(prefix)); } final Attributes2Impl atts = new Attribute...
visitXmlTag
302,372
void (@NotNull XmlText text) { handleText(text, text.getValue()); }
visitXmlText
302,373
void (PsiElement text) { final PsiFile psiFile = text.getContainingFile(); final Document document = PsiDocumentManager.getInstance(text.getProject()).getDocument(psiFile); if (document == null) { return; } final VirtualFile virtualFile = psiFile.getVirtualFile(); if (virtualFile == null) { return; } final Locator2Impl...
setLocation
302,374
void (SAXParseException e) { handleError(e, file, doc, consumer.warning()); }
warning
302,375
void (SAXParseException e) { handleError(e, file, doc, consumer.error()); }
error
302,376
void (@NotNull PsiFile file, MyValidationMessageConsumer annotationResult, @NotNull AnnotationHolder holder) { annotationResult.apply(holder); }
apply
302,377
void (@NotNull PsiElement context, @NotNull String message) { errors.add(Pair.create(context, message)); }
onMessage
302,378
void (@NotNull PsiElement context, @NotNull String message) { warnings.add(Pair.create(context, message)); }
onMessage
302,379
void (SAXParseException ex, PsiFile file, Document document, ValidationMessageConsumer consumer) { final String systemId = ex.getSystemId(); if (LOG.isDebugEnabled()) { LOG.debug("RNG Schema error: " + ex.getMessage() + " [" + systemId + "]"); } if (systemId != null) { final VirtualFile virtualFile = findVirtualFile(sy...
handleError
302,380
VirtualFile (String systemId) { try { return VfsUtil.findFileByURL(new URL(systemId)); } catch (Exception e) { LOG.warn("Failed to build file from uri <" + systemId + ">", e); return VirtualFileManager.getInstance().findFileByUrl(VfsUtilCore.fixURLforIDEA(systemId)); } }
findVirtualFile
302,381
void (@NotNull PsiElement host, @NotNull String message) { final ASTNode node = host.getNode(); assert node != null; if (host instanceof XmlAttribute) { final ASTNode nameNode = XmlChildRole.ATTRIBUTE_NAME_FINDER.findChild(node); if (nameNode != null) { createAnnotation(nameNode, message); } } else if (host instanceof ...
onMessage
302,382
void (@NotNull ASTNode node, @NotNull String message) { if (MISSING_START_ELEMENT.equals(message)) { final PsiFile psiFile = node.getPsi().getContainingFile(); if (psiFile instanceof XmlFile) { final PsiElementProcessor.FindElement<XmlFile> processor = new PsiElementProcessor.FindElement<>(); RelaxIncludeIndex.processB...
createAnnotation
302,383
void (@NotNull ASTNode node, @NotNull String message) { myHolder.newAnnotation(HighlightSeverity.WARNING, message).range(node).create(); }
createAnnotation
302,384
void (@NotNull PsiErrorElement element) { throw FOUND; }
visitErrorElement
302,385
boolean (PsiElement element) { try { element.accept(INSTANCE); return false; } catch (HasError e) { return true; } }
hasError
302,386
DatatypeLibraryFactory () { try { return new DatatypeLibraryFactoryImpl(); } catch (Throwable e) { LOG.error("Could not create DT library implementation 'com.thaiopensource.datatype.xsd.DatatypeLibraryFactoryImpl'. Plugin's classpath seems to be broken.", e); return new DoNothingDatatypeLibraryFactoryImpl(); } }
createXsdDatatypeFactory
302,387
void (SAXParseException e) { LOG.info("e.getMessage() = " + e.getMessage() + " [" + e.getSystemId() + "]"); LOG.info(e); }
error
302,388
DPattern (final PsiFile descriptorFile, final ErrorHandler eh) { final VirtualFile file = descriptorFile.getVirtualFile(); if (file == null) { return parsePattern(descriptorFile, eh, false); } String url = file.getUrl(); DPattern pattern = ourCache.get(url); if (pattern == null) { pattern = parsePattern(descriptorFile,...
getCachedPattern
302,389
DPattern (final PsiFile file, final ErrorHandler eh, boolean checking) { try { final Parseable p = createParsable(file, eh); if (checking) { p.parse(new SchemaBuilderImpl(eh, DT_LIBRARY_FACTORY.getValue(), new SchemaPatternBuilder())); } else { return p.parse(new DSchemaBuilderImpl()); } } catch (BuildException e) { LO...
parsePattern
302,390
Parseable (final PsiFile file, final ErrorHandler eh) { final InputSource source = makeInputSource(file); final VirtualFile virtualFile = file.getVirtualFile(); if (file.getFileType() == RncFileType.getInstance()) { return new CompactParseable(source, eh) { @Override public ParsedPattern parseInclude(String uri, Schema...
createParsable
302,391
String (VirtualFile descriptorFile, String s) { final VirtualFile file = UriUtil.findRelativeFile(s, descriptorFile); if (file != null) { s = VfsUtilCore.fixIDEAUrl(file.getUrl()); } return s; }
resolveURI
302,392
Schema (final XmlFile descriptorFile) { CachedValue<Schema> value = descriptorFile.getUserData(SCHEMA_KEY); if (value == null) { final CachedValueProvider<Schema> provider = () -> { final InputSource inputSource = makeInputSource(descriptorFile); try { final Schema schema = new MySchemaReader(descriptorFile).createSche...
getCachedSchema
302,393
InputSource (PsiFile descriptorFile) { final InputSource inputSource = new InputSource(new StringReader(descriptorFile.getText())); final VirtualFile file = descriptorFile.getVirtualFile(); if (file != null) { inputSource.setSystemId(VfsUtilCore.fixIDEAUrl(file.getUrl())); } return inputSource; }
makeInputSource
302,394
void (@NotNull final XmlDocument doc, final Validator.ValidationHost host, final XmlFile descriptorFile) { try { final Schema schema = RngParser.getCachedSchema(descriptorFile); if (schema == null) { // did not manage to get a compiled schema. no validation... return; } final ErrorHandler eh = MyErrorHandler.create(doc...
doValidation
302,395
void (SAXParseException exception) { RngSchemaValidator.handleError(exception, myFile, myDocument, new RngSchemaValidator.ValidationMessageConsumer() { @Override public void onMessage(@NotNull PsiElement context, @NotNull String message) { myHost.addMessage(context, message, Validator.ValidationHost.ErrorType.WARNING);...
warning
302,396
void (@NotNull PsiElement context, @NotNull String message) { myHost.addMessage(context, message, Validator.ValidationHost.ErrorType.WARNING); }
onMessage
302,397
void (SAXParseException exception) { RngSchemaValidator.handleError(exception, myFile, myDocument, new RngSchemaValidator.ValidationMessageConsumer() { @Override public void onMessage(@NotNull PsiElement context, @NotNull String message) { myHost.addMessage(context, message, Validator.ValidationHost.ErrorType.ERROR); }...
error
302,398
void (@NotNull PsiElement context, @NotNull String message) { myHost.addMessage(context, message, Validator.ValidationHost.ErrorType.ERROR); }
onMessage
302,399
void (SAXParseException exception) { RngSchemaValidator.handleError(exception, myFile, myDocument, new RngSchemaValidator.ValidationMessageConsumer() { @Override public void onMessage(@NotNull PsiElement context, @NotNull String message) { myHost.addMessage(context, message, Validator.ValidationHost.ErrorType.ERROR); }...
fatalError