code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
protected void updateActivation(Activation value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth() + 1);
... | java |
protected void updateActivationFile(ActivationFile value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth(... | java |
protected void updateActivationOS(ActivationOS value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth() + ... | java |
protected void updateActivationProperty(ActivationProperty value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.g... | java |
protected void updateBuild(Build value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth() + 1);
f... | java |
protected void updateBuildBase(BuildBase value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth() + 1);
... | java |
protected void updateCiManagement(CiManagement value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth() + ... | java |
protected void updateConfigurationContainer(ConfigurationContainer value, String xmlTag, Counter counter,
Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = n... | java |
protected void updateContributor(Contributor value, String xmlTag, Counter counter, Element element)
{
Element root = element;
Counter innerCount = new Counter(counter.getDepth() + 1);
findAndReplaceSimpleElement(innerCount, root, "name", value.getName(), null);
findAndReplaceSimpleElement(in... | java |
protected void updateDependency(Dependency value, String xmlTag, Counter counter, Element element)
{
Element root = element;
Counter innerCount = new Counter(counter.getDepth() + 1);
findAndReplaceSimpleElement(innerCount, root, "groupId", value.getGroupId(), null);
findAndReplaceSimpleElemen... | java |
protected void updateDependencyManagement(DependencyManagement value, String xmlTag, Counter counter,
Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new C... | java |
protected void updateDeploymentRepository(DeploymentRepository value, String xmlTag, Counter counter,
Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new C... | java |
protected void updateDistributionManagement(DistributionManagement value, String xmlTag, Counter counter,
Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = n... | java |
protected Element updateElement(Counter counter, Element parent, String name, boolean shouldExist)
{
Element element = parent.getChild(name, parent.getNamespace());
if ((element != null) && shouldExist)
{
counter.increaseCount();
}
if ((element == null) && shouldExist)
{
... | java |
protected void updateExclusion(Exclusion value, String xmlTag, Counter counter, Element element)
{
Element root = element;
Counter innerCount = new Counter(counter.getDepth() + 1);
findAndReplaceSimpleElement(innerCount, root, "artifactId", value.getArtifactId(), null);
findAndReplaceSimpleEl... | java |
protected void updateExtension(Extension value, String xmlTag, Counter counter, Element element)
{
Element root = element;
Counter innerCount = new Counter(counter.getDepth() + 1);
findAndReplaceSimpleElement(innerCount, root, "groupId", value.getGroupId(), null);
findAndReplaceSimpleElement(... | java |
protected void updateFileSet(FileSet value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth() + 1);
... | java |
protected void updateIssueManagement(IssueManagement value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDept... | java |
protected void updateLicense(License value, String xmlTag, Counter counter, Element element)
{
Element root = element;
Counter innerCount = new Counter(counter.getDepth() + 1);
findAndReplaceSimpleElement(innerCount, root, "name", value.getName(), null);
findAndReplaceSimpleElement(innerCount... | java |
protected void updateMailingList(MailingList value, String xmlTag, Counter counter, Element element)
{
Element root = element;
Counter innerCount = new Counter(counter.getDepth() + 1);
findAndReplaceSimpleElement(innerCount, root, "name", value.getName(), null);
findAndReplaceSimpleElement(in... | java |
protected void updateModelBase(ModelBase value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth() + 1);
... | java |
protected void updateNotifier(Notifier value, String xmlTag, Counter counter, Element element)
{
Element root = element;
Counter innerCount = new Counter(counter.getDepth() + 1);
findAndReplaceSimpleElement(innerCount, root, "type", value.getType(), "mail");
findAndReplaceSimpleElement(innerC... | java |
protected void updateOrganization(Organization value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth() + ... | java |
protected void updateParent(Parent value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth() + 1);
... | java |
protected void updatePatternSet(PatternSet value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth() + 1);
... | java |
protected void updatePlugin(Plugin value, String xmlTag, Counter counter, Element element)
{
Element root = element;
Counter innerCount = new Counter(counter.getDepth() + 1);
findAndReplaceSimpleElement(innerCount, root, "groupId", value.getGroupId(), "org.apache.maven.plugins");
findAndRepla... | java |
protected void updatePluginConfiguration(PluginConfiguration value, String xmlTag, Counter counter,
Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Cou... | java |
protected void updatePluginContainer(PluginContainer value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDept... | java |
protected void updatePluginExecution(PluginExecution value, String xmlTag, Counter counter, Element element)
{
Element root = element;
Counter innerCount = new Counter(counter.getDepth() + 1);
findAndReplaceSimpleElement(innerCount, root, "id", value.getId(), "default");
findAndReplaceSimpleE... | java |
protected void updatePrerequisites(Prerequisites value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth() ... | java |
protected void updateProfile(Profile value, String xmlTag, Counter counter, Element element)
{
Element root = element;
Counter innerCount = new Counter(counter.getDepth() + 1);
findAndReplaceSimpleElement(innerCount, root, "id", value.getId(), null);
updateActivation(value.getActivation(), "a... | java |
protected void updateRelocation(Relocation value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth() + 1);
... | java |
protected void updateReporting(Reporting value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth() + 1);
... | java |
protected void updateReportPlugin(ReportPlugin value, String xmlTag, Counter counter, Element element)
{
Element root = element;
Counter innerCount = new Counter(counter.getDepth() + 1);
findAndReplaceSimpleElement(innerCount, root, "groupId", value.getGroupId(), "org.apache.maven.plugins");
... | java |
protected void updateReportSet(ReportSet value, String xmlTag, Counter counter, Element element)
{
Element root = element;
Counter innerCount = new Counter(counter.getDepth() + 1);
findAndReplaceSimpleElement(innerCount, root, "id", value.getId(), "default");
findAndReplaceXpp3DOM(innerCount,... | java |
protected void updateRepository(Repository value, String xmlTag, Counter counter, Element element)
{
Element root = element;
Counter innerCount = new Counter(counter.getDepth() + 1);
updateRepositoryPolicy(value.getReleases(), "releases", innerCount, root);
updateRepositoryPolicy(value.getSna... | java |
protected void updateRepositoryBase(RepositoryBase value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth(... | java |
protected void updateRepositoryPolicy(RepositoryPolicy value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDe... | java |
protected void updateResource(Resource value, String xmlTag, Counter counter, Element element)
{
Element root = element;
Counter innerCount = new Counter(counter.getDepth() + 1);
findAndReplaceSimpleElement(innerCount, root, "targetPath", value.getTargetPath(), null);
findAndReplaceSimpleElem... | java |
protected void updateScm(Scm value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth() + 1);
findA... | java |
protected void updateSite(Site value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth() + 1);
fin... | java |
public static String validateRequired(final InputComponent<?, ?> input)
{
String requiredMessage = null;
if (input.isEnabled() && input.isRequired() && !InputComponents.hasValue(input))
{
requiredMessage = input.getRequiredMessage();
if (Strings.isNullOrEmpty(requiredMessage))
... | java |
public static String getLabelFor(InputComponent<?, ?> input, boolean addColon)
{
String label = input.getLabel();
// If no label was provided, use name
if (label == null)
{
label = input.getName();
}
// if a colon is required, add it
if (addColon && !label.endsWith(... | java |
private synchronized void refreshFlow()
{
try
{
initialize();
}
catch (Exception e)
{
throw new IllegalStateException("Error while initializing wizard", e);
}
int currentFlowPointer = this.flowPointer;
try
{
this.flowPointer = 0;
... | java |
private synchronized void cleanSubsequentStalePages()
{
// FIXME: Workaround until FORGE-1704 is fixed
if (flowPointer == 0)
{
flow.subList(1, flow.size()).clear();
subflow.clear();
}
else
{
// Remove subsequent pages and push the subflows back to the st... | java |
private List<Resource<?>> allDirectoriesOnPath(Resource<?> startingDir)
{
List<Resource<?>> result = new ArrayList<>();
while (startingDir != null)
{
result.add(startingDir);
startingDir = startingDir.getParent();
}
return result;
} | java |
private Project findProjectInDirectory(Resource<?> target, ProjectProvider projectProvider,
Predicate<Project> filter)
{
Project result = null;
Imported<ProjectCache> caches = getCaches();
if (projectProvider.containsProject(target))
{
boolean cached = false;
for... | java |
public static NavigationResultBuilder create(NavigationResult result)
{
NavigationResultBuilder builder = new NavigationResultBuilder();
if (result != null && result.getNext() != null)
{
builder.entries.addAll(Arrays.asList(result.getNext()));
}
return builder;
} | java |
public NavigationResultBuilder add(NavigationResult result)
{
if (result != null && result.getNext() != null)
{
entries.addAll(Arrays.asList(result.getNext()));
}
return this;
} | java |
public NavigationResultBuilder add(UICommandMetadata metadata, Iterable<Class<? extends UICommand>> types)
{
List<NavigationResultEntry> internalEntries = new ArrayList<>();
for (Class<? extends UICommand> type : types)
{
if (UIWizard.class.isAssignableFrom(type))
{
th... | java |
public List<Resource<?>> search()
{
return match(path.split(Pattern.quote(File.separator)), 0, res, new LinkedList<Resource<?>>());
} | java |
@Override
public Resource<?> getChild(final String name)
{
return getResourceFactory().create(new File(getUnderlyingResourceObject().getAbsolutePath(), name));
} | java |
public boolean isEJB(JavaType<?> javaType)
{
return javaType.hasAnnotation(Stateless.class) ||
javaType.hasAnnotation(Stateful.class) ||
javaType.hasAnnotation(Singleton.class) ||
javaType.hasAnnotation(MessageDriven.class);
} | java |
private static Prompt createPrompt(Resource<?> currentResource)
{
// [ currentdir]$
if (OperatingSystemUtils.isWindows())
{
List<TerminalCharacter> prompt = new LinkedList<>();
prompt.add(new TerminalCharacter('['));
for (char c : currentResource.getName().toCharArray())
... | java |
VersionRangeResult getVersions(DependencyQuery query)
{
Coordinate dep = query.getCoordinate();
try
{
String version = dep.getVersion();
if (version == null || version.isEmpty())
{
dep = CoordinateBuilder.create(dep).setVersion("[,)");
}
else... | java |
public static File getContextFile(Resource<?> r)
{
do
{
Object o = r.getUnderlyingResourceObject();
if (o instanceof File)
{
return (File) r.getUnderlyingResourceObject();
}
}
while ((r = r.getParent()) != null);
return null;
} | java |
CliRequest createCliRequest(String[] params, String workingDirectory)
{
CliRequest cliRequest = null;
try
{
Constructor<CliRequest> constructor = CliRequest.class.getDeclaredConstructor(String[].class,
ClassWorld.class);
// This is package-private
constr... | java |
@Override
protected void implementInterface(InterfaceCapableSource<?> source, Iterable<String> value, JavaSourceFacet facet)
{
for (String type : value)
{
source.addInterface(type);
}
} | java |
public static boolean isEnabled(UICommand command, UIContext context)
{
return (command.isEnabled(context) && !(command instanceof UIWizardStep));
} | java |
public static String shellifyOptionValue(String value)
{
return COLONS.matcher(WHITESPACES.matcher(value.trim()).replaceAll("_")).replaceAll("").toUpperCase();
} | java |
public static String shellifyOptionNameDashed(String name)
{
String shellName = shellifyName(name);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < shellName.length(); i++)
{
char c = shellName.charAt(i);
if (Character.isUpperCase(c))
{
if (i... | java |
public static int execFromPath(final String command, final String[] parms, final OutputStream out,
final DirectoryResource path) throws IOException
{
Assert.notNull(command, "Command must not be null.");
Assert.notNull(path, "Directory path must not be null.");
Assert.notNull(out, "Outp... | java |
public static void exec(final boolean wait, final String command, final String... parms)
throws IOException
{
String[] commandTokens = parms == null ? new String[1] : new String[parms.length + 1];
commandTokens[0] = command;
if (commandTokens.length > 1)
{
System.arrayco... | java |
private String readInput(PrintStream out, boolean echo) throws InterruptedException
{
StringBuilder sb = new StringBuilder();
Key inputKey;
do
{
CommandOperation input = commandInvocation.getInput();
inputKey = input.getInputKey();
if (inputKey == Key.CTRL_C || inpu... | java |
public void preconfigureInput(InputComponent<?, ?> input, WithAttributes atts)
{
if (atts != null)
{
input.setEnabled(atts.enabled());
input.setLabel(atts.label());
input.setRequired(atts.required());
input.setRequiredMessage(atts.requiredMessage());
input.set... | java |
public DTOCollection from(Project project, JavaClass<?> entity, String dtoPackage)
{
DTOCollection dtoCollection = new DTOCollection();
if (entity == null)
{
throw new IllegalArgumentException("The argument entity was null.");
}
generatedDTOGraphForEntity(project, entity, dtoPa... | java |
@Override
public void start() {
synchronized (this.lifecycleMonitor) {
if (!isRunning()) {
log.info("start: Starting ConnectorManager");
try {
connector.start();
} catch (ConfigError | RuntimeError ex) {
thro... | java |
@Override
public void stop() {
synchronized (this.lifecycleMonitor) {
if (isRunning()) {
log.info("stop: Stopping ConnectorManager");
try {
connector.stop();
} finally {
running = false;
}
... | java |
public void visitBracketedExpression(Expr expr, Integer indent) {
boolean needsBrackets = needsBrackets(expr);
if (needsBrackets) {
out.print("(");
}
visitExpression(expr, indent);
if (needsBrackets) {
out.print(")");
}
} | java |
public <T extends Type> T selectCandidate(T candidate, T next, T actual, Environment environment) {
// Found a viable candidate
boolean left = subtypeOperator.isSubtype(candidate, next, environment);
boolean right = subtypeOperator.isSubtype(next, candidate, environment);
if (left && !right) {
// Yes, is bet... | java |
public static Type.Callable substitute(Type.Callable fmp, Tuple<Template.Variable> templateParameters,
Tuple<SyntacticItem> templateArguments) {
Function<Identifier,SyntacticItem> binding = WyilFile.bindingFunction(templateParameters,templateArguments);
// Proceed with the potentially updated binding
Tuple<Typ... | java |
public static <T extends SyntacticItem> java.util.function.Function<Identifier, SyntacticItem> bindingFunction(
Tuple<Template.Variable> variables, Tuple<T> arguments) {
//
return (Identifier var) -> {
for (int i = 0; i != variables.size(); ++i) {
if (var.equals(variables.get(i).getName())) {
return ... | java |
public static java.util.function.Function<Identifier, SyntacticItem> removeFromBinding(
java.util.function.Function<Identifier, SyntacticItem> binding, Tuple<Identifier> variables) {
return (Identifier var) -> {
// Sanity check whether this is a variable which is being removed
for (int i = 0; i != variables.... | java |
protected <T extends SemanticType.Atom> T construct(Disjunct type, LifetimeRelation lifetimes, Combinator<T> kind) {
T result = null;
Conjunct[] conjuncts = type.conjuncts;
for (int i = 0; i != conjuncts.length; ++i) {
Conjunct conjunct = conjuncts[i];
if (!isVoid(conjunct, lifetimes)) {
T tmp = constru... | java |
protected static int countMatchingFields(Tuple<? extends SemanticType.Field> lhsFields,
Tuple<? extends SemanticType.Field> rhsFields) {
int count = 0;
for (int i = 0; i != lhsFields.size(); ++i) {
for (int j = 0; j != rhsFields.size(); ++j) {
SemanticType.Field lhsField = lhsFields.get(i);
SemanticTy... | java |
private Stmt parseHeadlessStatement(EnclosingScope scope) {
int start = index;
// See if it is a named block
Identifier blockName = parseOptionalIdentifier(scope);
if (blockName != null) {
if (tryAndMatch(true, Colon) != null && isAtEOL()) {
int end = index;
matchEndLine();
scope = scope.newEncl... | java |
public Tuple<Expr> parseExpressions(EnclosingScope scope, boolean terminated) {
ArrayList<Expr> returns = new ArrayList<>();
// A return statement may optionally have a return expression.
// Therefore, we first skip all whitespace on the given line.
int next = skipLineSpace(index);
// Then, we check whether o... | java |
private Expr parseBitwiseOrExpression(EnclosingScope scope, boolean terminated) {
int start = index;
Expr lhs = parseBitwiseXorExpression(scope, terminated);
if (tryAndMatch(terminated, VerticalBar) != null) {
Expr rhs = parseExpression(scope, terminated);
return annotateSourceLocation(new Expr.BitwiseOr(T... | java |
private Expr parseBitwiseXorExpression(EnclosingScope scope, boolean terminated) {
int start = index;
Expr lhs = parseBitwiseAndExpression(scope, terminated);
if (tryAndMatch(terminated, Caret) != null) {
Expr rhs = parseExpression(scope, terminated);
return annotateSourceLocation(new Expr.BitwiseXor(Type.... | java |
private Expr parseBitwiseAndExpression(EnclosingScope scope, boolean terminated) {
int start = index;
Expr lhs = parseConditionExpression(scope, terminated);
if (tryAndMatch(terminated, Ampersand) != null) {
Expr rhs = parseExpression(scope, terminated);
return annotateSourceLocation(new Expr.BitwiseAnd(Ty... | java |
private Expr parseConditionExpression(EnclosingScope scope, boolean terminated) {
int start = index;
Token lookahead;
// First, attempt to parse quantifiers (e.g. some, all, no, etc)
if ((lookahead = tryAndMatch(terminated, Some, All)) != null) {
return parseQuantifierExpression(lookahead, scope, terminated... | java |
private Expr parseAdditiveExpression(EnclosingScope scope, boolean terminated) {
int start = index;
Expr lhs = parseMultiplicativeExpression(scope, terminated);
Token lookahead;
while ((lookahead = tryAndMatch(terminated, Plus, Minus)) != null) {
Expr rhs = parseMultiplicativeExpression(scope, terminated);
... | java |
private Expr parseMultiplicativeExpression(EnclosingScope scope, boolean terminated) {
int start = index;
Expr lhs = parseAccessExpression(scope, terminated);
Token lookahead = tryAndMatch(terminated, Star, RightSlash, Percent);
if (lookahead != null) {
Expr rhs = parseAccessExpression(scope, terminated);
... | java |
private Expr parseQualifiedAccess(EnclosingScope scope, boolean terminated) {
int start = index;
// Parse qualified name
Name name = parseName(scope);
// Construct link to be resolved
Decl.Link link = new Decl.Link<>(name);
// Decide what we've got
int mid = index;
Expr expr;
if (skipTemplate(scope) &... | java |
public boolean skipTemplate(EnclosingScope scope) {
int start = index;
if (tryAndMatch(false, LeftAngle) == null) {
return true;
} else {
boolean firstTime = true;
while (tryAndMatch(false, RightAngle) == null) {
if (!firstTime && tryAndMatch(false,Comma) == null) {
// Failed to match a comma. ... | java |
private Identifier parseLifetime(EnclosingScope scope, boolean terminated) {
Identifier id = parseOptionalLifetimeIdentifier(scope, terminated);
if (id != null) {
return id;
} else {
syntaxError("expecting lifetime identifier", tokens.get(index));
}
throw new RuntimeException("deadcode"); // dead-code
... | java |
private Token match(Token.Kind kind) {
checkNotEof();
Token token = tokens.get(index++);
if (token.kind != kind) {
syntaxError("expecting \"" + kind + "\" here", token);
}
return token;
} | java |
private Token[] match(Token.Kind... kinds) {
Token[] result = new Token[kinds.length];
for (int i = 0; i != result.length; ++i) {
checkNotEof();
Token token = tokens.get(index++);
if (token.kind == kinds[i]) {
result[i] = token;
} else {
syntaxError("Expected \"" + kinds[i] + "\" here", token);
... | java |
private boolean lookaheadSequence(boolean terminated, Token.Kind... kinds) {
int next = index;
for (Token.Kind k : kinds) {
next = terminated ? skipWhiteSpace(next) : skipLineSpace(next);
if (next >= tokens.size() || tokens.get(next++).kind != k) {
return false;
}
}
return true;
} | java |
private boolean isAtEOL() {
int next = skipLineSpace(index);
return next >= tokens.size() || tokens.get(next).kind == NewLine;
} | java |
private void matchEndLine() {
// First, parse all whitespace characters except for new lines
index = skipLineSpace(index);
// Second, check whether we've reached the end-of-file (as signaled by
// running out of tokens), or we've encountered some token which not a
// newline.
if (index >= tokens.size()) {
... | java |
private int skipWhiteSpace(int index) {
while (index < tokens.size() && isWhiteSpace(tokens.get(index))) {
index++;
}
return index;
} | java |
private void skipEmptyLines() {
int tmp = index;
do {
tmp = skipLineSpace(tmp);
if (tmp < tokens.size() && tokens.get(tmp).kind != Token.Kind.NewLine) {
return; // done
} else if (tmp >= tokens.size()) {
index = tmp;
return; // end-of-file reached
}
// otherwise, skip newline and continue... | java |
private boolean isWhiteSpace(Token token) {
return token.kind == Token.Kind.NewLine || isLineSpace(token);
} | java |
private BigInteger parseCharacter(String input) {
int pos = 1;
char c = input.charAt(pos++);
if (c == '\\') {
// escape code
switch (input.charAt(pos++)) {
case 'b':
c = '\b';
break;
case 't':
c = '\t';
break;
case 'n':
c = '\n';
break;
case 'f':
c = '\f';
break;
... | java |
protected byte[] parseUnicodeString(Token token) {
String v = token.text;
/*
* Parsing a string requires several steps to be taken. First, we need
* to strip quotes from the ends of the string.
*/
v = v.substring(1, v.length() - 1);
StringBuffer result = new StringBuffer();
// Second, step through t... | java |
private byte parseBinaryLiteral(Token input) {
String text = input.text;
if (text.length() > 11) {
// FIXME: this will be deprecated!
syntaxError("invalid binary literal (too long)", input);
}
int val = 0;
// Start past 0b
for (int i = 2; i != text.length(); ++i) {
char c = text.charAt(i);
// Sk... | java |
private BigInteger parseHexLiteral(Token input) {
String text = input.text;
// Start past 0x
for (int i = 2; i != text.length(); ++i) {
char c = text.charAt(i);
if(c != '_' && !isHexDigit(c)) {
syntaxError("invalid hex literal (invalid characters)", input);
}
}
// Remove "0x" and "_"
text = inp... | java |
public static Environment declareThisWithin(Decl.FunctionOrMethod decl, Environment environment) {
if (decl instanceof Decl.Method) {
Decl.Method method = (Decl.Method) decl;
environment = environment.declareWithin("this", method.getLifetimes());
}
return environment;
} | java |
public static Tuple<Decl.Variable> determineModifiedVariables(Stmt.Block block) {
HashSet<Decl.Variable> modified = new HashSet<>();
determineModifiedVariables(block, modified);
return new Tuple<>(modified);
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.