/** * Parse VALUE tag. * <p> * This tag can appear anywhere in a line. * The text before is treated as simple text. * The text after is parsed. * * @param container the container to add to, not null * @param line the line to parse, not null */ private void parseValueTag(ContainerSqlFragment container, Line line) { Line[] split = line.split(line.lineTrimmed().indexOf("@VALUE")); parseLine(container, split[0]); Line lineStartingAtTag = split[1]; Matcher matcher = VALUE_PATTERN.matcher(lineStartingAtTag.lineTrimmed()); if (matcher.matches() == false) { throw new IllegalArgumentException("@VALUE found with invalid format: " + line); } String followingSpaces = matcher.group(2); Line subLine = lineStartingAtTag.splitRemainder(matcher.start(3)); boolean followWithSpace = (followingSpaces != null && followingSpaces.length() > 0) || subLine.lineTrimmed().isEmpty(); ValueSqlFragment valueFragment = new ValueSqlFragment(matcher.group(1), followWithSpace); container.addFragment(valueFragment); parseLine(container, subLine); }
Line[] split = line.split(line.lineTrimmed().indexOf(tagName)); parseLine(container, split[0]); String trimmed = split[1].lineTrimmed();
Line[] split = line.split(line.lineTrimmed().indexOf("@OFFSETFETCH")); parseLine(container, split[0]); String trimmed = split[1].lineTrimmed();
return; String trimmed = line.lineTrimmed(); if (trimmed.startsWith("@NAME")) { Matcher nameMatcher = NAME_PATTERN.matcher(trimmed);
String trimmed = line.lineTrimmed(); if (trimmed.length() == 0) { return;
Line[] split = line.split(line.lineTrimmed().indexOf("@FETCH")); parseLine(container, split[0]); String trimmed = split[1].lineTrimmed();
/** * Parse INCLUDE tag. * <p> * This tag can appear anywhere in a line. * It substitutes the entire content of the named section in at this point. * The text before is treated as simple text. * The text after is parsed. * * @param container the container to add to, not null * @param line the line to parse, not null */ private void parseIncludeTag(ContainerSqlFragment container, Line line) { Line[] split = line.split(line.lineTrimmed().indexOf("@INCLUDE")); parseLine(container, split[0]); String trimmed = split[1].lineTrimmed(); Matcher matcher = INCLUDE_PATTERN.matcher(trimmed); if (matcher.matches() == false) { throw new IllegalArgumentException("@INCLUDE found with invalid format: " + line); } IncludeSqlFragment includeFragment = new IncludeSqlFragment(matcher.group(1)); container.addFragment(includeFragment); Line subLine = split[1].splitRemainder(matcher.start(2)); parseLine(container, subLine); }