376 |
|
|
377 |
case STATE_BEGOFLINE: |
case STATE_BEGOFLINE: |
378 |
if (i==firstSentenceEnd) { |
if (i==firstSentenceEnd) { |
379 |
contextTag = addTag(tags, "text", bufToString(), true, contextClass, contextMember, contextTag, false); |
AbstractTagImpl newTag = addTag(tags, "text", bufToString(), true, contextClass, contextMember, contextTag, false); |
380 |
|
if (null != newTag) { |
381 |
|
contextTag = newTag; |
382 |
|
} |
383 |
setBufLength(0); |
setBufLength(0); |
384 |
} |
} |
385 |
|
|
415 |
|
|
416 |
case STATE_WHITESPACE: |
case STATE_WHITESPACE: |
417 |
if (i==firstSentenceEnd) { |
if (i==firstSentenceEnd) { |
418 |
contextTag = addTag(tags, "text", bufToString(), true, contextClass, contextMember, contextTag, false); |
AbstractTagImpl newTag = addTag(tags, "text", bufToString(), true, contextClass, contextMember, contextTag, false); |
419 |
|
if (null != newTag) { |
420 |
|
contextTag = newTag; |
421 |
|
} |
422 |
setBufLength(0); |
setBufLength(0); |
423 |
} |
} |
424 |
|
|
431 |
} |
} |
432 |
else if (c=='@' || (c=='{' && peek=='@') || c==EOL) { |
else if (c=='@' || (c=='{' && peek=='@') || c==EOL) { |
433 |
if (bufLength()>0) { |
if (bufLength()>0) { |
434 |
contextTag = addTag(tags, "text", bufToString(), i<firstSentenceEnd, contextClass, contextMember, contextTag, false); |
AbstractTagImpl newTag = addTag(tags, "text", bufToString(), i<firstSentenceEnd, contextClass, contextMember, contextTag, false); |
435 |
|
if (null != newTag) { |
436 |
|
contextTag = newTag; |
437 |
|
} |
438 |
setBufLength(0); |
setBufLength(0); |
439 |
} |
} |
440 |
if (c=='{') { |
if (c=='{') { |
470 |
} |
} |
471 |
else if (c=='@' || (c=='{' && peek=='@') || c==EOL) { |
else if (c=='@' || (c=='{' && peek=='@') || c==EOL) { |
472 |
paramValue=bufToString(); |
paramValue=bufToString(); |
473 |
contextTag = addTag(tags, paramName, paramValue, i<firstSentenceEnd, contextClass, contextMember, contextTag, false); |
AbstractTagImpl newTag = addTag(tags, paramName, paramValue, i<firstSentenceEnd, contextClass, contextMember, contextTag, false); |
474 |
|
if (null != newTag) { |
475 |
|
contextTag = newTag; |
476 |
|
} |
477 |
setBufLength(0); |
setBufLength(0); |
478 |
if (c=='{') { |
if (c=='{') { |
479 |
++i; |
++i; |
509 |
if (c=='}') { |
if (c=='}') { |
510 |
// tag without value |
// tag without value |
511 |
paramName=bufToString(); |
paramName=bufToString(); |
512 |
contextTag = addTag(tags, paramName, "", i<firstSentenceEnd, contextClass, contextMember, contextTag, true); |
AbstractTagImpl newTag = addTag(tags, paramName, "", i<firstSentenceEnd, contextClass, contextMember, contextTag, true); |
513 |
|
if (null != newTag) { |
514 |
|
contextTag = newTag; |
515 |
|
} |
516 |
state=prevState; |
state=prevState; |
517 |
setBufLength(0); |
setBufLength(0); |
518 |
} |
} |
534 |
case STATE_PARAMVALUE: |
case STATE_PARAMVALUE: |
535 |
if (c==EOL) { |
if (c==EOL) { |
536 |
paramValue=bufToString(); |
paramValue=bufToString(); |
537 |
contextTag = addTag(tags, paramName, paramValue, i<firstSentenceEnd, contextClass, contextMember, contextTag, false); |
AbstractTagImpl newTag = addTag(tags, paramName, paramValue, i<firstSentenceEnd, contextClass, contextMember, contextTag, false); |
538 |
|
if (null != newTag) { |
539 |
|
contextTag = newTag; |
540 |
|
} |
541 |
} |
} |
542 |
else if (c=='\n') { |
else if (c=='\n') { |
543 |
appendToBuf(c); |
appendToBuf(c); |
555 |
} |
} |
556 |
else if (c==EOL || c=='}') { |
else if (c==EOL || c=='}') { |
557 |
paramValue=bufToString(); |
paramValue=bufToString(); |
558 |
contextTag = addTag(tags, paramName, paramValue, i<firstSentenceEnd, contextClass, contextMember, contextTag, true); |
AbstractTagImpl newTag = addTag(tags, paramName, paramValue, i<firstSentenceEnd, contextClass, contextMember, contextTag, true); |
559 |
|
if (null != newTag) { |
560 |
|
contextTag = newTag; |
561 |
|
} |
562 |
state=prevState; |
state=prevState; |
563 |
setBufLength(0); |
setBufLength(0); |
564 |
} |
} |
579 |
} |
} |
580 |
else if (c==EOL) { |
else if (c==EOL) { |
581 |
if (bufLength()>0) { |
if (bufLength()>0) { |
582 |
contextTag = addTag(tags, "text", bufToString(), i<firstSentenceEnd, contextClass, contextMember, contextTag, false); |
AbstractTagImpl newTag = addTag(tags, "text", bufToString(), i<firstSentenceEnd, contextClass, contextMember, contextTag, false); |
583 |
|
if (null != newTag) { |
584 |
|
contextTag = newTag; |
585 |
|
} |
586 |
} |
} |
587 |
} |
} |
588 |
else { |
else { |
603 |
} |
} |
604 |
else if (c==EOL) { |
else if (c==EOL) { |
605 |
if (bufLength()>0) { |
if (bufLength()>0) { |
606 |
contextTag = addTag(tags, "text", bufToString(), i<firstSentenceEnd, contextClass, contextMember, contextTag, false); |
AbstractTagImpl newTag = addTag(tags, "text", bufToString(), i<firstSentenceEnd, contextClass, contextMember, contextTag, false); |
607 |
|
if (null != newTag) { |
608 |
|
contextTag = newTag; |
609 |
|
} |
610 |
setBufLength(0); |
setBufLength(0); |
611 |
} |
} |
612 |
} |
} |
620 |
|
|
621 |
case STATE_TEXT: |
case STATE_TEXT: |
622 |
if (i==firstSentenceEnd) { |
if (i==firstSentenceEnd) { |
623 |
contextTag = addTag(tags, "text", bufToString(), true, contextClass, contextMember, contextTag, false); |
AbstractTagImpl newTag = addTag(tags, "text", bufToString(), true, contextClass, contextMember, contextTag, false); |
624 |
|
if (null != newTag) { |
625 |
|
contextTag = newTag; |
626 |
|
} |
627 |
setBufLength(0); |
setBufLength(0); |
628 |
} |
} |
629 |
|
|
630 |
if (c==EOL) { |
if (c==EOL) { |
631 |
paramValue=bufToString(); |
paramValue=bufToString(); |
632 |
contextTag = addTag(tags, "text", paramValue, i<firstSentenceEnd, contextClass, contextMember, contextTag, false); |
AbstractTagImpl newTag = addTag(tags, "text", paramValue, i<firstSentenceEnd, contextClass, contextMember, contextTag, false); |
633 |
|
if (null != newTag) { |
634 |
|
contextTag = newTag; |
635 |
|
} |
636 |
} |
} |
637 |
else if (c=='\n') { |
else if (c=='\n') { |
638 |
appendToBuf(c); |
appendToBuf(c); |
640 |
} |
} |
641 |
else if (c=='{' && peek=='@') { |
else if (c=='{' && peek=='@') { |
642 |
paramValue=bufToString(); |
paramValue=bufToString(); |
643 |
contextTag = addTag(tags, "text", paramValue, i<firstSentenceEnd, contextClass, contextMember, contextTag, false); |
AbstractTagImpl newTag = addTag(tags, "text", paramValue, i<firstSentenceEnd, contextClass, contextMember, contextTag, false); |
644 |
|
if (null != newTag) { |
645 |
|
contextTag = newTag; |
646 |
|
} |
647 |
++i; |
++i; |
648 |
setBufLength(0); |
setBufLength(0); |
649 |
state=STATE_INLINEPARAM; |
state=STATE_INLINEPARAM; |
716 |
AbstractTagImpl contextTag, |
AbstractTagImpl contextTag, |
717 |
boolean isInline) { |
boolean isInline) { |
718 |
|
|
719 |
AbstractTagImpl tag; |
AbstractTagImpl tag = null; |
720 |
|
|
721 |
|
boolean haveValue = (0 != value.trim().length()); |
722 |
|
|
723 |
|
String emptyWarning = "Empty @" + name + " tag."; |
724 |
|
|
725 |
if (name.equals("param")) { |
if (name.equals("param")) { |
726 |
tag=new ParamTagImpl(value, contextClass, contextMember); |
if (haveValue) { |
727 |
|
tag=new ParamTagImpl(value, contextClass, contextMember); |
728 |
|
} |
729 |
|
else { |
730 |
|
//printWarning(emptyWarning); |
731 |
|
} |
732 |
} |
} |
733 |
else if (name.equals("see")) { |
else if (name.equals("see")) { |
734 |
tag=new SeeTagImpl(value, contextClass); |
if (haveValue) { |
735 |
|
tag=new SeeTagImpl(value, contextClass); |
736 |
|
} |
737 |
|
else { |
738 |
|
//printWarning(emptyWarning); |
739 |
|
} |
740 |
} |
} |
741 |
else if (name.equals("link") || name.equals("linkplain")) { |
else if (name.equals("link") || name.equals("linkplain")) { |
742 |
tag=new LinkTagImpl("@" + name, value, contextClass); |
if (haveValue) { |
743 |
isInline = true; |
tag=new LinkTagImpl("@" + name, value, contextClass); |
744 |
|
isInline = true; |
745 |
|
} |
746 |
|
else { |
747 |
|
//printWarning(emptyWarning); |
748 |
|
} |
749 |
} |
} |
750 |
else if (name.equals("value")) { |
else if (name.equals("value")) { |
751 |
tag=new ValueTagImpl(value, contextClass); |
if (haveValue) { |
752 |
isInline = true; |
tag=new ValueTagImpl(value, contextClass); |
753 |
|
isInline = true; |
754 |
|
} |
755 |
|
else { |
756 |
|
//printWarning(emptyWarning); |
757 |
|
} |
758 |
} |
} |
759 |
else if (name.equals("inheritDoc")) { |
else if (name.equals("inheritDoc")) { |
760 |
if (value.trim().length() > 0) { |
if (haveValue) { |
761 |
//printWarning("@inheritDoc tags are not supposed to have any content."); |
//printWarning("@inheritDoc tags are not supposed to have any content."); |
762 |
} |
} |
763 |
tag=new InheritDocTagImpl(contextClass, contextMember, contextTag); |
tag=new InheritDocTagImpl(contextClass, contextMember, contextTag); |
764 |
isInline = true; |
isInline = true; |
765 |
} |
} |
766 |
else if (name.equals("serialField")) { |
else if (name.equals("serialField")) { |
767 |
tag=new SerialFieldTagImpl(value, contextClass, contextMember); |
if (haveValue) { |
768 |
|
tag=new SerialFieldTagImpl(value, contextClass, contextMember); |
769 |
|
} |
770 |
|
else { |
771 |
|
//printWarning(emptyWarning); |
772 |
|
} |
773 |
} |
} |
774 |
else if (name.equals("throws") || name.equals("exception")) { |
else if (name.equals("throws") || name.equals("exception")) { |
775 |
Debug.log(1,"adding tag '"+name+"' value '"+value+"'"); |
if (haveValue) { |
776 |
tag=new ThrowsTagImpl(value, contextClass, contextMember); |
tag=new ThrowsTagImpl(value, contextClass, contextMember); |
777 |
|
} |
778 |
|
else { |
779 |
|
//printWarning(emptyWarning); |
780 |
|
} |
781 |
name="throws"; |
name="throws"; |
782 |
} |
} |
783 |
else if (name.equals("text")) { |
else if (name.equals("text")) { |
789 |
// FIXME: consider taglets |
// FIXME: consider taglets |
790 |
} |
} |
791 |
|
|
792 |
if (isInline) { |
if (tag != null) { |
793 |
((List)tags.get("inline")).add(tag); |
if (isInline) { |
794 |
if (isFirstSentence) { |
((List)tags.get("inline")).add(tag); |
795 |
if (name.equals("text")) { |
if (isFirstSentence) { |
796 |
String txt = ((TextTagImpl)tag).getText(); |
if (name.equals("text")) { |
797 |
Tag newTag; |
String txt = ((TextTagImpl)tag).getText(); |
798 |
if (txt.startsWith("<p>")) { |
Tag newTag; |
799 |
newTag = new TextTagImpl(txt.substring(3)); |
if (txt.startsWith("<p>")) { |
800 |
} |
newTag = new TextTagImpl(txt.substring(3)); |
801 |
else if (txt.endsWith("</p>")) { |
} |
802 |
newTag = new TextTagImpl(txt.substring(0, txt.length() - 4)); |
else if (txt.endsWith("</p>")) { |
803 |
|
newTag = new TextTagImpl(txt.substring(0, txt.length() - 4)); |
804 |
|
} |
805 |
|
else { |
806 |
|
newTag = tag; |
807 |
|
} |
808 |
|
((List)tags.get("first")).add(newTag); |
809 |
|
|
810 |
} |
} |
811 |
else { |
else { |
812 |
newTag = tag; |
((List)tags.get("first")).add(tag); |
813 |
} |
} |
|
((List)tags.get("first")).add(newTag); |
|
|
|
|
|
} |
|
|
else { |
|
|
((List)tags.get("first")).add(tag); |
|
814 |
} |
} |
815 |
} |
} |
816 |
|
else { |
817 |
|
((List)tags.get("all")).add(tag); |
818 |
|
} |
819 |
|
|
820 |
|
List l=((List)tags.get(name)); |
821 |
|
if (l==null) { |
822 |
|
l=new LinkedList(); |
823 |
|
tags.put(name,l); |
824 |
|
} |
825 |
|
l.add(tag); |
826 |
|
|
827 |
|
return isInline ? tag : contextTag; |
828 |
} |
} |
829 |
else { |
else { |
830 |
((List)tags.get("all")).add(tag); |
return null; |
|
} |
|
|
|
|
|
List l=((List)tags.get(name)); |
|
|
if (l==null) { |
|
|
l=new LinkedList(); |
|
|
tags.put(name,l); |
|
831 |
} |
} |
|
l.add(tag); |
|
|
|
|
|
return isInline ? tag : contextTag; |
|
832 |
} |
} |
833 |
|
|
834 |
// Return all tags in this Doc item. |
// Return all tags in this Doc item. |