final boolean parse(List<String> args, int argumentIx) { // Save and remove the argument name String argumentName = args.remove(argumentIx); // Enough parameters left? boolean res = hasEnoughParametersLeft(args); if (res) { // We only do this loop if the current type takes at least one parameter for (int currentParameter = 0; res && currentParameter < myMaxParameterCount // Don't take to many parameters && args.size() > 0 // Still some left in data && argumentIx < args.size() // Not yet reached end of data ; ++currentParameter) { // Get the next parameter from the 'front', i.e. where our parameters start. String parameter = args.remove(argumentIx); res = doTypeParse(parameter); } } else { myResult.notEnoughParameters(argumentName, myMinParameterCount); } res = res && checkLimits() && isSuccessFullyParsed(); if (res) { retrieveResult(myParser); } else { myResult.failedToParseArgument(argumentName); } return res; }
public static String getSubstring(IParseResult parseResult, CSTNode cstNode) { return parseResult.getTextRange( cstNode.getStartOffset(), cstNode.getEndOffset() - cstNode.getStartOffset() + 1); }