Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void parseValue(StringBuilder value) {
- if (getChar() != FileSource.END) {
- switch (getChar()) {
- case '*':
- next();
- if (getChar() == '*') {
- next();
- getNewTag("**", value);
- } else {
- getNewTag("*", value);
- }
- break;
- case '_':
- next();
- if (getChar() == '_') {
- next();
- getNewTag("__", value);
- } else {
- getNewTag("_", value);
- }
- break;
- case '`':
- next();
- getNewTag("`", value);
- case '-':
- next();
- if (getChar() == '-') {
- next();
- getNewTag("--", value);
- } else {
- value.append('-');
- }
- break;
- default:
- value.append(parseString());
- break;
- }
- parseValue(value);
- }
- }
- private void getNewTag(String openTag, StringBuilder value) {
- String curTag = String.valueOf(getChar());
- if (curTag.equals(openTag)) {
- next();
- getLineWithTags(openTag, value);
- } else {
- next();
- if ((curTag + getChar()).equals(openTag)) {
- next();
- getLineWithTags(openTag, value);
- } else {
- parseValue(value);
- }
- }
- }
- private void getLineWithTags(String tag, StringBuilder value) {
- value.insert(0, createOpenTag(tag)).append(createClosedTag(tag));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement