public void traverse()

in doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java [1563:1650]


        public void traverse() throws AptParseException {
            StringTokenizer lines = new StringTokenizer(text, EOL);
            int separator = -1;
            boolean firstLine = true;
            boolean title = false;
            boolean author = false;
            boolean date = false;

            loop:
            while (lines.hasMoreTokens()) {
                String line = lines.nextToken().trim();
                int lineLength = line.length();

                if (AptParser.charAt(line, lineLength, 0) == MINUS
                        && AptParser.charAt(line, lineLength, 1) == MINUS
                        && AptParser.charAt(line, lineLength, 2) == MINUS) {
                    switch (separator) {
                        case 0:
                            if (title) {
                                AptParser.this.sink.title_();
                            }
                        case 1:
                            if (author) {
                                AptParser.this.sink.author_();
                            }
                            break;
                        case 2:
                            // Note that an extra decorative line is allowed
                            // at the end of the author.
                            break loop;
                        default:
                            break;
                    }

                    ++separator;
                    firstLine = true;
                } else {
                    if (firstLine) {
                        firstLine = false;
                        switch (separator) {
                            case 0:
                                title = true;
                                AptParser.this.sink.title();
                                break;
                            case 1:
                                author = true;
                                AptParser.this.sink.author();
                                break;
                            case 2:
                                date = true;
                                AptParser.this.sink.date();
                                break;
                            default:
                                break;
                        }
                    } else {
                        if (separator == 1) {
                            AptParser.this.sink.author_();
                            AptParser.this.sink.author();
                        } else {
                            // An implicit lineBreak separates title lines.
                            AptParser.this.sink.lineBreak();
                        }
                    }

                    AptParser.this.doTraverseText(line, 0, lineLength, AptParser.this.sink);
                }
            }

            switch (separator) {
                case 0:
                    if (title) {
                        AptParser.this.sink.title_();
                    }
                case 1:
                    if (author) {
                        AptParser.this.sink.author_();
                    }
                    break;
                case 2:
                    if (date) {
                        AptParser.this.sink.date_();
                    }
                    break;
                default:
                    break;
            }
        }